From 78c89dc62b5a40cafebd0a9342fba71730f21193 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Wed, 18 Dec 2013 13:40:30 -0500 Subject: [PATCH] fix crash with LIFE, fix compiling with lua (again) --- src/simulation/elements/LIFE.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/simulation/elements/LIFE.cpp b/src/simulation/elements/LIFE.cpp index d44231030..05f75e189 100644 --- a/src/simulation/elements/LIFE.cpp +++ b/src/simulation/elements/LIFE.cpp @@ -66,7 +66,7 @@ Element_LIFE::Element_LIFE() //#TPT-Directive ElementHeader Element_LIFE static int update(UPDATE_FUNC_ARGS) int Element_LIFE::update(UPDATE_FUNC_ARGS) { - if (parts[i].tmp <= 0) + if (parts[i].tmp <= 0 && parts[i].tmp > NGOL) sim->kill_part(i); return 0; } @@ -118,9 +118,13 @@ int Element_LIFE::graphics(GRAPHICS_FUNC_ARGS) pc = PIXRGB(150, 150, 0); else pc = PIXRGB(255, 255, 0); - } else { + } + else if (cpart->ctype >= 0 && cpart->ctype < NGOL) + { pc = Element_GOL_colour[cpart->ctype]; } + else + pc = ren->sim->elements[cpart->type].Colour; *colr = PIXR(pc); *colg = PIXG(pc); *colb = PIXB(pc);