From f8794a039592aae851164bd41ac00b022e1dbce6 Mon Sep 17 00:00:00 2001 From: Sean Yeh <109418+seanyeh@users.noreply.github.com> Date: Wed, 28 Oct 2020 22:12:32 -0500 Subject: [PATCH] Fix crash from side not being reset in editor --- src/editor/map/context_manager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/editor/map/context_manager.cpp b/src/editor/map/context_manager.cpp index 04efdbbd5656..b9114b0e9208 100644 --- a/src/editor/map/context_manager.cpp +++ b/src/editor/map/context_manager.cpp @@ -102,6 +102,11 @@ void context_manager::refresh_on_context_change() resources::tod_manager = get_map_context().get_time_manager(); resources::classification = &get_map_context().get_classification(); + // Reset side when switching to an existing scenario + if (gui().get_teams().size() > 0) { + gui().set_team(0, true); + gui().set_playing_team(0); + } gui().init_flags(); reload_map(); @@ -970,6 +975,8 @@ void context_manager::new_scenario(int width, int height, const t_translation::t // Give the new scenario an initial side. get_map_context().new_side(); + gui().set_team(0, true); + gui().set_playing_team(0); gui_.init_flags(); }