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