Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-07-23 18:23:10 +08:00
83 changed files with 320 additions and 247 deletions

View File

@@ -144,29 +144,17 @@ namespace
// read line error
if (!in.good() && !in.eof())
{
throw ConfigException(Acore::StringFormatFmt("> Config::LoadFile: Failure to read line number {} in file '{}'", lineNumber, file));
}
// remove whitespace in line
line = Acore::String::Trim(line, in.getloc());
if (line.empty())
{
continue;
}
// comments
// comments and headers
if (line[0] == '#' || line[0] == '[')
{
continue;
}
size_t found = line.find_first_of('#');
if (found != std::string::npos)
{
line = line.substr(0, found);
}
auto const equal_pos = line.find('=');
@@ -183,9 +171,7 @@ namespace
// Skip if 2+ same options in one config file
if (IsDuplicateOption(entry))
{
continue;
}
// Add to temp container
fileConfigs.emplace(entry, value);
@@ -663,30 +649,6 @@ bool ConfigMgr::LoadModulesConfigs(bool isReload /*= false*/, bool isNeedPrintIn
return true;
}
/// @deprecated DO NOT USE - use GetOption<std::string> instead.
std::string ConfigMgr::GetStringDefault(std::string const& name, const std::string& def, bool showLogs /*= true*/)
{
return GetOption<std::string>(name, def, showLogs);
}
/// @deprecated DO NOT USE - use GetOption<bool> instead.
bool ConfigMgr::GetBoolDefault(std::string const& name, bool def, bool showLogs /*= true*/)
{
return GetOption<bool>(name, def, showLogs);
}
/// @deprecated DO NOT USE - use GetOption<int32> instead.
int ConfigMgr::GetIntDefault(std::string const& name, int def, bool showLogs /*= true*/)
{
return GetOption<int32>(name, def, showLogs);
}
/// @deprecated DO NOT USE - use GetOption<float> instead.
float ConfigMgr::GetFloatDefault(std::string const& name, float def, bool showLogs /*= true*/)
{
return GetOption<float>(name, def, showLogs);
}
#define TEMPLATE_CONFIG_OPTION(__typename) \
template __typename ConfigMgr::GetOption<__typename>(std::string const& name, __typename const& def, bool showLogs /*= true*/) const;

View File

@@ -50,26 +50,6 @@ public:
template<class T>
T GetOption(std::string const& name, T const& def, bool showLogs = true) const;
/*
* Deprecated geters. This geters will be deleted
*/
[[deprecated("Use GetOption<std::string> instead")]]
std::string GetStringDefault(std::string const& name, const std::string& def, bool showLogs = true);
[[deprecated("Use GetOption<bool> instead")]]
bool GetBoolDefault(std::string const& name, bool def, bool showLogs = true);
[[deprecated("Use GetOption<int32> instead")]]
int GetIntDefault(std::string const& name, int def, bool showLogs = true);
[[deprecated("Use GetOption<float> instead")]]
float GetFloatDefault(std::string const& name, float def, bool showLogs = true);
/*
* End deprecated geters
*/
bool isDryRun() { return dryRun; }
void setDryRun(bool mode) { dryRun = mode; }