Added trigger reference to WaypointData, unused
WaypointData also inherits from Entity now, so I could alias Entity's API for it too. I've also made a number of comment tweaks.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#config
|
||||
INCLUDES+=. ../server_utilities ../../common/utilities
|
||||
INCLUDES+=. ../entities ../server_utilities ../../common/utilities
|
||||
LIBS+=
|
||||
CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES))
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "waypoint_data.hpp"
|
||||
|
||||
//TODO: Can I alias the entity API for this?
|
||||
static const luaL_Reg waypointLib[] = {
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
@@ -21,3 +21,10 @@
|
||||
*/
|
||||
#include "waypoint_data.hpp"
|
||||
|
||||
int WaypointData::SetTriggerReference(int i) {
|
||||
return triggerRef = i;
|
||||
}
|
||||
|
||||
int WaypointData::GetTriggerReference() {
|
||||
return triggerRef;
|
||||
}
|
||||
@@ -22,15 +22,28 @@
|
||||
#ifndef WAYPOINTDATA_HPP_
|
||||
#define WAYPOINTDATA_HPP_
|
||||
|
||||
#include "entity.hpp"
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#include "lua/lua.hpp"
|
||||
#else
|
||||
#include "lua.hpp"
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
class WaypointData {
|
||||
class WaypointData: public Entity {
|
||||
public:
|
||||
WaypointData() = default;
|
||||
~WaypointData() = default;
|
||||
|
||||
int SetTriggerReference(int i);
|
||||
int GetTriggerReference();
|
||||
|
||||
private:
|
||||
friend class WaypointManager;
|
||||
|
||||
int triggerRef = LUA_NOREF;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -26,10 +26,17 @@
|
||||
#include "singleton.hpp"
|
||||
#include "vector2.hpp"
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#include "lua/lua.hpp"
|
||||
#else
|
||||
#include "lua.hpp"
|
||||
#endif
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
//TODO: should waypoints be managed on a per-room basis?
|
||||
class WaypointManager: public Singleton<WaypointManager> {
|
||||
public:
|
||||
//common public methods
|
||||
@@ -48,6 +55,10 @@ public:
|
||||
int GetTotalCount();
|
||||
std::map<int, WaypointData>* GetContainer();
|
||||
|
||||
//hooks
|
||||
lua_State* SetLuaState(lua_State* L) { return lua = L; }
|
||||
lua_State* GetLuaState() { return lua; }
|
||||
|
||||
private:
|
||||
friend Singleton<WaypointManager>;
|
||||
|
||||
@@ -56,6 +67,8 @@ private:
|
||||
|
||||
//members
|
||||
std::map<int, WaypointData> elementMap;
|
||||
lua_State* lua = nullptr;
|
||||
int counter = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user