Skip to content

Commit

Permalink
Dropped CVideo parameter from loading screen and prefs display functi…
Browse files Browse the repository at this point in the history
…ons (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.
  • Loading branch information
Vultraz authored and GregoryLundberg committed Nov 30, 2017
1 parent 3ace71d commit cdfe689
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/chat_command_handler.cpp
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/editor/controller/editor_controller.cpp
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/game_config_manager.cpp
Expand Up @@ -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);
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/game_initialization/multiplayer.cpp
Expand Up @@ -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);
});

Expand Down
4 changes: 2 additions & 2 deletions src/game_launcher.cpp
Expand Up @@ -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)
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/gui/dialogs/loading_screen.cpp
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/loading_screen.hpp
Expand Up @@ -78,7 +78,7 @@ class loading_screen : public modal_dialog

~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);
Expand Down
4 changes: 2 additions & 2 deletions src/gui/dialogs/preferences_dialog.cpp
Expand Up @@ -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})
Expand Down
6 changes: 3 additions & 3 deletions src/gui/dialogs/preferences_dialog.hpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/menu_events.cpp
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/play_controller.cpp
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/wesnoth.cpp
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
});
Expand Down
2 changes: 1 addition & 1 deletion src/wesnothd_connection.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit cdfe689

Please sign in to comment.