Skip to content

Commit

Permalink
Change editor event from start to prestart.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pentarctagon committed Oct 22, 2023
1 parent f5f76ad commit 17bef65
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/editor/map/map_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ config map_context::convert_scenario(const config& old_scenario)
}

config& event = multiplayer.add_child("event");
event["name"] = "start";
event["id"] = "editor_event-start";
event["name"] = "prestart";
event["id"] = "editor_event-prestart";

// for all children that aren't [side] or [time], move them to an event
// for [side]:
Expand Down Expand Up @@ -491,6 +491,9 @@ void map_context::load_scenario()
tod_manager_.reset(new tod_manager(scenario));

auto event = scenario.find_child("event", "id", "editor_event-start");
if(!event) {
event = scenario.find_child("event", "id", "editor_event-prestart");
}
if(event) {
config& evt = event.value();

Expand Down Expand Up @@ -640,7 +643,7 @@ config map_context::to_config()
: scen.add_child("multiplayer");

scenario.remove_children("side");
scenario.remove_children("event", [](config cfg){return cfg["id"].str() == "editor_event-start";});
scenario.remove_children("event", [](config cfg){return cfg["id"].str() == "editor_event-start" || cfg["id"].str() == "editor_event-prestart";});

scenario["id"] = scenario_id_;
scenario["name"] = t_string(scenario_name_);
Expand All @@ -660,8 +663,9 @@ config map_context::to_config()

// find or add the editor's start event
config& event = scenario.add_child("event");
event["name"] = "start";
event["id"] = "editor_event-start";
event["name"] = "prestart";
event["id"] = "editor_event-prestart";
event["priority"] = 1000;

// write out all the scenario data below

Expand Down

0 comments on commit 17bef65

Please sign in to comment.