Dropped CVideo parameter from loading screen and prefs display functions (missed in f2b31ba
)
I had left the former alone in the above commit since I thought it might be worth keeping for the faked() call, but that's not really a great reason. As for the latter, I didn't realize the CVideo argument wasn't really even needed. I didn't even need to replace it with a get_singleton() call since the resolution list is updated by set_resolution_list before it's used.
This commit is contained in:
parent
464cf07a8b
commit
b46a64b8ad
13 changed files with 20 additions and 20 deletions
|
@ -150,8 +150,8 @@ void chat_command_handler::do_remove()
|
|||
|
||||
void chat_command_handler::do_display()
|
||||
{
|
||||
// TODO: add video and game config argument to chat_command_handler?
|
||||
gui2::dialogs::preferences_dialog::display(CVideo::get_singleton(), game_config_manager::get()->game_config(),
|
||||
// TODO: add game config argument to chat_command_handler?
|
||||
gui2::dialogs::preferences_dialog::display(game_config_manager::get()->game_config(),
|
||||
preferences::VIEW_FRIENDS);
|
||||
}
|
||||
|
||||
|
|
|
@ -1099,7 +1099,7 @@ void editor_controller::show_menu(const std::vector<config>& items_arg, int xloc
|
|||
void editor_controller::preferences()
|
||||
{
|
||||
gui_->video().clear_all_help_strings();
|
||||
gui2::dialogs::preferences_dialog::display(gui_->video(), game_config_);
|
||||
gui2::dialogs::preferences_dialog::display(game_config_);
|
||||
|
||||
gui_->redraw_everything();
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ void game_config_manager::load_game_config_with_loadscreen(FORCE_RELOAD_CONFIG f
|
|||
}
|
||||
}
|
||||
|
||||
gui2::dialogs::loading_screen::display(video_, [this, force_reload, classification]() {
|
||||
gui2::dialogs::loading_screen::display([this, force_reload, classification]() {
|
||||
load_game_config(force_reload, classification);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -585,7 +585,7 @@ void start_client(CVideo& video, const config& game_config, saved_game& state, c
|
|||
wesnothd_connection_ptr connection;
|
||||
config lobby_config;
|
||||
|
||||
gui2::dialogs::loading_screen::display(video, [&]() {
|
||||
gui2::dialogs::loading_screen::display([&]() {
|
||||
std::tie(connection, lobby_config) = open_connection(video, host);
|
||||
});
|
||||
|
||||
|
|
|
@ -933,7 +933,7 @@ bool game_launcher::change_language()
|
|||
|
||||
void game_launcher::show_preferences()
|
||||
{
|
||||
gui2::dialogs::preferences_dialog::display(video(), game_config_manager::get()->game_config());
|
||||
gui2::dialogs::preferences_dialog::display(game_config_manager::get()->game_config());
|
||||
}
|
||||
|
||||
void game_launcher::launch_game(RELOAD_GAME_DATA reload)
|
||||
|
@ -945,7 +945,7 @@ void game_launcher::launch_game(RELOAD_GAME_DATA reload)
|
|||
return;
|
||||
}
|
||||
|
||||
gui2::dialogs::loading_screen::display(video(), [this, reload]() {
|
||||
gui2::dialogs::loading_screen::display([this, reload]() {
|
||||
|
||||
gui2::dialogs::loading_screen::progress(loading_stage::load_data);
|
||||
if(reload == RELOAD_DATA) {
|
||||
|
|
|
@ -213,11 +213,11 @@ loading_screen::~loading_screen()
|
|||
current_load = nullptr;
|
||||
}
|
||||
|
||||
void loading_screen::display(CVideo& video, std::function<void()> f)
|
||||
void loading_screen::display(std::function<void()> f)
|
||||
{
|
||||
const bool use_loadingscreen_animation = !preferences::disable_loadingscreen_animation();
|
||||
|
||||
if(current_load || video.faked()) {
|
||||
if(current_load || CVideo::get_singleton().faked()) {
|
||||
f();
|
||||
} else if(use_loadingscreen_animation) {
|
||||
loading_screen(f).show();
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
|
||||
~loading_screen();
|
||||
|
||||
static void display(CVideo& video, std::function<void()> f);
|
||||
static void display(std::function<void()> f);
|
||||
static bool displaying() { return current_load != nullptr; }
|
||||
|
||||
static void progress(loading_stage stage = loading_stage::none);
|
||||
|
|
|
@ -75,8 +75,8 @@ using namespace preferences;
|
|||
|
||||
REGISTER_DIALOG(preferences_dialog)
|
||||
|
||||
preferences_dialog::preferences_dialog(CVideo& video, const config& game_cfg, const PREFERENCE_VIEW& initial_view)
|
||||
: resolutions_(video.get_available_resolutions(true))
|
||||
preferences_dialog::preferences_dialog(const config& game_cfg, const PREFERENCE_VIEW& initial_view)
|
||||
: resolutions_() // should be populated by set_resolution_list before use
|
||||
, adv_preferences_cfg_()
|
||||
, last_selected_item_(0)
|
||||
, accl_speeds_({0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 3, 4, 8, 16})
|
||||
|
|
|
@ -69,12 +69,12 @@ namespace dialogs
|
|||
class preferences_dialog : public modal_dialog
|
||||
{
|
||||
public:
|
||||
preferences_dialog(CVideo& video, const config& game_cfg, const preferences::PREFERENCE_VIEW& initial_view);
|
||||
preferences_dialog(const config& game_cfg, const preferences::PREFERENCE_VIEW& initial_view);
|
||||
|
||||
/** The display function -- see @ref modal_dialog for more information. */
|
||||
static void display(CVideo& video, const config& game_cfg, const preferences::PREFERENCE_VIEW initial_view = preferences::VIEW_DEFAULT)
|
||||
static void display(const config& game_cfg, const preferences::PREFERENCE_VIEW initial_view = preferences::VIEW_DEFAULT)
|
||||
{
|
||||
preferences_dialog(video, game_cfg, initial_view).show();
|
||||
preferences_dialog(game_cfg, initial_view).show();
|
||||
}
|
||||
|
||||
typedef std::vector<const hotkey::hotkey_command*> t_visible_hotkeys;
|
||||
|
|
|
@ -200,7 +200,7 @@ void menu_handler::save_map()
|
|||
|
||||
void menu_handler::preferences()
|
||||
{
|
||||
gui2::dialogs::preferences_dialog::display(gui_->video(), game_config_);
|
||||
gui2::dialogs::preferences_dialog::display(game_config_);
|
||||
// Needed after changing fullscreen/windowed mode or display resolution
|
||||
gui_->redraw_everything();
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ struct throw_end_level
|
|||
void play_controller::init(CVideo& video, const config& level)
|
||||
{
|
||||
|
||||
gui2::dialogs::loading_screen::display(video, [this, &video, &level]() {
|
||||
gui2::dialogs::loading_screen::display([this, &video, &level]() {
|
||||
gui2::dialogs::loading_screen::progress(loading_stage::load_level);
|
||||
|
||||
LOG_NG << "initializing game_state..." << (SDL_GetTicks() - ticks()) << std::endl;
|
||||
|
|
|
@ -650,7 +650,7 @@ static int do_gameloop(const std::vector<std::string>& args)
|
|||
game_config_manager config_manager(cmdline_opts, game->video(),
|
||||
game->jump_to_editor());
|
||||
|
||||
gui2::dialogs::loading_screen::display(game->video(), [&res, &config_manager]() {
|
||||
gui2::dialogs::loading_screen::display([&res, &config_manager]() {
|
||||
gui2::dialogs::loading_screen::progress(loading_stage::load_config);
|
||||
res = config_manager.init_game_config(game_config_manager::NO_FORCE_RELOAD);
|
||||
|
||||
|
@ -824,7 +824,7 @@ static int do_gameloop(const std::vector<std::string>& args)
|
|||
}
|
||||
break;
|
||||
case gui2::dialogs::title_screen::RELOAD_GAME_DATA:
|
||||
gui2::dialogs::loading_screen::display(game->video(), [&config_manager]() {
|
||||
gui2::dialogs::loading_screen::display([&config_manager]() {
|
||||
config_manager.reload_changed_game_config();
|
||||
image::flush_cache();
|
||||
});
|
||||
|
|
|
@ -394,7 +394,7 @@ bool wesnothd_connection::fetch_data_with_loading_screen(config& cfg, loading_st
|
|||
assert(stage != loading_stage::none);
|
||||
|
||||
bool res = false;
|
||||
gui2::dialogs::loading_screen::display(CVideo::get_singleton(), [&]() {
|
||||
gui2::dialogs::loading_screen::display([&]() {
|
||||
gui2::dialogs::loading_screen::progress(stage);
|
||||
|
||||
res = wait_and_receive_data(cfg);
|
||||
|
|
Loading…
Add table
Reference in a new issue