diff --git a/src/scenario/special.cpp b/src/scenario/special.cpp index 33832d4e..09c5e871 100644 --- a/src/scenario/special.cpp +++ b/src/scenario/special.cpp @@ -22,6 +22,12 @@ #include "damage.hpp" #include "fields.hpp" +bool cTimer::is_valid() const { + if(time < 0) return false; + if(node < 0) return false; + return true; +} + cSpecial::cSpecial(){ type = eSpecType::NONE; sd1 = -1; diff --git a/src/scenario/special.hpp b/src/scenario/special.hpp index d3d383d6..59deffb9 100644 --- a/src/scenario/special.hpp +++ b/src/scenario/special.hpp @@ -98,6 +98,7 @@ public: long time = 0; eSpecCtxType node_type = eSpecCtxType::SCEN; short node = -1; + bool is_valid() const; }; // HAIL means called when initiating conversation. diff --git a/src/universe/party.cpp b/src/universe/party.cpp index fb14d267..358287e5 100644 --- a/src/universe/party.cpp +++ b/src/universe/party.cpp @@ -790,6 +790,7 @@ void cParty::writeTo(cTagFile& file) const { } // TODO: Why is each timer on its own page, anyway? It clearly doesn't need to be! for(unsigned int i = 0; i < party_event_timers.size(); i++) { + if(!party_event_timers[i].is_valid()) continue; auto& timer_page = file.add(); timer_page["TIMER"] << party_event_timers[i].time << int(party_event_timers[i].node_type) << party_event_timers[i].node; }