Fix saving monster thrash number
This commit is contained in:
@@ -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") {
|
||||
flag->GetAttribute("day", &town->town_chop_time);
|
||||
flag->GetAttribute("event", &town->town_chop_key);
|
||||
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);
|
||||
|
@@ -824,13 +824,17 @@ void writeTownToXml(ticpp::Printer&& data, cTown& town) {
|
||||
data.CloseElement("timer");
|
||||
}
|
||||
data.OpenElement("flags");
|
||||
|
||||
data.OpenElement("chop");
|
||||
if(town.town_chop_time > 0) {
|
||||
data.OpenElement("chop");
|
||||
data.PushAttribute("day", town.town_chop_time);
|
||||
data.PushAttribute("event", town.town_chop_key);
|
||||
data.PushAttribute("kills", town.max_num_monst);
|
||||
data.CloseElement("chop");
|
||||
}
|
||||
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)
|
||||
|
Reference in New Issue
Block a user