Combine timer data into a single structure
This commit is contained in:
@@ -3066,8 +3066,8 @@ static bool save_scenario_events(cDialog& me, std::string, eKeyMod) {
|
||||
|
||||
for(i = 0; i < 10; i++) {
|
||||
std::string id = std::to_string(i + 1);
|
||||
scenario.scenario_timer_times[i] = me["time" + id].getTextAsNum();
|
||||
scenario.scenario_timer_specs[i] = me["node" + id].getTextAsNum();
|
||||
scenario.scenario_timers[i].time = me["time" + id].getTextAsNum();
|
||||
scenario.scenario_timers[i].node = me["node" + id].getTextAsNum();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -3103,8 +3103,8 @@ void edit_scenario_events() {
|
||||
evt_dlg["time" + id].attachFocusHandler(check_scenario_timer_time);
|
||||
evt_dlg["node" + id].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 255, "The scenario special node", "-1 for no special"));
|
||||
evt_dlg["edit" + id].attachClickHandler(edit_scenario_events_event_filter);
|
||||
evt_dlg["time" + id].setTextToNum(scenario.scenario_timer_times[i]);
|
||||
evt_dlg["node" + id].setTextToNum(scenario.scenario_timer_specs[i]);
|
||||
evt_dlg["time" + id].setTextToNum(scenario.scenario_timers[i].time);
|
||||
evt_dlg["node" + id].setTextToNum(scenario.scenario_timers[i].node);
|
||||
}
|
||||
|
||||
evt_dlg.run();
|
||||
|
@@ -285,10 +285,10 @@ static void writeScenarioToXml(ticpp::Printer&& data) {
|
||||
data.CloseElement("shop");
|
||||
}
|
||||
for(int i = 0; i < 20; i++) {
|
||||
if(scenario.scenario_timer_times[i] > 0) {
|
||||
if(scenario.scenario_timers[i].time > 0) {
|
||||
data.OpenElement("timer");
|
||||
data.PushAttribute("time", scenario.scenario_timer_times[i]);
|
||||
data.PushText(scenario.scenario_timer_specs[i]);
|
||||
data.PushAttribute("time", scenario.scenario_timers[i].time);
|
||||
data.PushText(scenario.scenario_timers[i].node);
|
||||
data.CloseElement("timer");
|
||||
}
|
||||
}
|
||||
@@ -648,10 +648,10 @@ static void writeTownToXml(ticpp::Printer&& data, cTown& town) {
|
||||
}
|
||||
if(town.spec_on_hostile >= 0)
|
||||
data.PushElement("onoffend", town.spec_on_hostile);
|
||||
for(size_t i = 0; i < town.timer_spec_times.size() && i < town.timer_specs.size(); i++) {
|
||||
for(size_t i = 0; i < town.timers.size(); i++) {
|
||||
data.OpenElement("timer");
|
||||
data.PushAttribute("freq", town.timer_spec_times[i]);
|
||||
data.PushText(town.timer_specs[i]);
|
||||
data.PushAttribute("freq", town.timers[i].time);
|
||||
data.PushText(town.timers[i].node);
|
||||
data.CloseElement("timer");
|
||||
}
|
||||
data.OpenElement("flags");
|
||||
|
@@ -741,8 +741,8 @@ static bool save_town_events(cDialog& me, std::string, eKeyMod) {
|
||||
if(!me.toast(true)) return true;
|
||||
for(int i = 0; i < 8; i++) {
|
||||
std::string id = std::to_string(i + 1);
|
||||
town->timer_spec_times[i] = me["time" + id].getTextAsNum();
|
||||
town->timer_specs[i] = me["spec" + id].getTextAsNum();
|
||||
town->timers[i].time = me["time" + id].getTextAsNum();
|
||||
town->timers[i].node = me["spec" + id].getTextAsNum();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -751,8 +751,8 @@ static void put_town_events_in_dlog(cDialog& me) {
|
||||
short i;
|
||||
for(i = 0; i < 8; i++) {
|
||||
std::string id = std::to_string(i + 1);
|
||||
me["time" + id].setTextToNum(town->timer_spec_times[i]);
|
||||
me["spec" + id].setTextToNum(town->timer_specs[i]);
|
||||
me["time" + id].setTextToNum(town->timers[i].time);
|
||||
me["spec" + id].setTextToNum(town->timers[i].node);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user