diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp index 0b375ac1..1bc513b8 100644 --- a/src/scenedit/scen.actions.cpp +++ b/src/scenedit/scen.actions.cpp @@ -2866,6 +2866,7 @@ bool save_check(std::string which_dlog, bool allow_no) { return false; change_made = false; town->set_up_lights(); + store_current_terrain_state(); save_scenario(); return true; } diff --git a/src/scenedit/scen.fileio.cpp b/src/scenedit/scen.fileio.cpp index a58326b3..2513a20f 100644 --- a/src/scenedit/scen.fileio.cpp +++ b/src/scenedit/scen.fileio.cpp @@ -1080,9 +1080,7 @@ struct overrides_sheet { extern std::string scenario_temp_dir_name; extern fs::path scenDir; -extern void store_current_terrain_state(); void save_scenario(bool rename) { - store_current_terrain_state(); fs::path toFile = scenario.scen_file; if(rename || toFile.empty()) { fs::path def = scenario.scen_file; diff --git a/src/scenedit/scen.main.cpp b/src/scenedit/scen.main.cpp index 082ba895..82a2eafc 100644 --- a/src/scenedit/scen.main.cpp +++ b/src/scenedit/scen.main.cpp @@ -456,9 +456,11 @@ void handle_menu_choice(eMenu item_hit) { update_edit_menu(); break; case eMenu::FILE_SAVE: + store_current_terrain_state(); save_scenario(); break; case eMenu::FILE_SAVE_AS: + store_current_terrain_state(); save_scenario(true); break; case eMenu::FILE_NEW: diff --git a/test/scen_read.cpp b/test/scen_read.cpp index 22fe91a8..54731284 100644 --- a/test/scen_read.cpp +++ b/test/scen_read.cpp @@ -184,8 +184,8 @@ TEST_CASE("Loading a new-format scenario record") { CHECK(scen.out_sec_start == loc(1,3)); CHECK(scen.out_start == loc(12,21)); CHECK(scen.default_ground == 2); - CHECK(scen.last_out_edited == loc(0,0)); - CHECK(scen.last_town_edited == 0); + CHECK(scen.editor_state.last_out_edited == loc(0,0)); + CHECK(scen.editor_state.last_town_edited == 0); CHECK(scen.init_spec == -1); } SECTION("With a different icon in the intro dialog") {