← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1526903 into lp:widelands

 

TiborB has proposed merging lp:~widelands-dev/widelands/bug-1526903 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1526514 in widelands: "player 2 in "" section [player_2] not found"
  https://bugs.launchpad.net/widelands/+bug/1526514
  Bug #1526903 in widelands: "Editor crashes when changing tribe"
  https://bugs.launchpad.net/widelands/+bug/1526903

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1526903/+merge/281410

This is very simple change - prohibiting save of allowed_building_types in editor (=creating particular file). Should not cause problems, but must be tested
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1526903 into lp:widelands.
=== modified file 'src/map_io/map_saver.cc'
--- src/map_io/map_saver.cc	2015-11-11 09:53:54 +0000
+++ src/map_io/map_saver.cc	2015-12-29 22:26:03 +0000
@@ -139,18 +139,22 @@
 	{MapAllowedWorkerTypesPacket p; p.write(m_fs, m_egbase, *m_mos);}
 	log("took %ums\n ", timer.ms_since_last_query());
 
- //  allowed building types
-	iterate_players_existing_const(plnum, nr_players, m_egbase, player) {
-		for (DescriptionIndex i = 0; i < m_egbase.tribes().nrbuildings(); ++i) {
-			if (!player->is_building_type_allowed(i)) {
-				log("Writing Allowed Building Types Data ... ");
-				MapAllowedBuildingTypesPacket p;
-				p                                  .write(m_fs, m_egbase, *m_mos);
-				log("took %ums\n ", timer.ms_since_last_query());
-				goto end_find_a_forbidden_building_type_loop;
+    //  allowed building types
+    // Not saving this when in editor - it causes issues when changing tribe
+    // after next load in editor
+	if (is_a(Game, &m_egbase)) {
+		iterate_players_existing_const(plnum, nr_players, m_egbase, player) {
+			for (DescriptionIndex i = 0; i < m_egbase.tribes().nrbuildings(); ++i) {
+				if (!player->is_building_type_allowed(i)) {
+					log("Writing Allowed Building Types Data ... ");
+					MapAllowedBuildingTypesPacket p;
+					p                                  .write(m_fs, m_egbase, *m_mos);
+					log("took %ums\n ", timer.ms_since_last_query());
+					goto end_find_a_forbidden_building_type_loop;
+				}
 			}
-		}
-	} end_find_a_forbidden_building_type_loop:;
+		} end_find_a_forbidden_building_type_loop:;
+	}
 
 	// !!!!!!!!!! NOTE
 	// This packet must be before any building or road packet. So do not


Follow ups