OPS loading: don't replace existing particles twice, and clear soap ctype

This commit is contained in:
jacksonmj 2012-04-27 18:26:37 +01:00
parent 257c069da1
commit 5d5b8143a4

View File

@ -1141,7 +1141,7 @@ int parse_save_OPS(void *save, int size, int replace, int x0, int y0, unsigned c
} }
if(partsData[i] >= PT_NUM) if(partsData[i] >= PT_NUM)
partsData[i] = PT_DMND; //Replace all invalid elements with diamond partsData[i] = PT_DMND; //Replace all invalid elements with diamond
if(pmap[y][x]) if(pmap[y][x] && posCount==0) // Check posCount to make sure an existing particle is not replaced twice if two particles are saved in that position
{ {
//Replace existing particle or allocated block //Replace existing particle or allocated block
newIndex = pmap[y][x]>>8; newIndex = pmap[y][x]>>8;
@ -1284,6 +1284,10 @@ int parse_save_OPS(void *save, int size, int replace, int x0, int y0, unsigned c
STKM_init_legs(&(fighters[fcount]), newIndex); STKM_init_legs(&(fighters[fcount]), newIndex);
} }
} }
else if (partsptr[newIndex].type == PT_SOAP)
{
partsptr[newIndex].ctype = 0;
}
if (!ptypes[partsptr[newIndex].type].enabled) if (!ptypes[partsptr[newIndex].type].enabled)
partsptr[newIndex].type = PT_NONE; partsptr[newIndex].type = PT_NONE;
} }