Make the default title screen a getter function.
This fixes a crash at startup when the preferences attempted to retrieve a translated string before logging was enabled.
This commit is contained in:
parent
86417c2edd
commit
1f41eca6e1
4 changed files with 15 additions and 8 deletions
|
@ -164,9 +164,9 @@ context_manager::~context_manager()
|
|||
|
||||
// Restore default window title
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
SDL_WM_SetCaption(game_config::default_title_string.c_str(), NULL);
|
||||
SDL_WM_SetCaption(game_config::get_default_title_string().c_str(), NULL);
|
||||
#else
|
||||
CVideo::set_window_title(game_config::default_title_string);
|
||||
CVideo::set_window_title(game_config::get_default_title_string());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ void context_manager::set_window_title()
|
|||
map_name = get_map_context().is_pure_map() ? _("New Map") : _("New Scenario");
|
||||
}
|
||||
|
||||
const std::string& wm_title_string = map_name + " - " + game_config::default_title_string;
|
||||
const std::string& wm_title_string = map_name + " - " + game_config::get_default_title_string();
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
SDL_WM_SetCaption(wm_title_string.c_str(), NULL);
|
||||
#else
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace game_config
|
|||
#else
|
||||
const std::string revision = VERSION;
|
||||
#endif
|
||||
const std::string default_title_string = _("The Battle for Wesnoth") + " - " + revision;
|
||||
|
||||
|
||||
std::string wesnoth_program_dir;
|
||||
bool debug = false, debug_lua = false, editor = false,
|
||||
|
@ -422,4 +422,9 @@ namespace game_config
|
|||
return color_scale[lvl];
|
||||
}
|
||||
|
||||
std::string get_default_title_string() {
|
||||
std::string ret = _("The Battle for Wesnoth") + " - " + revision;
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // game_config
|
||||
|
|
|
@ -177,6 +177,8 @@ namespace game_config
|
|||
extern const version_info wesnoth_version;
|
||||
extern const version_info min_savegame_version;
|
||||
extern const version_info test_version;
|
||||
|
||||
std::string get_default_title_string();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -393,7 +393,7 @@ bool game_launcher::init_video()
|
|||
video_.init_window();
|
||||
|
||||
// Set window title and icon
|
||||
CVideo::set_window_title(game_config::default_title_string);
|
||||
CVideo::set_window_title(game_config::get_default_title_string());
|
||||
|
||||
#if !(defined(__APPLE__))
|
||||
surface icon(image::get_image("icons/icon-game.png", image::UNSCALED));
|
||||
|
@ -416,7 +416,7 @@ bool game_launcher::init_video()
|
|||
return true;
|
||||
}
|
||||
|
||||
SDL_WM_SetCaption(game_config::default_title_string.c_str(), NULL);
|
||||
SDL_WM_SetCaption(game_config::get_default_title_string().c_str(), NULL);
|
||||
|
||||
#if !(defined(__APPLE__))
|
||||
surface icon(image::get_image("icons/icon-game.png", image::UNSCALED));
|
||||
|
@ -1064,9 +1064,9 @@ bool game_launcher::change_language()
|
|||
|
||||
if (!(cmdline_opts_.nogui || cmdline_opts_.headless_unit_test)) {
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
CVideo::set_window_title(game_config::default_title_string);
|
||||
CVideo::set_window_title(game_config::get_default_title_string());
|
||||
#else
|
||||
SDL_WM_SetCaption(game_config::default_title_string.c_str(), NULL);
|
||||
SDL_WM_SetCaption(game_config::get_default_title_string().c_str(), NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue