summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-01-16 18:54:36 (GMT)
committer Cracker64 <cracker642@gmail.com>2011-01-16 18:54:36 (GMT)
commitdb5bb618c171fe016d507307fe9774b12939ac49 (patch)
treede60099e65bb0584579f59f0200fddcf8d46fe11 /src
parentb1e09d421681ea7e3f57d0e6ee71582c8060cf04 (diff)
downloadpowder-db5bb618c171fe016d507307fe9774b12939ac49.zip
powder-db5bb618c171fe016d507307fe9774b12939ac49.tar.gz
fix loading of old GoL saves, and fix wall crash
Diffstat (limited to 'src')
-rw-r--r--src/main.c7
-rw-r--r--src/powder.c2
2 files changed, 7 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index a12ff9b..8ff3329 100644
--- a/src/main.c
+++ b/src/main.c
@@ -405,7 +405,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
unsigned char *d,*c=save;
int i,j,k,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int)), ver, pty, ty, legacy_beta=0;
- int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h;
+ int bx0=x0/CELL, by0=y0/CELL, bw, bh, w, h, q;
int fp[NPART], nf=0, new_format = 0, ttv = 0;
//New file header uses PSv, replacing fuC. This is to detect if the client uses a new save format for temperatures
@@ -707,6 +707,11 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
ttv = (d[p++])<<8;
ttv |= (d[p++]);
parts[i-1].tmp = ttv;
+ if(ptypes[parts[i-1].type].properties&PROP_LIFE && !parts[i-1].tmp)
+ for(q = 1; q<NGOL ; q++){
+ if(parts[i-1].type==goltype[q-1] && grule[q][9]==2)
+ parts[i-1].tmp = grule[q][9]-1;
+ }
} else {
p+=2;
}
diff --git a/src/powder.c b/src/powder.c
index 6aa4e41..89e65fb 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1297,7 +1297,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
r = pmap[ny][nx];
int neighbors = gol2[nx][ny][0];
- if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF))
+ if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF) || (r>>8)>=NPART)
continue;
for( golnum = 1;golnum<NGOL;golnum++)
for( goldelete = 0;goldelete<9;goldelete++)