Merge branch 'master' into Playerbot

# Conflicts:
#	src/server/game/World/World.h
This commit is contained in:
郑佩茹
2023-02-09 12:40:25 -07:00
1253 changed files with 114535 additions and 40950 deletions

View File

@@ -13,7 +13,7 @@
#define SIZE_OF_GRIDS 533.3333f
#define MMAP_MAGIC 0x4d4d4150 // 'MMAP'
#define MMAP_VERSION 15
#define MMAP_VERSION 16
struct MmapTileHeader
{

View File

@@ -32,7 +32,6 @@ namespace
std::vector<std::string> _args;
std::unordered_map<std::string /*name*/, std::string /*value*/> _configOptions;
std::mutex _configLock;
bool _usingDistConfig = false;
// Check system configs like *server.conf*
bool IsAppConfig(std::string_view fileName)
@@ -255,8 +254,8 @@ T ConfigMgr::GetValueDefault(std::string const& name, T const& def, bool showLog
{
if (showLogs)
{
LOG_ERROR("server.loading", "> Config: Missing property {} in all config files, at least the .dist file must contain: \"{} = {}\"",
name, name, Acore::ToString(def));
LOG_ERROR("server.loading", "> Config: Missing property {} in config file {}, add \"{} = {}\" to this file.",
name, _filename, name, Acore::ToString(def));
}
return def;
@@ -285,8 +284,8 @@ std::string ConfigMgr::GetValueDefault<std::string>(std::string const& name, std
{
if (showLogs)
{
LOG_ERROR("server.loading", "> Config: Missing option {}, add \"{} = {}\"",
name, name, def);
LOG_ERROR("server.loading", "> Config: Missing property {} in config file {}, add \"{} = {}\" to this file.",
name, _filename, name, def);
}
return def;
@@ -341,7 +340,7 @@ std::vector<std::string> ConfigMgr::GetKeysByString(std::string const& name)
std::string const ConfigMgr::GetFilename()
{
std::lock_guard<std::mutex> lock(_configLock);
return _usingDistConfig ? _filename + ".dist" : _filename;
return _filename;
}
std::vector<std::string> const& ConfigMgr::GetArguments() const
@@ -377,18 +376,12 @@ void ConfigMgr::Configure(std::string const& initFileName, std::vector<std::stri
bool ConfigMgr::LoadAppConfigs(bool isReload /*= false*/)
{
// #1 - Load init config file .conf.dist
if (!LoadInitial(_filename + ".dist", isReload))
// #1 - Load init config file .conf
if (!LoadInitial(_filename, isReload))
{
return false;
}
// #2 - Load .conf file
if (!LoadAdditionalFile(_filename, true, isReload))
{
_usingDistConfig = true;
}
return true;
}
@@ -469,25 +462,25 @@ bool ConfigMgr::LoadModulesConfigs(bool isReload /*= false*/, bool isNeedPrintIn
return true;
}
// @deprecated DO NOT USE - use GetOption<std::string> instead.
/// @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.
/// @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.
/// @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.
/// @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);

View File

@@ -555,7 +555,7 @@ std::string Acore::Impl::ByteArrayToHexStr(uint8 const* bytes, size_t arrayLen,
for (int32 i = init; i != end; i += op)
{
char buffer[4];
sprintf(buffer, "%02X", bytes[i]);
snprintf(buffer, sizeof(buffer), "%02X", bytes[i]);
ss << buffer;
}