Don't store inactive timers in the saved game
Thanks to @fosnola for spotting this.
This commit is contained in:
@@ -22,6 +22,12 @@
|
|||||||
#include "damage.hpp"
|
#include "damage.hpp"
|
||||||
#include "fields.hpp"
|
#include "fields.hpp"
|
||||||
|
|
||||||
|
bool cTimer::is_valid() const {
|
||||||
|
if(time < 0) return false;
|
||||||
|
if(node < 0) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
cSpecial::cSpecial(){
|
cSpecial::cSpecial(){
|
||||||
type = eSpecType::NONE;
|
type = eSpecType::NONE;
|
||||||
sd1 = -1;
|
sd1 = -1;
|
||||||
|
@@ -98,6 +98,7 @@ public:
|
|||||||
long time = 0;
|
long time = 0;
|
||||||
eSpecCtxType node_type = eSpecCtxType::SCEN;
|
eSpecCtxType node_type = eSpecCtxType::SCEN;
|
||||||
short node = -1;
|
short node = -1;
|
||||||
|
bool is_valid() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// HAIL means called when initiating conversation.
|
// HAIL means called when initiating conversation.
|
||||||
|
@@ -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!
|
// 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++) {
|
for(unsigned int i = 0; i < party_event_timers.size(); i++) {
|
||||||
|
if(!party_event_timers[i].is_valid()) continue;
|
||||||
auto& timer_page = file.add();
|
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;
|
timer_page["TIMER"] << party_event_timers[i].time << int(party_event_timers[i].node_type) << party_event_timers[i].node;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user