Skip to content

Commit

Permalink
Register changed callbacks for the settings in readSettings()
Browse files Browse the repository at this point in the history
Those are also deregistered when the Game object is destroyed.
  • Loading branch information
srifqi committed May 31, 2023
1 parent 2887b23 commit 0cd5bd8
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/client/game.cpp
Expand Up @@ -1037,7 +1037,7 @@ Game::Game() :
&settingChangedCallback, this);
g_settings->registerChangedCallback("enable_clouds",
&settingChangedCallback, this);
g_settings->registerChangedCallback("doubletap_joysticks",
g_settings->registerChangedCallback("enable_joysticks",
&settingChangedCallback, this);
g_settings->registerChangedCallback("enable_particles",
&settingChangedCallback, this);
Expand All @@ -1053,12 +1053,22 @@ Game::Game() :
&settingChangedCallback, this);
g_settings->registerChangedCallback("free_move",
&settingChangedCallback, this);
g_settings->registerChangedCallback("fog_start",
&settingChangedCallback, this);
g_settings->registerChangedCallback("cinematic",
&settingChangedCallback, this);
g_settings->registerChangedCallback("cinematic_camera_smoothing",
&settingChangedCallback, this);
g_settings->registerChangedCallback("camera_smoothing",
&settingChangedCallback, this);
g_settings->registerChangedCallback("invert_mouse",
&settingChangedCallback, this);
g_settings->registerChangedCallback("enable_hotbar_mouse_wheel",
&settingChangedCallback, this);
g_settings->registerChangedCallback("invert_hotbar_mouse_wheel",
&settingChangedCallback, this);
g_settings->registerChangedCallback("pause_on_lost_focus",
&settingChangedCallback, this);

readSettings();

Expand Down Expand Up @@ -1098,24 +1108,38 @@ Game::~Game()
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("enable_clouds",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("enable_joysticks",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("enable_particles",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("enable_fog",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("mouse_sensitivity",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("joystick_frustum_sensitivity",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("repeat_place_time",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("noclip",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("free_move",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("fog_start",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("cinematic",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("cinematic_camera_smoothing",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("camera_smoothing",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("invert_mouse",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("enable_hotbar_mouse_wheel",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("invert_hotbar_mouse_wheel",
&settingChangedCallback, this);
g_settings->deregisterChangedCallback("pause_on_lost_focus",
&settingChangedCallback, this);
if (m_rendering_engine)
m_rendering_engine->finalize();
}
Expand Down

0 comments on commit 0cd5bd8

Please sign in to comment.