Use a fallback for when the player name is not known in debug notifications

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.
This commit is contained in:
Iris Morelle 2018-03-26 20:28:17 -03:00
parent 81cfb11af0
commit 8b41d4d8fc

View file

@ -399,6 +399,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 $players turn", i18n_vars);