← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/string-fixes into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/string-fixes into lp:widelands.

Commit message:
Some consistency fixes:
- Consistent naming of loader_ui variables.
- More consistent Progresswindow strings.
- Consistent use of colons with spinboxes in the Options menu.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1421942 in widelands: "Unified term for "Black" and "Wasteland""
  https://bugs.launchpad.net/widelands/+bug/1421942
  Bug #1487887 in widelands: "Translation missing in editor and in replay tooltip"
  https://bugs.launchpad.net/widelands/+bug/1487887
  Bug #1530240 in widelands: "wrong text in the tribal encyclopedia for the battle ax"
  https://bugs.launchpad.net/widelands/+bug/1530240
  Bug #1530398 in widelands: "Wrong text above marble mine"
  https://bugs.launchpad.net/widelands/+bug/1530398

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/string-fixes/+merge/285088

Some consistency fixes:
- Consistent naming of loader_ui variables.
- More consistent Progresswindow strings.
- Consistent use of colons with spinboxes in the Options menu.

-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/string-fixes into lp:widelands.
=== modified file 'src/editor/editorinteractive.cc'
--- src/editor/editorinteractive.cc	2016-02-01 07:44:47 +0000
+++ src/editor/editorinteractive.cc	2016-02-04 16:17:22 +0000
@@ -609,7 +609,7 @@
 			Widelands::Map & map = *new Widelands::Map;
 			egbase.set_map(&map);
 			if (filename.empty()) {
-				loader_ui.step("Creating empty map...");
+				loader_ui.step(_("Creating empty map..."));
 				map.create_empty_map(
 				   egbase.world(),
 				   64,
@@ -624,7 +624,7 @@
 				egbase.load_graphics(loader_ui);
 				loader_ui.step(std::string());
 			} else {
-				loader_ui.stepf("Loading map \"%s\"...", filename.c_str());
+				loader_ui.stepf(_("Loading map \"%s\"..."), filename.c_str());
 				eia.load(filename);
 			}
 		}

=== modified file 'src/editor/ui_menus/editor_main_menu_new_map.cc'
--- src/editor/ui_menus/editor_main_menu_new_map.cc	2016-01-29 08:37:22 +0000
+++ src/editor/ui_menus/editor_main_menu_new_map.cc	2016-02-04 16:17:22 +0000
@@ -109,7 +109,9 @@
 	EditorInteractive& parent = eia();
 	Widelands::EditorGameBase & egbase = parent.egbase();
 	Widelands::Map              & map    = egbase.map();
-	UI::ProgressWindow loader;
+	UI::ProgressWindow loader_ui;
+
+	loader_ui.step(_("Creating empty map..."));
 
 	egbase.cleanup_for_load();
 
@@ -122,7 +124,7 @@
 				g_options.pull_section("global").get_string("realname", pgettext("map_name", "Unknown")));
 
 	egbase.postload     ();
-	egbase.load_graphics(loader);
+	egbase.load_graphics(loader_ui);
 
 	map.recalc_whole_map(egbase.world());
 	parent.map_changed(EditorInteractive::MapWas::kReplaced);

=== modified file 'src/editor/ui_menus/editor_main_menu_random_map.cc'
--- src/editor/ui_menus/editor_main_menu_random_map.cc	2016-01-31 10:57:58 +0000
+++ src/editor/ui_menus/editor_main_menu_random_map.cc	2016-02-04 16:17:22 +0000
@@ -419,7 +419,7 @@
 		dynamic_cast<EditorInteractive&>(*get_parent());
 	Widelands::EditorGameBase & egbase = eia.egbase();
 	Widelands::Map              & map    = egbase.map();
-	UI::ProgressWindow loader;
+	UI::ProgressWindow loader_ui;
 
 	egbase.cleanup_for_load();
 
@@ -444,11 +444,11 @@
 		_("No Name"),
 		g_options.pull_section("global").get_string("realname", pgettext("map_name", "Unknown")),
 		sstrm.str().c_str());
-	loader.step(_("Generating random map..."));
+	loader_ui.step(_("Generating random map..."));
 	gen.create_random_map();
 
 	egbase.postload     ();
-	egbase.load_graphics(loader);
+	egbase.load_graphics(loader_ui);
 
 	map.recalc_whole_map(egbase.world());
 	eia.map_changed(EditorInteractive::MapWas::kReplaced);

