Command stuff
This commit is contained in:
parent
e0bdf9a23a
commit
d8486422ea
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Components
|
||||
{
|
||||
std::vector<Game::cmd_function_t*> Command::Functions;
|
||||
Utils::Memory::Allocator Command::MemAllocator;
|
||||
std::map<std::string, wink::slot<Command::Callback>> Command::FunctionMap;
|
||||
std::map<std::string, wink::slot<Command::Callback>> Command::FunctionMapSV;
|
||||
|
||||
@ -105,10 +105,7 @@ namespace Components
|
||||
|
||||
Game::cmd_function_t* Command::Allocate()
|
||||
{
|
||||
Game::cmd_function_t* cmd = new Game::cmd_function_t;
|
||||
Command::Functions.push_back(cmd);
|
||||
|
||||
return cmd;
|
||||
return Command::MemAllocator.Allocate<Game::cmd_function_t>();
|
||||
}
|
||||
|
||||
void Command::MainCallback()
|
||||
@ -142,12 +139,7 @@ namespace Components
|
||||
|
||||
Command::~Command()
|
||||
{
|
||||
for (auto command : Command::Functions)
|
||||
{
|
||||
delete command;
|
||||
}
|
||||
|
||||
Command::Functions.clear();
|
||||
Command::MemAllocator.Clear();
|
||||
Command::FunctionMap.clear();
|
||||
Command::FunctionMapSV.clear();
|
||||
}
|
||||
|
@ -36,10 +36,11 @@ namespace Components
|
||||
static Game::cmd_function_t* Find(std::string command);
|
||||
|
||||
private:
|
||||
static Game::cmd_function_t* Allocate();
|
||||
static std::vector<Game::cmd_function_t*> Functions;
|
||||
static Utils::Memory::Allocator MemAllocator;
|
||||
static std::map<std::string, wink::slot<Callback>> FunctionMap;
|
||||
static std::map<std::string, wink::slot<Callback>> FunctionMapSV;
|
||||
|
||||
static Game::cmd_function_t* Allocate();
|
||||
static void MainCallback();
|
||||
static void MainCallbackSV();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user