[ServerCommands] Use slot wrapper

This commit is contained in:
momo5502 2017-06-04 14:21:02 +02:00
parent c8f80ceee0
commit cea36c5630
2 changed files with 4 additions and 4 deletions

View File

@ -2,9 +2,9 @@
namespace Components namespace Components
{ {
std::unordered_map<std::int32_t, std::function<bool(Command::Params*)>> ServerCommands::Commands; std::unordered_map<std::int32_t, Utils::Slot<bool(Command::Params*)>> ServerCommands::Commands;
void ServerCommands::OnCommand(std::int32_t cmd, std::function<bool(Command::Params*)> cb) void ServerCommands::OnCommand(std::int32_t cmd, Utils::Slot<bool(Command::Params*)> cb)
{ {
ServerCommands::Commands[cmd] = cb; ServerCommands::Commands[cmd] = cb;
} }

View File

@ -8,10 +8,10 @@ namespace Components
ServerCommands(); ServerCommands();
~ServerCommands(); ~ServerCommands();
static void OnCommand(std::int32_t cmd, std::function<bool(Command::Params*)> cb); static void OnCommand(std::int32_t cmd, Utils::Slot<bool(Command::Params*)> cb);
private: private:
static std::unordered_map<std::int32_t, std::function<bool(Command::Params*)>> Commands; static std::unordered_map<std::int32_t, Utils::Slot<bool(Command::Params*)>> Commands;
static bool OnServerCommand(); static bool OnServerCommand();
static void OnServerCommandStub(); static void OnServerCommandStub();