Skip to content

Commit

Permalink
Use a fallback for when the player name is not known in debug notific…
Browse files Browse the repository at this point in the history
…ations

We just found out that it is possible for the player name to not be set
when loading a singleplayer start-of-scenario save for the first time
right after launching Wesnoth. It's best to have an actual $player value
for that case instead of spurting 100% syntactically invalid statements
like "The :lua command was used during 's turn" because of the empty
variable.

(cherry picked from commit 8b41d4d)
  • Loading branch information
irydacea committed Oct 28, 2018
1 parent 80069fa commit 789c5cd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/synced_commands.cpp
Expand Up @@ -406,6 +406,10 @@ namespace
std::string message;
utils::string_map i18n_vars = {{ "player", current_team.current_player() }};

if(i18n_vars["player"].empty()) {
i18n_vars["player"] = _("(unknown player)");
}

if(message_is_command) {
i18n_vars["command"] = text;
message = VGETTEXT("The :$command debug command was used during $player’s turn", i18n_vars);
Expand Down

0 comments on commit 789c5cd

Please sign in to comment.