Something went wrong. Try again.
the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
Something went wrong. Try again.
587 B · 30 lines
C++
at master
123456789101112131415161718192021222324252627282930#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));}