widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #04094
[Merge] lp:~majcherlk/widelands/bug-1426276 into lp:widelands
Lukasz has proposed merging lp:~majcherlk/widelands/bug-1426276 into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~majcherlk/widelands/bug-1426276/+merge/261275
Fixed bug #1426276 - now when the currently selected player is removed, switch to the next highest available player.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~majcherlk/widelands/bug-1426276 into lp:widelands.
=== modified file 'src/editor/ui_menus/editor_player_menu.cc'
--- src/editor/ui_menus/editor_player_menu.cc 2014-11-30 18:49:38 +0000
+++ src/editor/ui_menus/editor_player_menu.cc 2015-06-05 19:49:34 +0000
@@ -219,12 +219,13 @@
void EditorPlayerMenu::clicked_remove_last_player() {
- Widelands::Map & map = eia().egbase().map();
+ EditorInteractive& menu = eia();
+ Widelands::Map & map = menu.egbase().map();
Widelands::PlayerNumber const old_nr_players = map.get_nrplayers();
Widelands::PlayerNumber const nr_players = old_nr_players - 1;
assert(1 <= nr_players);
- if (!eia().is_player_tribe_referenced(old_nr_players)) {
+ if (!menu.is_player_tribe_referenced(old_nr_players)) {
if (const Widelands::Coords sp = map.get_starting_pos(old_nr_players)) {
// Remove starting position marker.
char picsname[] = "pics/editor_player_00_starting_pos.png";
@@ -233,6 +234,9 @@
map.overlay_manager().remove_overlay
(sp, g_gr->images().get(picsname));
}
+ // if removed player was selected switch to the next highest player
+ if (old_nr_players == menu.tools.set_starting_pos.get_current_player())
+ set_starting_pos_clicked(nr_players);
}
map.set_nrplayers(nr_players);
m_remove_last_player.set_enabled(1 < nr_players);