Skip to content
Snippets Groups Projects
Commit cb8978fb authored by est31's avatar est31
Browse files

Settings: pass name to callbacks by reference

Spare some copies.
parent 4ece2b9e
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ class Clouds; ...@@ -30,7 +30,7 @@ class Clouds;
Clouds *g_menuclouds = NULL; Clouds *g_menuclouds = NULL;
irr::scene::ISceneManager *g_menucloudsmgr = NULL; irr::scene::ISceneManager *g_menucloudsmgr = NULL;
static void cloud_3d_setting_changed(const std::string settingname, void *data) static void cloud_3d_setting_changed(const std::string &settingname, void *data)
{ {
((Clouds *)data)->readSettings(); ((Clouds *)data)->readSettings();
} }
......
...@@ -35,7 +35,8 @@ with this program; if not, write to the Free Software Foundation, Inc., ...@@ -35,7 +35,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
FontEngine* g_fontengine = NULL; FontEngine* g_fontengine = NULL;
/** callback to be used on change of font size setting */ /** callback to be used on change of font size setting */
static void font_setting_changed(const std::string, void *userdata) { static void font_setting_changed(const std::string &name, void *userdata)
{
g_fontengine->readSettings(); g_fontengine->readSettings();
} }
......
...@@ -806,7 +806,7 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter ...@@ -806,7 +806,7 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
m_fogEnabled = g_settings->getBool("enable_fog"); m_fogEnabled = g_settings->getBool("enable_fog");
} }
static void SettingsCallback(const std::string name, void *userdata) static void SettingsCallback(const std::string &name, void *userdata)
{ {
reinterpret_cast<GameGlobalShaderConstantSetter*>(userdata)->onSettingsChange(name); reinterpret_cast<GameGlobalShaderConstantSetter*>(userdata)->onSettingsChange(name);
} }
......
...@@ -36,7 +36,7 @@ extern Settings *g_settings; ...@@ -36,7 +36,7 @@ extern Settings *g_settings;
extern std::string g_settings_path; extern std::string g_settings_path;
/** function type to register a changed callback */ /** function type to register a changed callback */
typedef void (*setting_changed_callback)(const std::string, void*); typedef void (*setting_changed_callback)(const std::string &name, void *data);
enum ValueType { enum ValueType {
VALUETYPE_STRING, VALUETYPE_STRING,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment