Fix fighters sometimes loading from saves with no element

This commit is contained in:
jacob1 2020-02-08 11:10:53 -05:00
parent ca8f4e3aac
commit 6b73b2dd9b
2 changed files with 2 additions and 1 deletions

View File

@ -228,6 +228,7 @@ int Simulation::Load(GameSave * save, bool includePressure, int fullX, int fullY
fan = true; fan = true;
parts[i].ctype = 0; parts[i].ctype = 0;
} }
fighters[parts[i].tmp].elem = PT_DUST;
void Element_FIGH_NewFighter(Simulation *sim, int fighterID, int i, int elem); void Element_FIGH_NewFighter(Simulation *sim, int fighterID, int i, int elem);
Element_FIGH_NewFighter(this, parts[i].tmp, i, parts[i].ctype); Element_FIGH_NewFighter(this, parts[i].tmp, i, parts[i].ctype);
if (fan) if (fan)

View File

@ -208,7 +208,7 @@ static void Free(Simulation *sim, unsigned char i)
void Element_FIGH_NewFighter(Simulation *sim, int fighterID, int i, int elem) void Element_FIGH_NewFighter(Simulation *sim, int fighterID, int i, int elem)
{ {
Element_STKM_init_legs(sim, &sim->fighters[fighterID], i); Element_STKM_init_legs(sim, &sim->fighters[fighterID], i);
if (elem >= 0 && elem < PT_NUM) if (elem > 0 && elem < PT_NUM)
sim->fighters[fighterID].elem = elem; sim->fighters[fighterID].elem = elem;
sim->fighters[fighterID].spwn = 1; sim->fighters[fighterID].spwn = 1;
} }