WaypointManager is no longer a Singleton, wrote waypoint API outline

I'm planning on giving each room it's own waypoint manager, so it can
compare it's waypoints against the characters in that room alone. If it
turns out to be a good pattern, I'll do thae same for monsters.
This commit is contained in:
Kayne Ruse
2015-01-09 13:21:09 +11:00
parent be67906218
commit b391dde089
8 changed files with 146 additions and 38 deletions
+9 -13
View File
@@ -22,9 +22,9 @@
#ifndef WAYPOINTMANAGER_HPP_
#define WAYPOINTMANAGER_HPP_
#include "waypoint_data.hpp"
#include "singleton.hpp"
#include "bounding_box.hpp"
#include "vector2.hpp"
#include "waypoint_data.hpp"
#include "lua.hpp"
@@ -32,11 +32,13 @@
#include <map>
#include <string>
//TODO: should waypoints be managed on a per-room basis?
class WaypointManager: public Singleton<WaypointManager> {
class WaypointManager {
public:
WaypointManager() = default;
~WaypointManager() = default;
//common public methods
int Create();
int Create(Vector2 origin, BoundingBox bounds);
void Unload(int uid);
void UnloadAll();
@@ -45,19 +47,13 @@ public:
//accessors & mutators
WaypointData* Get(int uid);
int GetLoadedCount();
int GetTotalCount();
std::map<int, WaypointData>* GetContainer();
//hooks
lua_State* SetLuaState(lua_State* L) { return lua = L; }
lua_State* GetLuaState() { return lua; }
lua_State* SetLuaState(lua_State* L);
lua_State* GetLuaState();
private:
friend Singleton<WaypointManager>;
WaypointManager() = default;
~WaypointManager() = default;
//members
std::map<int, WaypointData> elementMap;
lua_State* lua = nullptr;