Made a few tweaks to various managers

This commit is contained in:
Kayne Ruse
2014-11-05 23:43:36 +11:00
parent 8eefdd71b5
commit fc2bc06992
9 changed files with 79 additions and 48 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
#config
INCLUDES+=. ../server_utilities ../../common/map ../../common/utilities
INCLUDES+=. ../entities ../server_utilities ../../common/map ../../common/utilities
LIBS+=
CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES))
+23
View File
@@ -0,0 +1,23 @@
/* Copyright: (c) Kayne Ruse 2014
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include "room_data.hpp"
+10 -3
View File
@@ -22,9 +22,12 @@
#ifndef ROOMDATA_HPP_
#define ROOMDATA_HPP_
//map system
#include "entity.hpp"
#include "region_pager_lua.hpp"
#include "lua.hpp"
#include <list>
#include <string>
class RoomData {
@@ -48,8 +51,12 @@ private:
RegionPagerLua pager;
std::string roomName;
std::string tilesetName;
//TODO: pass the room name & tileset name to the clients
//TODO: lua references i.e. create, unload, etc.
std::list<Entity*> entityList;
//lua references
int createRef = LUA_NOREF;
int loadRef = LUA_NOREF;
int unloadRef = LUA_NOREF;
};
#endif
+2 -2
View File
@@ -29,7 +29,7 @@
//public access methods
//-------------------------
int RoomManager::Create() {
int RoomManager::Create(std::string roomName, std::string tilesetName) {
//create the room
RoomData* newRoom = &elementMap[counter]; //implicitly constructs the element
newRoom->pager.SetLuaState(lua);
@@ -38,7 +38,7 @@ int RoomManager::Create() {
return counter++;
}
int RoomManager::Load() {
int RoomManager::Load(std::string roomName, std::string tilesetName) {
//TODO: RoomManager::Load()
return -1;
}
+3 -3
View File
@@ -34,12 +34,12 @@
class RoomManager:
public Singleton<RoomManager>,
public ManagerInterface<RoomData>
public ManagerInterface<RoomData, std::string, std::string>
{
public:
//common public methods
int Create() override;
int Load() override;
int Create(std::string, std::string) override;
int Load(std::string, std::string) override;
int Save(int uid) override;
void Unload(int uid) override;
void Delete(int uid) override;