extract editor state vars in cScenario to a new struct
This commit is contained in:
@@ -2882,6 +2882,6 @@ bool monst_on_space(location loc,short m_num) {
|
||||
}
|
||||
|
||||
void restore_editor_state() {
|
||||
set_current_town(scenario.last_town_edited);
|
||||
set_current_out(scenario.last_out_edited);
|
||||
set_current_town(scenario.editor_state.last_town_edited);
|
||||
set_current_out(scenario.editor_state.last_out_edited);
|
||||
}
|
@@ -448,10 +448,8 @@ void handle_menu_choice(eMenu item_hit) {
|
||||
break;
|
||||
file_to_load = item_hit == eMenu::FILE_OPEN ? nav_get_scenario() : scenario.scen_file;
|
||||
if(!file_to_load.empty() && load_scenario(file_to_load, scenario)) {
|
||||
cur_town = scenario.last_town_edited;
|
||||
town = scenario.towns[cur_town];
|
||||
restore_editor_state();
|
||||
change_made = false;
|
||||
set_current_out(scenario.last_out_edited);
|
||||
} else if(!file_to_load.empty())
|
||||
set_up_start_screen(); // Failed to load file, dump to start
|
||||
undo_list.clear();
|
||||
|
@@ -1529,12 +1529,12 @@ void set_current_town(int to) {
|
||||
if(to < 0 || to >= scenario.towns.size()) return;
|
||||
cur_town = to;
|
||||
town = scenario.towns[cur_town];
|
||||
scenario.last_town_edited = cur_town;
|
||||
scenario.editor_state.last_town_edited = cur_town;
|
||||
}
|
||||
|
||||
void set_current_out(location out_sec) {
|
||||
cur_out = out_sec;
|
||||
scenario.last_out_edited = cur_out;
|
||||
scenario.editor_state.last_out_edited = cur_out;
|
||||
current_terrain = scenario.outdoors[cur_out.x][cur_out.y];
|
||||
set_up_main_screen();
|
||||
}
|
||||
|
Reference in New Issue
Block a user