GunChleoc has proposed merging
lp:~widelands-dev/widelands/bug-1573968-new-map-crash into lp:widelands.
Commit message:
Select info tool before creating new maps. This fixes a crash with the player
tool.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1573968 in widelands: "Editor crash: Assertion `1 <= p && p <=
get_nrplayers()' failed."
https://bugs.launchpad.net/widelands/+bug/1573968
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1573968-new-map-crash/+merge/292712
--
Your team Widelands Developers is requested to review the proposed merge of
lp:~widelands-dev/widelands/bug-1573968-new-map-crash into lp:widelands.
=== modified file 'src/editor/tools/set_starting_pos_tool.cc'
--- src/editor/tools/set_starting_pos_tool.cc 2016-04-06 09:23:04 +0000
+++ src/editor/tools/set_starting_pos_tool.cc 2016-04-23 14:44:53 +0000
@@ -60,12 +60,16 @@
// Area around already placed players
Widelands::PlayerNumber const nr_players = map.get_nrplayers();
for (Widelands::PlayerNumber p = 1, last = current_player_ - 1;; ++p) {
- for (; p <= last; ++p)
- if (Widelands::Coords const sp = map.get_starting_pos(p))
- if (map.calc_distance(sp, c) < MIN_PLACE_AROUND_PLAYERS)
+ for (; p <= last; ++p) {
+ if (Widelands::Coords const sp = map.get_starting_pos(p)) {
+ if (map.calc_distance(sp, c) < MIN_PLACE_AROUND_PLAYERS) {
return 0;
- if (last == nr_players)
+ }
+ }
+ }
+ if (last == nr_players) {
break;
+ }
last = nr_players;
}
=== modified file 'src/editor/ui_menus/main_menu_new_map.cc'
--- src/editor/ui_menus/main_menu_new_map.cc 2016-04-06 09:23:04 +0000
+++ src/editor/ui_menus/main_menu_new_map.cc 2016-04-23 14:44:53 +0000
@@ -123,6 +123,9 @@
egbase.cleanup_for_load();
+ // Select a tool that doesn't care about map changes
+ parent.select_tool(parent.tools()->info, EditorTool::First);
+
map.create_empty_map(
egbase.world(),
width_.get_value() > 0 ? width_.get_value() : Widelands::kMapDimensions[0],
=== modified file 'src/editor/ui_menus/main_menu_random_map.cc'
--- src/editor/ui_menus/main_menu_random_map.cc 2016-04-06 09:23:04 +0000
+++ src/editor/ui_menus/main_menu_random_map.cc 2016-04-23 14:44:53 +0000
@@ -434,6 +434,9 @@
egbase.cleanup_for_load();
+ // Select a tool that doesn't care about map changes
+ eia.select_tool(eia.tools()->info, EditorTool::First);
+
UniqueRandomMapInfo map_info;
set_map_info(map_info);
=== modified file 'src/logic/map.cc'
--- src/logic/map.cc 2016-04-11 06:45:29 +0000
+++ src/logic/map.cc 2016-04-23 14:44:53 +0000
@@ -303,6 +303,7 @@
const std::string& author,
const std::string& description)
{
+ cleanup();
set_size(w, h);
set_name (name);
set_author (author);
_______________________________________________
Mailing list: https://launchpad.net/~widelands-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~widelands-dev
More help : https://help.launchpad.net/ListHelp