summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-07-09 17:22:25 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-07-09 17:22:25 (GMT)
commitd42e06f37a93475a09cd2908849b2f33a50513ac (patch)
tree3bb435ec3648d897a821cf99ff2469277da51791 /src/main.c
parentd2eb6f1cb31f2d746d5897e775424ed0d1448703 (diff)
downloadpowder-d42e06f37a93475a09cd2908849b2f33a50513ac.zip
powder-d42e06f37a93475a09cd2908849b2f33a50513ac.tar.gz
Merge all GOL types into PT_LIFE, behaviour is determined by ctype
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 8d84146..633b2fe 100644
--- a/src/main.c
+++ b/src/main.c
@@ -466,7 +466,7 @@ void *build_save(int *size, int x0, int y0, int w, int h, unsigned char bmap[YRE
for (j=0; j<w*h; j++)
{
i = m[j];
- if (i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_BCLN || parts[i-1].type==PT_SPRK || parts[i-1].type==PT_LAVA || parts[i-1].type==PT_PIPE))
+ if (i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_BCLN || parts[i-1].type==PT_SPRK || parts[i-1].type==PT_LAVA || parts[i-1].type==PT_PIPE || parts[i-1].type==PT_LIFE))
d[p++] = parts[i-1].ctype;
}
@@ -975,9 +975,10 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char
}
for (j=0; j<w*h; j++)
{
+ int gnum = 0;
i = m[j];
ty = d[pty+j];
- if (i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_BCLN && ver>=44) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34) || (ty==PT_PIPE && ver>=43)))
+ if (i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_BCLN && ver>=44) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34) || (ty==PT_PIPE && ver>=43) || (ty==PT_LIFE && ver>=51)))
{
if (p >= size)
goto corrupt;
@@ -997,6 +998,15 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char
parts[i-1].dcolour = 0xFF000000;
parts[i-1].type = PT_DMND;
}
+ if(ver<51 && ((ty>=78 && ty<=89) || (ty>=134 && ty<=146 && ty!=141))){
+ //Replace old GOL
+ parts[i-1].type = PT_LIFE;
+ for (gnum = 0; gnum<NGOLALT; gnum++){
+ if (ty==goltype[gnum])
+ parts[i-1].ctype = gnum;
+ }
+ ty = PT_LIFE;
+ }
}
}