widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #03521
[Merge] lp:~widelands-dev/widelands/bug-1412242 into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1412242 into lp:widelands.
Requested reviews:
Tino (tino79)
Related bugs:
Bug #1406298 in widelands: "Load game screen lists campvis file"
https://bugs.launchpad.net/widelands/+bug/1406298
Bug #1412242 in widelands: "Multiplayer save game selection does not show the filename"
https://bugs.launchpad.net/widelands/+bug/1412242
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1412242/+merge/247404
- All load game/replay screens now list the filename that the game was saved under followed by the map’s name, or the map’s name followed by the last objective achieved.
- Also updated display for the rolling autosaves.
- Hides the campvis file for Windows (this still needs testing [1]).
- The campvis bug also mentions a packet number that needs increasing, but I can't find which one it is.
[1] http://bazaar.launchpad.net/~widelands-dev/widelands/bug-1412242/view/head:/src/ui_fsmenu/loadgame.cc#L436
--
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/bug-1412242.
=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc 2015-01-22 18:13:35 +0000
+++ src/ai/defaultai.cc 2015-01-23 11:01:34 +0000
@@ -122,10 +122,17 @@
// Subscribe to NoteImmovables.
immovable_subscriber_ =
+<<<<<<< TREE
Notifications::subscribe<NoteImmovable>([this](const NoteImmovable& note) {
if (player_ == nullptr) {
return;
}
+=======
+ Notifications::subscribe<NoteImmovable>([this](const NoteImmovable& note) {
+ if (player_ == nullptr) {
+ return;
+ }
+>>>>>>> MERGE-SOURCE
if (note.pi->owner().player_number() != player_->player_number()) {
return;
}
=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc 2014-12-14 12:16:27 +0000
+++ src/ui_fsmenu/loadgame.cc 2015-01-23 11:01:34 +0000
@@ -45,6 +45,35 @@
#include "ui_basic/icon.h"
#include "ui_basic/messagebox.h"
+namespace {
+
+std::string map_filename(const std::string& filename, const std::string& mapname) {
+ std::string result = FileSystem::filename_without_ext(filename.c_str());
+ std::string mapname_localized;
+ {
+ i18n::Textdomain td("maps");
+ mapname_localized = _(mapname);
+ }
+
+ if (boost::starts_with(result, "wl_autosave")) {
+ std::vector<std::string> autosave_name;
+ boost::split(autosave_name, result, boost::is_any_of("_"));
+ if (autosave_name.empty() || autosave_name.size() < 3) {
+ /** TRANSLATORS: %1% is a map's name. */
+ result = (boost::format(_("Autosave: %1%")) % mapname_localized).str();
+ } else {
+ /** TRANSLATORS: %1% is a number, %2% a map's name. */
+ result = (boost::format(_("Autosave %1%: %2%")) % autosave_name.back() % mapname_localized).str();
+ }
+ } else if (!(boost::starts_with(result, mapname) || boost::starts_with(result, mapname_localized))) {
+ /** TRANSLATORS: %1% is a filename, %2% a map's name. */
+ result = (boost::format(_("%1% (%2%)")) % result % mapname_localized).str();
+ }
+ return result;
+}
+
+} // namespace
+
FullscreenMenuLoadGame::FullscreenMenuLoadGame
(Widelands::Game & g, GameSettingsProvider * gsp, GameController * gc, bool is_replay) :
FullscreenMenuLoadMapOrGame(true),
@@ -136,6 +165,7 @@
(boost::bind
(&FullscreenMenuLoadGame::clicked_delete, boost::ref(*this)));
m_table.add_column(130, _("Save Date"), _("The date this game was saved"), UI::Align_Left);
+ int used_width = 130;
if (m_is_replay || m_settings->settings().multiplayer) {
std::vector<std::string> modes;
if (m_is_replay) {
@@ -164,14 +194,13 @@
_("Mode"),
(boost::format("%s %s") % mode_tooltip_1 % mode_tooltip_2).str(),
UI::Align_Left);
- m_table.add_column(m_table.get_w() - 130 - 65,
- _("Map Name"), _("The name of the map that was played"),
- UI::Align_Left);
- } else {
- m_table.add_column(m_table.get_w() - 130,
- _("Filename"), _("The filename the game was saved under"),
- UI::Align_Left);
+ used_width += 65;
}
+ m_table.add_column(m_table.get_w() - used_width,
+ _("Description"),
+ _("The filename that the game was saved under followed by the map’s name, "
+ "or the map’s name followed by the last objective achieved."),
+ UI::Align_Left);
m_table.set_column_compare
(0,
boost::bind(&FullscreenMenuLoadGame::compare_date_descending, this, _1, _2));
@@ -404,6 +433,9 @@
Widelands::GamePreloadPacket gpdp;
for (const std::string& gamefilename : gamefiles) {
+ if (gamefilename == "save/campvis" || gamefilename == "save\\campvis") {
+ continue;
+ }
gamedata = new SavegameData();
@@ -526,43 +558,34 @@
gametypestring = "";
}
te.set_string(1, gametypestring);
- te.set_string(2, gpdp.get_mapname());
-
+ te.set_string(2, map_filename(gamedata->filename, gamedata->mapname));
} else {
- const std::string fs_filename = FileSystem::filename_without_ext(gamedata->filename.c_str());
- if (fs_filename == "wl_autosave" || fs_filename == "wl_autosave2") {
- /** TRANSLATORS: Used in filenames for loading games */
- te.set_string(1, (boost::format(_("Autosave: %1%")) % gpdp.get_mapname()).str());
- } else {
- te.set_string(1, fs_filename);
- }
+ te.set_string(1, map_filename(gamedata->filename, gamedata->mapname));
}
} catch (const WException & e) {
// we simply skip illegal entries
- if (gamedata->filename != "save/campvis") {
- gamedata->errormessage =
- ((boost::format("%s\n\n%s\n\n%s"))
- /** TRANSLATORS: Error message introduction for when an old savegame can't be loaded */
- % _("This file has the wrong format and can’t be loaded."
- " Maybe it was created with an older version of Widelands.")
- /** TRANSLATORS: This text is on a separate line with an error message below */
- % _("Error message:")
- % e.what()).str();
-
- const std::string fs_filename = FileSystem::filename_without_ext(gamedata->filename.c_str());
- gamedata->mapname = fs_filename;
- m_games_data.push_back(*gamedata);
-
- UI::Table<uintptr_t const>::EntryRecord & te =
- m_table.add(m_games_data.size() - 1);
- te.set_string(0, "");
- if (m_is_replay || m_settings->settings().multiplayer) {
- te.set_string(1, "");
- /** TRANSLATORS: Prefix for incompatible files in load game screens */
- te.set_string(2, (boost::format(_("Incompatible: %s")) % fs_filename).str());
- } else {
- te.set_string(1, (boost::format(_("Incompatible: %s")) % fs_filename).str());
- }
+ gamedata->errormessage =
+ ((boost::format("%s\n\n%s\n\n%s"))
+ /** TRANSLATORS: Error message introduction for when an old savegame can't be loaded */
+ % _("This file has the wrong format and can’t be loaded."
+ " Maybe it was created with an older version of Widelands.")
+ /** TRANSLATORS: This text is on a separate line with an error message below */
+ % _("Error message:")
+ % e.what()).str();
+
+ const std::string fs_filename = FileSystem::filename_without_ext(gamedata->filename.c_str());
+ gamedata->mapname = fs_filename;
+ m_games_data.push_back(*gamedata);
+
+ UI::Table<uintptr_t const>::EntryRecord & te =
+ m_table.add(m_games_data.size() - 1);
+ te.set_string(0, "");
+ if (m_is_replay || m_settings->settings().multiplayer) {
+ te.set_string(1, "");
+ /** TRANSLATORS: Prefix for incompatible files in load game screens */
+ te.set_string(2, (boost::format(_("Incompatible: %s")) % fs_filename).str());
+ } else {
+ te.set_string(1, (boost::format(_("Incompatible: %s")) % fs_filename).str());
}
}
}
Follow ups