From 045640d460fc031d4478dd51821b224d81e4c3c6 Mon Sep 17 00:00:00 2001 From: FutureRave Date: Sat, 19 Mar 2022 16:38:07 +0000 Subject: [PATCH] Fix bug --- src/Components/Modules/Command.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Components/Modules/Command.cpp b/src/Components/Modules/Command.cpp index 071be212..173ea297 100644 --- a/src/Components/Modules/Command.cpp +++ b/src/Components/Modules/Command.cpp @@ -63,14 +63,13 @@ namespace Components void Command::Add(const char* name, Utils::Slot 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 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)