Fix saving monster thrash number

This commit is contained in:
2025-05-14 10:21:20 -05:00
parent 3dfa2b8ad4
commit 9b2773bec1
2 changed files with 14 additions and 6 deletions

View File

@@ -1858,8 +1858,12 @@ void readTownFromXml(ticpp::Document&& data, cTown*& town, cScenario& scen) {
for(flag = flag.begin(elem.Get()); flag != flag.end(); flag++) {
flag->GetValue(&type);
if(type == "chop") {
if(flag->HasAttribute("day")){
flag->GetAttribute("day", &town->town_chop_time);
}
if(flag->HasAttribute("event")){
flag->GetAttribute("event", &town->town_chop_key);
}
flag->GetAttribute("kills", &town->max_num_monst);
} else if(type == "hidden") {
flag->GetText(&val);

View File

@@ -824,13 +824,17 @@ void writeTownToXml(ticpp::Printer&& data, cTown& town) {
data.CloseElement("timer");
}
data.OpenElement("flags");
if(town.town_chop_time > 0) {
data.OpenElement("chop");
if(town.town_chop_time > 0) {
data.PushAttribute("day", town.town_chop_time);
}
if(town.town_chop_key > 0) {
data.PushAttribute("event", town.town_chop_key);
}
data.PushAttribute("kills", town.max_num_monst);
data.CloseElement("chop");
}
if(town.strong_barriers)
data.PushElement("strong-barriers", true);
if(town.defy_mapping)