← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug1201398 into lp:widelands

 

cghislai has proposed merging lp:~widelands-dev/widelands/bug1201398 into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1203337 in widelands: "Map name appears untranslated in save dialog, even when translation exists"
  https://bugs.launchpad.net/widelands/+bug/1203337
  Bug #1203338 in widelands: "According to save dialog, campaign maps have 58 players"
  https://bugs.launchpad.net/widelands/+bug/1203338
  Bug #1203439 in widelands: "Crash on saving with no human player"
  https://bugs.launchpad.net/widelands/+bug/1203439

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug1201398/+merge/176043

Small fixes, see bug reports.

Thanks for testing!
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug1201398/+merge/176043
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug1201398 into lp:widelands.
=== modified file 'src/game_io/game_preload_data_packet.cc'
--- src/game_io/game_preload_data_packet.cc	2013-07-21 08:39:02 +0000
+++ src/game_io/game_preload_data_packet.cc	2013-07-21 09:09:31 +0000
@@ -61,6 +61,7 @@
 			} else if (packet_version < 4) {
 				// win condition were (sometimes?) stored as filename
 				m_win_condition = s.get_safe_string("win_condition");
+<<<<<<< TREE
 				try {
 					std::unique_ptr<LuaTable> table
 						(game.lua().run_script
@@ -70,6 +71,21 @@
 					m_win_condition = table->get_string("name");
 				} catch (...) {
 					// Catch silently, the win_condition value will be used
+=======
+				if (m_win_condition == "not_set") {
+					m_win_condition = _("Scenario");
+				} else {
+					try {
+						boost::shared_ptr<LuaTable> table
+							(game.lua().run_script
+								(*g_fs,
+								"scripting/win_conditions/" + m_win_condition
+								+ ".lua", "win_conditions"));
+						m_win_condition = table->get_string("name");
+					} catch (...) {
+						// Catch silently, the win_condition value will be used
+					}
+>>>>>>> MERGE-SOURCE
 				}
 			} else {
 				// win condition stored as localized string

=== modified file 'src/logic/game.cc'
--- src/logic/game.cc	2013-07-21 08:39:02 +0000
+++ src/logic/game.cc	2013-07-21 09:09:31 +0000
@@ -237,6 +237,7 @@
 
 	// We have to create the players here.
 	Player_Number const nr_players = map().get_nrplayers();
+	m_number_of_players = 0;
 	iterate_player_numbers(p, nr_players) {
 		loaderUI.stepf (_("Adding player %u"), p);
 		add_player
@@ -245,7 +246,9 @@
 			 map().get_scenario_player_tribe(p),
 			 map().get_scenario_player_name (p));
 		get_player(p)->setAI(map().get_scenario_player_ai(p));
+		m_number_of_players++;
 	}
+	m_win_condition_displayname = _("Scenario");
 
 	set_ibase
 		(new Interactive_Player
@@ -368,8 +371,6 @@
 	set_map(new Map);
 	try {
 		Game_Loader gl(settings.mapfilename, *this);
-
-
 		Widelands::Game_Preload_Data_Packet gpdp;
 		gl.preload_game(gpdp);
 		m_win_condition_displayname = gpdp.get_win_condition();

=== modified file 'src/wui/game_main_menu_save_game.cc'
--- src/wui/game_main_menu_save_game.cc	2013-07-19 18:04:44 +0000
+++ src/wui/game_main_menu_save_game.cc	2013-07-21 09:09:31 +0000
@@ -139,8 +139,9 @@
 	}
 
 	m_editbox->focus();
-	if (!parent.game().get_ipl()->is_multiplayer()) {
-		// Pause the game
+	if (parent.game().get_ipl() && !parent.game().get_ipl()->is_multiplayer()) {
+		// Pause the game only if we are part of the game
+		// and not in multiplayer
 		parent.game().gameController()->setPaused(true);
 	}
 }
@@ -161,7 +162,11 @@
 	}
 	m_button_ok->set_enabled(true);
 
-	m_mapname.set_text(gpdp.get_mapname());
+	//Try to translate the map name.
+	{
+		i18n::Textdomain td("maps");
+		m_mapname.set_text(_(gpdp.get_mapname()));
+	}
 
 	uint32_t gametime = gpdp.get_gametime();
 	m_gametime.set_text(gametimestring(gametime));
@@ -311,7 +316,7 @@
 void Game_Main_Menu_Save_Game::die()
 {
 	UI::UniqueWindow::die();
-	if (!igbase().game().get_ipl()->is_multiplayer()) {
+	if (igbase().game().get_ipl() && !igbase().game().get_ipl()->is_multiplayer()) {
 		igbase().game().gameController()->setPaused(false);
 	}
 }


Follow ups