Removed MonsterManager's Singleton status, RoomData now has mgr members

RoomData now has monsterMgr and waypointMgr members, so that it can
compare it's characters to the monster & waypoints, etc.

RoomManager has been updated. It now has a database reference, which is
passed to the monsterMgr of new rooms. The room API also has functions
which expose these managers to lua.
This commit is contained in:
Kayne Ruse
2015-01-11 19:47:42 +11:00
parent 051ed0f14c
commit d0b2f8e12f
11 changed files with 72 additions and 26 deletions
+7 -10
View File
@@ -23,7 +23,6 @@
#define MONSTERMANAGER_HPP_
#include "monster_data.hpp"
#include "singleton.hpp"
#include "lua.hpp"
#include "sqlite3.h"
@@ -32,8 +31,11 @@
#include <map>
#include <string>
class MonsterManager: public Singleton<MonsterManager> {
class MonsterManager {
public:
MonsterManager();
~MonsterManager();
//common public methods
int Create(std::string);
void Unload(int uid);
@@ -47,21 +49,16 @@ public:
std::map<int, MonsterData>* GetContainer();
//hooks
sqlite3* SetDatabase(sqlite3* db);
sqlite3* GetDatabase();
lua_State* SetLuaState(lua_State* L);
lua_State* GetLuaState();
sqlite3* SetDatabase(sqlite3* db);
sqlite3* GetDatabase();
private:
friend Singleton<MonsterManager>;
MonsterManager() = default;
~MonsterManager() = default;
//members
std::map<int, MonsterData> elementMap;
sqlite3* database = nullptr;
lua_State* lua = nullptr;
sqlite3* database = nullptr;
};
#endif