diff --git a/Core/Config.cpp b/Core/Config.cpp index 13f1de313e..9bdac17310 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -152,7 +151,7 @@ struct ConfigSetting { default_.i = def; } - ConfigSetting(const char *ini, int *v, int def, std::function transTo, std::function transFrom, bool save = true, bool perGame = false) + ConfigSetting(const char *ini, int *v, int def, std::string (*transTo)(int), int (*transFrom)(const std::string &), bool save = true, bool perGame = false) : iniKey_(ini), type_(TYPE_INT), report_(false), save_(save), perGame_(perGame), translateTo_(transTo), translateFrom_(transFrom) { ptr_.i = v; cb_.i = nullptr; @@ -220,7 +219,7 @@ struct ConfigSetting { cb_.i = def; } - ConfigSetting(const char *ini, int *v, IntDefaultCallback def, std::function transTo, std::function transFrom, bool save = true, bool perGame = false) + ConfigSetting(const char *ini, int *v, IntDefaultCallback def, std::string(*transTo)(int), int(*transFrom)(const std::string &), bool save = true, bool perGame = false) : iniKey_(ini), type_(TYPE_INT), report_(false), save_(save), perGame_(perGame), translateTo_(transTo), translateFrom_(transFrom) { ptr_.i = v; cb_.i = def; @@ -410,8 +409,8 @@ struct ConfigSetting { DefaultCallback cb_; // We only support transform for ints. - std::function translateTo_; - std::function translateFrom_; + std::string (*translateTo_)(int) = nullptr; + int(*translateFrom_)(const std::string &) = nullptr; }; struct ReportedConfigSetting : public ConfigSetting { @@ -422,7 +421,7 @@ struct ReportedConfigSetting : public ConfigSetting { } template - ReportedConfigSetting(const char *ini, T1 *v, T2 def, std::function transTo, std::function transFrom, bool save = true, bool perGame = false) + ReportedConfigSetting(const char *ini, T1 *v, T2 def, std::string(*transTo)(int), int(*transFrom)(const std::string &), bool save = true, bool perGame = false) : ConfigSetting(ini, v, def, transTo, transFrom, save, perGame) { report_ = true; }