Fix BCLN saving

This commit is contained in:
Simon
2010-12-07 21:05:26 +00:00
parent 7968e37b4e
commit 76b6a886b3

View File

@@ -340,7 +340,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
for(j=0; j<w*h; j++) for(j=0; j<w*h; j++)
{ {
i = m[j]; i = m[j];
if(i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_PCLN || 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))
d[p++] = parts[i-1].ctype; d[p++] = parts[i-1].ctype;
} }
@@ -726,7 +726,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{ {
i = m[j]; i = m[j];
ty = d[pty+j]; ty = d[pty+j];
if(i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_BCLN && ver>=43) || (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)))
{ {
if(p >= size) if(p >= size)
goto corrupt; goto corrupt;
@@ -1391,18 +1391,18 @@ int main(int argc, char *argv[])
{ {
bsy -= 1; bsy -= 1;
} }
else else
{ {
bsx -= ceil((bsx/5)+0.5f); bsx -= ceil((bsx/5)+0.5f);
bsy -= ceil((bsy/5)+0.5f); bsy -= ceil((bsy/5)+0.5f);
} }
if(bsx>1180) if(bsx>1180)
bsx = 1180; bsx = 1180;
if(bsy>1180) if(bsy>1180)
bsy = 1180; bsy = 1180;
if(bsx<0) if(bsx<0)
bsx = 0; bsx = 0;
if(bsy<0) if(bsy<0)
bsy = 0; bsy = 0;
} }
} }
@@ -1418,7 +1418,7 @@ int main(int argc, char *argv[])
} }
else else
{ {
if(sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL))) if(sdl_mod & (KMOD_LALT|KMOD_RALT) && !(sdl_mod & (KMOD_SHIFT|KMOD_CTRL)))
{ {
bsx += 1; bsx += 1;
bsy += 1; bsy += 1;
@@ -1431,18 +1431,18 @@ int main(int argc, char *argv[])
{ {
bsy += 1; bsy += 1;
} }
else else
{ {
bsx += ceil((bsx/5)+0.5f); bsx += ceil((bsx/5)+0.5f);
bsy += ceil((bsy/5)+0.5f); bsy += ceil((bsy/5)+0.5f);
} }
if(bsx>1180) if(bsx>1180)
bsx = 1180; bsx = 1180;
if(bsy>1180) if(bsy>1180)
bsy = 1180; bsy = 1180;
if(bsx<0) if(bsx<0)
bsx = 0; bsx = 0;
if(bsy<0) if(bsy<0)
bsy = 0; bsy = 0;
} }
} }
@@ -1550,7 +1550,7 @@ int main(int argc, char *argv[])
bsx = 1180; bsx = 1180;
if(bsx<0) if(bsx<0)
bsx = 0; bsx = 0;
if(bsy>1180) if(bsy>1180)
bsy = 1180; bsy = 1180;
if(bsy<0) if(bsy<0)
bsy = 0; bsy = 0;