Fixed accelerated speed settings not being respected in-game (bug #24653)

Since the preference display manager was refactored out in d2bec9ec9d39b783f,
the display class setters for preferences such as accelerated speed weren't getting
called when opening the editor or starting a new game. This commit adds a function
calling the relevant setters.

This also cleans up a few redundant pref setter functions.
This commit is contained in:
Charles Dang 2016-06-02 01:03:16 +11:00
parent 2755920ba2
commit 0cd14d875d
6 changed files with 15 additions and 17 deletions

View File

@ -95,7 +95,7 @@ editor_controller::editor_controller(const config &game_config, CVideo& video)
void editor_controller::init_gui()
{
gui_->change_display_context(&context_manager_->get_map_context());
gui_->set_grid(preferences::grid());
preferences::set_preference_display_settings();
gui_->add_redraw_observer(std::bind(&editor_controller::display_redraw_callback, this, _1));
floating_label_manager_.reset(new font::floating_label_context());
gui().set_draw_coordinates(preferences::editor::draw_hex_coordinates());

View File

@ -350,6 +350,7 @@ void play_controller::reset_gamestate(const config& level, int replay_pos)
void play_controller::init_managers()
{
LOG_NG << "initializing managers... " << (SDL_GetTicks() - ticks()) << std::endl;
preferences::set_preference_display_settings();
tooltips_manager_.reset(new tooltips::manager(gui_->video()));
soundsources_manager_.reset(new soundsource::manager(*gui_));

View File

@ -341,7 +341,7 @@ bool scroll_to_action()
return get("scroll_to_action", true);
}
void _set_scroll_to_action(bool ison)
void set_scroll_to_action(bool ison)
{
prefs["scroll_to_action"] = ison;
}
@ -470,7 +470,7 @@ bool ellipses()
return get("show_side_colors", false);
}
void _set_ellipses(bool ison)
void set_ellipses(bool ison)
{
preferences::set("show_side_colors", ison);
}

View File

@ -62,7 +62,7 @@ namespace preferences {
void set_core_id(const std::string& root);
bool scroll_to_action();
void _set_scroll_to_action(bool ison);
void set_scroll_to_action(bool ison);
int min_allowed_width();
int min_allowed_height();
@ -247,7 +247,7 @@ namespace preferences {
void set_show_fps(bool value);
bool ellipses();
void _set_ellipses(bool ison);
void set_ellipses(bool ison);
bool grid();
void _set_grid(bool ison);

View File

@ -40,6 +40,14 @@
namespace preferences {
void set_preference_display_settings()
{
set_grid(grid());
set_turbo(turbo());
set_turbo_speed(turbo_speed());
set_color_cursors(preferences::get("color_cursors", true));
}
void show_preferences_dialog(CVideo& video, const config& game_cfg, const DIALOG_OPEN_TO initial_view)
{
gui2::tpreferences dlg(video, game_cfg);
@ -57,11 +65,6 @@ void show_preferences_dialog(CVideo& video, const config& game_cfg, const DIALOG
dlg.show(video);
}
void set_scroll_to_action(bool ison)
{
_set_scroll_to_action(ison);
}
void set_turbo(bool ison)
{
_set_turbo(ison);
@ -80,11 +83,6 @@ void set_turbo_speed(double speed)
}
}
void set_ellipses(bool ison)
{
_set_ellipses(ison);
}
void set_grid(bool ison)
{
_set_grid(ison);

View File

@ -27,10 +27,9 @@ namespace preferences {
VIEW_FRIENDS
};
void set_scroll_to_action(bool ison);
void set_preference_display_settings();
void set_turbo(bool ison);
void set_ellipses(bool ison);
void set_grid(bool ison);
void set_turbo_speed(double speed);
void set_color_cursors(bool value);