Particle life now saved as 16bit integer, increases limit and fixes saving of wire and other elements. Version 44 to reflect save format change
This commit is contained in:
parent
5d843e398c
commit
b54c0b6934
@ -7,7 +7,7 @@
|
|||||||
#define PATH_SEP "/"
|
#define PATH_SEP "/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SAVE_VERSION 43
|
#define SAVE_VERSION 44
|
||||||
#define MINOR_VERSION 1
|
#define MINOR_VERSION 1
|
||||||
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
||||||
#define BETA
|
#define BETA
|
||||||
|
34
src/main.c
34
src/main.c
@ -303,8 +303,13 @@ 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)
|
if(i){
|
||||||
d[p++] = (parts[i-1].life+3)/4;
|
//Everybody loves a 16bit int
|
||||||
|
//d[p++] = (parts[i-1].life+3)/4;
|
||||||
|
int ttlife = (int)parts[i-1].life;
|
||||||
|
d[p++] = ((ttlife&0xFF00)>>8);
|
||||||
|
d[p++] = (ttlife&0x00FF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for(j=0; j<w*h; j++)
|
for(j=0; j<w*h; j++)
|
||||||
{
|
{
|
||||||
@ -584,12 +589,25 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
|
|||||||
i = m[j];
|
i = m[j];
|
||||||
if(i)
|
if(i)
|
||||||
{
|
{
|
||||||
if(p >= size)
|
if(ver>=44){
|
||||||
goto corrupt;
|
if(p >= size) {
|
||||||
if(i <= NPART)
|
goto corrupt;
|
||||||
parts[i-1].life = d[p++]*4;
|
}
|
||||||
else
|
if(i <= NPART) {
|
||||||
p++;
|
ttv = (d[p++])<<8;
|
||||||
|
ttv |= (d[p++]);
|
||||||
|
parts[i-1].life = ttv;
|
||||||
|
} else {
|
||||||
|
p+=2;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(p >= size)
|
||||||
|
goto corrupt;
|
||||||
|
if(i <= NPART)
|
||||||
|
parts[i-1].life = d[p++]*4;
|
||||||
|
else
|
||||||
|
p++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(j=0; j<w*h; j++)
|
for(j=0; j<w*h; j++)
|
||||||
|
Reference in New Issue
Block a user