aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2012-11-30 16:06:26 +0100
committerLaurent Ghigonis <laurent@p1sec.com>2012-11-30 16:06:26 +0100
commit4da9606c971a5c53eba4238805b2fbb4c01dfdbf (patch)
treeb13d8de0e662abdba4c35297617f8a5e1c9b49e5
parentdisplay different fixed colors based on glouglou event. (diff)
downloadglouglou-4da9606c971a5c53eba4238805b2fbb4c01dfdbf.tar.xz
glouglou-4da9606c971a5c53eba4238805b2fbb4c01dfdbf.zip
when injecting pattern, do not erase living cells
-rw-r--r--src/elife_evas_smart.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/elife_evas_smart.c b/src/elife_evas_smart.c
index b732294..f14e534 100644
--- a/src/elife_evas_smart.c
+++ b/src/elife_evas_smart.c
@@ -308,6 +308,7 @@ grid_inject_pattern(struct grid *grid, u_int32_t color)
lifepattern_s *pat;
int x, y, cx, cy;
int i, j;
+ int age;
npat = rand() % PATTERN_COUNT;
if (DEBUG)
@@ -322,7 +323,9 @@ grid_inject_pattern(struct grid *grid, u_int32_t color)
if (cx >= grid->w || cy >= grid->h)
continue;
cell = CELL_GET(grid, cx, cy);
- cell->newage = (pat->pat[pat->w*j + i] - '0') * 27;
+ age = (pat->pat[pat->w*j + i] - '0') * 27;
+ if (age != 0)
+ cell->newage = age;
cell->forced_color = color;
cell->age = cell->newage;
// cell_redraw(cell, grid);