diff options
author | est31 <MTest31@outlook.com> | 2015-07-09 08:23:08 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-07-09 08:25:17 +0200 |
commit | cb8978fb1d6576ec82526adcc8deea2b745c5dca (patch) | |
tree | d3d9a9e3b7aad12f3ba991f16a9175cf8085b17e | |
parent | 4ece2b9e32b5948628a20dece54ecfb369a17757 (diff) | |
download | minetest-cb8978fb1d6576ec82526adcc8deea2b745c5dca.tar.gz minetest-cb8978fb1d6576ec82526adcc8deea2b745c5dca.tar.bz2 minetest-cb8978fb1d6576ec82526adcc8deea2b745c5dca.zip |
Settings: pass name to callbacks by reference
Spare some copies.
-rw-r--r-- | src/clouds.cpp | 2 | ||||
-rw-r--r-- | src/fontengine.cpp | 3 | ||||
-rw-r--r-- | src/game.cpp | 2 | ||||
-rw-r--r-- | src/settings.h | 2 |
4 files changed, 5 insertions, 4 deletions
diff --git a/src/clouds.cpp b/src/clouds.cpp index e213d118f..29210e2b4 100644 --- a/src/clouds.cpp +++ b/src/clouds.cpp @@ -30,7 +30,7 @@ class Clouds; Clouds *g_menuclouds = 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(); } diff --git a/src/fontengine.cpp b/src/fontengine.cpp index 14b65f593..f881701e0 100644 --- a/src/fontengine.cpp +++ b/src/fontengine.cpp @@ -35,7 +35,8 @@ with this program; if not, write to the Free Software Foundation, Inc., FontEngine* g_fontengine = NULL; /** 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(); } diff --git a/src/game.cpp b/src/game.cpp index ef3cb9044..41bfa5e60 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -806,7 +806,7 @@ public: 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); } diff --git a/src/settings.h b/src/settings.h index d43ad6a20..d41f134cd 100644 --- a/src/settings.h +++ b/src/settings.h @@ -36,7 +36,7 @@ extern Settings *g_settings; extern std::string g_settings_path; /** 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 { VALUETYPE_STRING, |