Added creatures to the room containers
This commit is contained in:
@@ -29,8 +29,14 @@ CreatureManager::~CreatureManager() {
|
||||
UnloadAll();
|
||||
}
|
||||
|
||||
void CreatureManager::Update() {
|
||||
for (auto& it : elementMap) {
|
||||
it.second.Update();
|
||||
}
|
||||
}
|
||||
|
||||
int CreatureManager::Create(std::string avatar, int scriptRef) {
|
||||
//implicitly create the new
|
||||
//implicitly create the new object
|
||||
elementMap.emplace(counter, CreatureData(avatar, scriptRef));
|
||||
|
||||
//TODO: do various things like saving to the database
|
||||
|
||||
@@ -36,6 +36,8 @@ public:
|
||||
~CreatureManager();
|
||||
|
||||
//common public methods
|
||||
void Update();
|
||||
|
||||
int Create(std::string avatar, int scriptRef);
|
||||
void Unload(int uid);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ static int create(lua_State* L) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
//TOOD: this needs to take the userdata as a parameter too
|
||||
//TOOD: overload this to take the userdata as a parameter
|
||||
static int unload(lua_State* L) {
|
||||
CreatureManager* mgr = static_cast<CreatureManager* const>(lua_touserdata(L, 1));
|
||||
mgr->Unload(lua_tointeger(L, 2));
|
||||
|
||||
Reference in New Issue
Block a user