Merge pull request #204 from diamante0018/better-dvar-dump

[Command] Fix bug
This commit is contained in:
Dss0 2022-03-19 22:21:34 +01:00 committed by GitHub
commit 50230fc862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,14 +63,13 @@ namespace Components
void Command::Add(const char* name, Utils::Slot<Command::Callback> callback)
{
const auto command = Utils::String::ToLower(name);
const auto got = Command::FunctionMap.find(command);
if (got == Command::FunctionMap.end())
if (Command::FunctionMap.find(command) == Command::FunctionMap.end())
{
Command::AddRaw(name, Command::MainCallback);
}
got->second = std::move(callback);
Command::FunctionMap[command] = std::move(callback);
}
void Command::AddSV(const char* name, Utils::Slot<Command::Callback> callback)
@ -87,9 +86,8 @@ namespace Components
}
const auto command = Utils::String::ToLower(name);
const auto got = Command::FunctionMapSV.find(command);
if (got == Command::FunctionMapSV.end())
if (Command::FunctionMapSV.find(command) == Command::FunctionMapSV.end())
{
Command::AddRawSV(name, Command::MainCallbackSV);
@ -97,7 +95,7 @@ namespace Components
Command::AddRaw(name, Game::Cbuf_AddServerText);
}
got->second = std::move(callback);
FunctionMapSV[command] = std::move(callback);
}
void Command::AddRaw(const char* name, void(*callback)(), bool key)