mirror of
https://git.stillkill.net/MinecraftLeak/MinecraftConsoles-141217.git
synced 2026-10-22 13:22:18 +01:00
Initial commit
This commit is contained in:
commit
2dfcaaa842
5375 files changed
+978475
No files matched your search
@@ -0,0 +1,30 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "BehaviorRegistry.h"
|
||||
|
||||
BehaviorRegistry::BehaviorRegistry(DispenseItemBehavior *defaultValue)
|
||||
{
|
||||
defaultBehavior = defaultValue;
|
||||
}
|
||||
|
||||
BehaviorRegistry::~BehaviorRegistry()
|
||||
{
|
||||
for(AUTO_VAR(it, storage.begin()); it != storage.end(); ++it)
|
||||
{
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
delete defaultBehavior;
|
||||
}
|
||||
|
||||
DispenseItemBehavior *BehaviorRegistry::get(Item *key)
|
||||
{
|
||||
AUTO_VAR(it, storage.find(key));
|
||||
|
||||
return (it == storage.end()) ? defaultBehavior : it->second;
|
||||
}
|
||||
|
||||
void BehaviorRegistry::add(Item *key, DispenseItemBehavior *value)
|
||||
{
|
||||
storage.insert(make_pair(key, value));
|
||||
}
|
||||
Reference in new issue
Block a user