=== modified file 'src/logic/game.cc'
--- src/logic/game.cc	2016-01-29 13:43:56 +0000
+++ src/logic/game.cc	2016-02-04 16:17:22 +0000
@@ -223,23 +223,23 @@
 	std::unique_ptr<MapLoader> maploader(map().get_correct_loader(mapname));
 	if (!maploader)
 		throw wexception("could not load \"%s\"", mapname);
-	UI::ProgressWindow loaderUI;
+	UI::ProgressWindow loader_ui;
 
-	loaderUI.step (_("Preloading map"));
+	loader_ui.step (_("Preloading map"));
 	maploader->preload_map(true);
 	std::string const background = map().get_background();
 	if (!background.empty()) {
-		loaderUI.set_background(background);
+		loader_ui.set_background(background);
 	}
-	loaderUI.step(_("Loading world"));
+	loader_ui.step(_("Loading world"));
 	world();
-	loaderUI.step(_("Loading tribes"));
+	loader_ui.step(_("Loading tribes"));
 	tribes();
 
 	// We have to create the players here.
+	loader_ui.step(_("Creating players"));
 	PlayerNumber const nr_players = map().get_nrplayers();
 	iterate_player_numbers(p, nr_players) {
-		loaderUI.stepf(_("Adding player %u"), p);
 		add_player
 			(p,
 			 0,
@@ -253,13 +253,13 @@
 		(new InteractivePlayer
 		 	(*this, g_options.pull_section("global"), 1, false));
 
-	loaderUI.step(_("Loading map"));
+	loader_ui.step(_("Loading map"));
 	maploader->load_map_complete(*this, Widelands::MapLoader::LoadType::kScenario);
 	maploader.reset();
 
 	set_game_controller(new SinglePlayerGameController(*this, true, 1));
 	try {
-		bool const result = run(&loaderUI, NewSPScenario, script_to_run, false);
+		bool const result = run(&loader_ui, NewSPScenario, script_to_run, false);
 		delete m_ctrl;
 		m_ctrl = nullptr;
 		return result;
@@ -274,13 +274,13 @@
 /**
  * Initialize the game based on the given settings.
  *
- * \note loaderUI can be nullptr, if this is run as dedicated server.
+ * \note loader_ui can be nullptr, if this is run as dedicated server.
  */
 void Game::init_newgame
-	(UI::ProgressWindow * loaderUI, const GameSettings & settings)
+	(UI::ProgressWindow* loader_ui, const GameSettings& settings)
 {
-	if (loaderUI) {
-		loaderUI->step(_("Preloading map"));
+	if (loader_ui) {
+		loader_ui->step(_("Preloading map"));
 	}
 
 	assert(!get_map());
@@ -290,22 +290,22 @@
 		(map().get_correct_loader(settings.mapfilename));
 	maploader->preload_map(settings.scenario);
 
-	if (loaderUI) {
-		loaderUI->step(_("Loading world"));
+	if (loader_ui) {
+		loader_ui->step(_("Loading world"));
 	}
 	world();
 
-	if (loaderUI) {
-		loaderUI->step(_("Loading tribes"));
+	if (loader_ui) {
+		loader_ui->step(_("Loading tribes"));
 	}
 	tribes();
 
 	std::string const background = map().get_background();
-	if (loaderUI) {
+	if (loader_ui) {
 		if (!background.empty()) {
-			loaderUI->set_background(background);
+			loader_ui->set_background(background);
 		}
-		loaderUI->step(_("Configuring players"));
+		loader_ui->step(_("Creating players"));
 	}
 	std::vector<PlayerSettings> shared;
 	std::vector<uint8_t>        shared_num;
@@ -338,8 +338,8 @@
 			->add_further_starting_position(shared_num.at(n), shared.at(n).initialization_index);
 	}
 
-	if (loaderUI)
-		loaderUI->step(_("Loading map"));
+	if (loader_ui)
+		loader_ui->step(_("Loading map"));
 	maploader->load_map_complete(*this,
 										  settings.scenario ?
 											  Widelands::MapLoader::LoadType::kScenario :
@@ -365,13 +365,13 @@
  * Only difference is, that players are already initialized.
  * run<Returncode>() takes care about this difference.
  *
- * \note loaderUI can be nullptr, if this is run as dedicated server.
+ * \note loader_ui can be nullptr, if this is run as dedicated server.
  */
 void Game::init_savegame
-	(UI::ProgressWindow * loaderUI, const GameSettings & settings)
+	(UI::ProgressWindow* loader_ui, const GameSettings& settings)
 {
-	if (loaderUI) {
-		loaderUI->step(_("Preloading map"));
+	if (loader_ui) {
+		loader_ui->step(_("Preloading map"));
 	}
 
 	assert(!get_map());
@@ -381,10 +381,10 @@
 		Widelands::GamePreloadPacket gpdp;
 		gl.preload_game(gpdp);
 		m_win_condition_displayname = gpdp.get_win_condition();
-		if (loaderUI) {
+		if (loader_ui) {
 			std::string background(gpdp.get_background());
-			loaderUI->set_background(background);
-			loaderUI->step(_("Loading..."));
+			loader_ui->set_background(background);
+			loader_ui->step(_("Loading..."));
 		}
 		gl.load_game(settings.multiplayer);
 	} catch (...) {
@@ -393,14 +393,14 @@
 }
 
 bool Game::run_load_game(std::string filename, const std::string& script_to_run) {
-	UI::ProgressWindow loaderUI;
+	UI::ProgressWindow loader_ui;
 	std::vector<std::string> tipstext;
 	tipstext.push_back("general_game");
 	tipstext.push_back("singleplayer");
-	GameTips tips (loaderUI, tipstext);
+	GameTips tips (loader_ui, tipstext);
 	int8_t player_nr;
 
-	loaderUI.step(_("Preloading map"));
+	loader_ui.step(_("Preloading map"));
 
 	// We have to create an empty map, otherwise nothing will load properly
 	set_map(new Map);
@@ -412,13 +412,13 @@
 		gl.preload_game(gpdp);
 		std::string background(gpdp.get_background());
 		m_win_condition_displayname = gpdp.get_win_condition();
-		loaderUI.set_background(background);
+		loader_ui.set_background(background);
 		player_nr = gpdp.get_player_nr();
 		set_ibase
 			(new InteractivePlayer
 			 	(*this, g_options.pull_section("global"), player_nr, false));
 
-		loaderUI.step(_("Loading..."));
+		loader_ui.step(_("Loading..."));
 		gl.load_game();
 	}
 
@@ -427,7 +427,7 @@
 
 	set_game_controller(new SinglePlayerGameController(*this, true, player_nr));
 	try {
-		bool const result = run(&loaderUI, Loaded, script_to_run, false);
+		bool const result = run(&loader_ui, Loaded, script_to_run, false);
 		delete m_ctrl;
 		m_ctrl = nullptr;
 		return result;
@@ -486,12 +486,10 @@
 	if (start_game_type != Loaded) {
 		PlayerNumber const nr_players = map().get_nrplayers();
 		if (start_game_type == NewNonScenario) {
-			std::string step_description = _("Creating player infrastructure");
+			if (loader_ui) {
+				loader_ui->step(_("Creating player infrastructure"));
+			}
 			iterate_players_existing(p, nr_players, *this, plr) {
-				if (loader_ui) {
-					step_description += ".";
-					loader_ui->step(step_description);
-				}
 				plr->create_default_infrastructure();
 			}
 		} else {

=== modified file 'src/logic/game.h'
--- src/logic/game.h	2015-11-11 09:53:54 +0000
+++ src/logic/game.h	2016-02-04 16:17:22 +0000
@@ -105,10 +105,10 @@
 	void set_write_replay(bool wr);
 	void set_write_syncstream(bool wr);
 	void save_syncstream(bool save);
-	void init_newgame (UI::ProgressWindow *, const GameSettings &);
-	void init_savegame(UI::ProgressWindow *, const GameSettings &);
+	void init_newgame (UI::ProgressWindow* loader_ui, const GameSettings&);
+	void init_savegame(UI::ProgressWindow* loader_ui, const GameSettings&);
 	enum StartGameType {NewSPScenario, NewNonScenario, Loaded, NewMPScenario};
-	bool run(UI::ProgressWindow * loader_ui, StartGameType, const std::string& script_to_run, bool replay);
+	bool run(UI::ProgressWindow* loader_ui, StartGameType, const std::string& script_to_run, bool replay);
 
 	// Returns the upcasted lua interface.
 	LuaGameInterface& lua() override;

=== modified file 'src/network/netclient.cc'
--- src/network/netclient.cc	2016-01-28 05:24:34 +0000
+++ src/network/netclient.cc	2016-02-04 16:17:22 +0000
@@ -184,16 +184,16 @@
 #endif
 
 	try {
-		UI::ProgressWindow * loaderUI = new UI::ProgressWindow("images/loadscreens/progress.png");
+		UI::ProgressWindow* loader_ui = new UI::ProgressWindow("images/loadscreens/progress.png");
 		std::vector<std::string> tipstext;
 		tipstext.push_back("general_game");
 		tipstext.push_back("multiplayer");
 		try {
 			tipstext.push_back(get_players_tribe());
 		} catch (NoTribe) {}
-		GameTips tips (*loaderUI, tipstext);
+		GameTips tips (*loader_ui, tipstext);
 
-		loaderUI->step(_("Preparing game"));
+		loader_ui->step(_("Preparing game"));
 
 		d->game = &game;
 		game.set_game_controller(this);
@@ -211,16 +211,16 @@
 		game.set_ibase(igb);
 		igb->set_chat_provider(*this);
 		if (!d->settings.savegame) //  new map
-			game.init_newgame(loaderUI, d->settings);
+			game.init_newgame(loader_ui, d->settings);
 		else // savegame
-			game.init_savegame(loaderUI, d->settings);
+			game.init_savegame(loader_ui, d->settings);
 		d->time.reset(game.get_gametime());
 		d->lasttimestamp = game.get_gametime();
 		d->lasttimestamp_realtime = SDL_GetTicks();
 
 		d->modal = game.get_ibase();
 		game.run
-			(loaderUI,
+			(loader_ui,
 			 d->settings.savegame ?
 			 Widelands::Game::Loaded
 			 : d->settings.scenario ?

=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc	2016-02-01 08:21:18 +0000
+++ src/network/nethost.cc	2016-02-04 16:17:22 +0000
@@ -805,9 +805,9 @@
 #endif
 
 	try {
-		// NOTE  loaderUI will stay uninitialized, if this is run as dedicated, so all called functions need
+		// NOTE  loader_ui will stay uninitialized, if this is run as dedicated, so all called functions need
 		// NOTE  to check whether the pointer is valid.
-		std::unique_ptr<UI::ProgressWindow> loaderUI;
+		std::unique_ptr<UI::ProgressWindow> loader_ui;
 		GameTips * tips = nullptr;
 		if (m_is_dedicated) {
 			log ("[Dedicated] Starting the game...\n");
@@ -823,16 +823,16 @@
 				set_win_condition_script(gpdp.get_win_condition());
 			}
 		} else {
-			loaderUI.reset(new UI::ProgressWindow ("images/loadscreens/progress.png"));
+			loader_ui.reset(new UI::ProgressWindow ("images/loadscreens/progress.png"));
 			std::vector<std::string> tipstext;
 			tipstext.push_back("general_game");
 			tipstext.push_back("multiplayer");
 			try {
 				tipstext.push_back(d->hp.get_players_tribe());
 			} catch (GameSettingsProvider::NoTribe) {}
-			tips = new GameTips(*loaderUI, tipstext);
+			tips = new GameTips(*loader_ui, tipstext);
 
-			loaderUI->step(_("Preparing game"));
+			loader_ui->step(_("Preparing game"));
 
 			d->game = &game;
 			game.set_game_controller(this);
@@ -862,9 +862,9 @@
 		}
 
 		if (!d->settings.savegame) // new game
-			game.init_newgame (loaderUI.get(), d->settings);
+			game.init_newgame (loader_ui.get(), d->settings);
 		else                      // savegame
-			game.init_savegame(loaderUI.get(), d->settings);
+			game.init_savegame(loader_ui.get(), d->settings);
 		d->pseudo_networktime = game.get_gametime();
 		d->time.reset(d->pseudo_networktime);
 		d->lastframe = SDL_GetTicks();
@@ -889,7 +889,7 @@
 			DedicatedLog::get()->game_start(clients, game.map().get_name().c_str());
 		}
 		game.run
-			(loaderUI.get(),
+			(loader_ui.get(),
 			 d->settings.savegame ? Widelands::Game::Loaded : d->settings.scenario ?
 			 Widelands::Game::NewMPScenario : Widelands::Game::NewNonScenario,
 			 "",

=== modified file 'src/ui_basic/progresswindow.cc'
--- src/ui_basic/progresswindow.cc	2016-01-31 21:03:15 +0000
+++ src/ui_basic/progresswindow.cc	2016-02-04 16:17:22 +0000
@@ -92,6 +92,7 @@
 }
 
 void ProgressWindow::step(const std::string & description) {
+
 	RenderTarget & rt = *g_gr->get_render_target();
 
 	const uint32_t xres = g_gr->get_xres();

=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc	2016-01-29 08:37:22 +0000
+++ src/ui_fsmenu/options.cc	2016-02-04 16:17:22 +0000
@@ -190,7 +190,7 @@
 	// Saving options
 	sb_autosave_
 		(&box_saving_, 0, 0, column_width_, 250,
-		 opt.autosave / 60, 0, 100, _("Save game automatically every"),
+		 opt.autosave / 60, 0, 100, _("Save game automatically every:"),
 		 /** TRANSLATORS: Options: Save game automatically every: */
 		 /** TRANSLATORS: This will have a number added in front of it */
 		 ngettext("minute", "minutes", opt.autosave / 60),
@@ -198,7 +198,7 @@
 
 	sb_rolling_autosave_
 		(&box_saving_, 0, 0, column_width_, 250,
-		 opt.rolling_autosave, 1, 20, _("Maximum number of autosave files"),
+		 opt.rolling_autosave, 1, 20, _("Maximum number of autosave files:"),
 		 "",
 		 g_gr->images().get("images/ui_basic/but3.png"), UI::SpinBox::Type::kBig),
 

=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc	2016-01-31 18:50:37 +0000
+++ src/wlapplication.cc	2016-02-04 16:17:22 +0000
@@ -1281,7 +1281,7 @@
 					(game, g_options.pull_section("global"), pn, false));
 			std::unique_ptr<GameController> ctrl
 				(new SinglePlayerGameController(game, true, pn));
-			UI::ProgressWindow loaderUI;
+			UI::ProgressWindow loader_ui;
 			std::vector<std::string> tipstext;
 			tipstext.push_back("general_game");
 			tipstext.push_back("singleplayer");
@@ -1289,13 +1289,13 @@
 				tipstext.push_back(sp.get_players_tribe());
 			} catch (GameSettingsProvider::NoTribe) {
 			}
-			GameTips tips (loaderUI, tipstext);
+			GameTips tips (loader_ui, tipstext);
 
-			loaderUI.step(_("Preparing game"));
+			loader_ui.step(_("Preparing game"));
 
 			game.set_game_controller(ctrl.get());
-			game.init_newgame(&loaderUI, sp.settings());
-			game.run(&loaderUI, Widelands::Game::NewNonScenario, "", false);
+			game.init_newgame(&loader_ui, sp.settings());
+			game.run(&loader_ui, Widelands::Game::NewNonScenario, "", false);
 		} catch (const std::exception & e) {
 			log("Fatal exception: %s\n", e.what());
 			emergency_save(game);
@@ -1396,12 +1396,12 @@
 	}
 
 	try {
-		UI::ProgressWindow loaderUI;
+		UI::ProgressWindow loader_ui;
 		std::vector<std::string> tipstext;
 		tipstext.push_back("general_game");
-		GameTips tips (loaderUI, tipstext);
+		GameTips tips (loader_ui, tipstext);
 
-		loaderUI.step(_("Loading..."));
+		loader_ui.step(_("Loading..."));
 
 		game.set_ibase
 			(new InteractiveSpectator(game, g_options.pull_section("global")));
@@ -1410,7 +1410,7 @@
 
 		game.save_handler().set_allow_saving(false);
 
-		game.run(&loaderUI, Widelands::Game::Loaded, "", true);
+		game.run(&loader_ui, Widelands::Game::Loaded, "", true);
 	} catch (const std::exception & e) {
 		log("Fatal Exception: %s\n", e.what());
 		emergency_save(game);


Follow ups