From 6b73b2dd9b14b9c3dcaae31b513ac7bc5d0c25b5 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 8 Feb 2020 11:10:53 -0500 Subject: [PATCH] Fix fighters sometimes loading from saves with no element --- src/simulation/Simulation.cpp | 1 + src/simulation/elements/FIGH.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 0109f0914..9dc497561 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -228,6 +228,7 @@ int Simulation::Load(GameSave * save, bool includePressure, int fullX, int fullY fan = true; parts[i].ctype = 0; } + fighters[parts[i].tmp].elem = PT_DUST; void Element_FIGH_NewFighter(Simulation *sim, int fighterID, int i, int elem); Element_FIGH_NewFighter(this, parts[i].tmp, i, parts[i].ctype); if (fan) diff --git a/src/simulation/elements/FIGH.cpp b/src/simulation/elements/FIGH.cpp index 3d3a3cdc2..bdf2a4ae7 100644 --- a/src/simulation/elements/FIGH.cpp +++ b/src/simulation/elements/FIGH.cpp @@ -208,7 +208,7 @@ static void Free(Simulation *sim, unsigned char i) void Element_FIGH_NewFighter(Simulation *sim, int fighterID, int i, int elem) { 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].spwn = 1; }