Replaced door system with waypoint system
This commit is contained in:
+3
-3
@@ -26,10 +26,10 @@
|
||||
#include "character_manager.hpp"
|
||||
#include "client_manager.hpp"
|
||||
#include "config_utility.hpp"
|
||||
#include "door_manager.hpp"
|
||||
#include "monster_manager.hpp"
|
||||
#include "room_manager.hpp"
|
||||
#include "udp_network_utility.hpp"
|
||||
#include "waypoint_manager.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
@@ -43,10 +43,10 @@ int main(int argc, char* argv[]) {
|
||||
CharacterManager::CreateSingleton();
|
||||
ClientManager::CreateSingleton();
|
||||
ConfigUtility::CreateSingleton();
|
||||
DoorManager::CreateSingleton();
|
||||
MonsterManager::CreateSingleton();
|
||||
RoomManager::CreateSingleton();
|
||||
UDPNetworkUtility::CreateSingleton();
|
||||
WaypointManager::CreateSingleton();
|
||||
|
||||
//call the server's routines
|
||||
ServerApplication::CreateSingleton();
|
||||
@@ -63,10 +63,10 @@ int main(int argc, char* argv[]) {
|
||||
CharacterManager::DeleteSingleton();
|
||||
ClientManager::DeleteSingleton();
|
||||
ConfigUtility::DeleteSingleton();
|
||||
DoorManager::DeleteSingleton();
|
||||
MonsterManager::DeleteSingleton();
|
||||
RoomManager::DeleteSingleton();
|
||||
UDPNetworkUtility::DeleteSingleton();
|
||||
WaypointManager::DeleteSingleton();
|
||||
}
|
||||
catch(exception& e) {
|
||||
cerr << "Fatal exception thrown: " << e.what() << endl;
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
#include directories
|
||||
INCLUDES+=. accounts characters clients doors entities monsters rooms server_utilities ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet_types ../common/utilities
|
||||
INCLUDES+=. accounts characters clients entities monsters rooms server_utilities waypoints ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet_types ../common/utilities
|
||||
|
||||
#libraries
|
||||
#the order of the $(LIBS) is important, at least for MinGW
|
||||
@@ -28,11 +28,11 @@ all: $(OBJ) $(OUT)
|
||||
$(MAKE) -C accounts
|
||||
$(MAKE) -C characters
|
||||
$(MAKE) -C clients
|
||||
$(MAKE) -C doors
|
||||
$(MAKE) -C entities
|
||||
$(MAKE) -C monsters
|
||||
$(MAKE) -C rooms
|
||||
$(MAKE) -C server_utilities
|
||||
$(MAKE) -C waypoints
|
||||
$(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIBS)
|
||||
|
||||
$(OBJ): | $(OBJDIR)
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#include "account_manager.hpp"
|
||||
#include "character_manager.hpp"
|
||||
#include "client_manager.hpp"
|
||||
#include "door_manager.hpp"
|
||||
#include "monster_manager.hpp"
|
||||
#include "room_manager.hpp"
|
||||
#include "waypoint_manager.hpp"
|
||||
|
||||
//utilities
|
||||
#include "config_utility.hpp"
|
||||
@@ -123,9 +123,9 @@ private:
|
||||
AccountManager& accountMgr = AccountManager::GetSingleton();
|
||||
CharacterManager& characterMgr = CharacterManager::GetSingleton();
|
||||
ClientManager& clientMgr = ClientManager::GetSingleton();
|
||||
DoorManager& doorMgr = DoorManager::GetSingleton();
|
||||
MonsterManager& monsterMgr = MonsterManager::GetSingleton();
|
||||
RoomManager& roomMgr = RoomManager::GetSingleton();
|
||||
WaypointManager& waypointMgr = WaypointManager::GetSingleton();
|
||||
|
||||
ConfigUtility& config = ConfigUtility::GetSingleton();
|
||||
UDPNetworkUtility& network = UDPNetworkUtility::GetSingleton();
|
||||
|
||||
@@ -201,9 +201,9 @@ void ServerApplication::Quit() {
|
||||
accountMgr.UnloadAll();
|
||||
characterMgr.UnloadAll();
|
||||
clientMgr.UnloadAll();
|
||||
doorMgr.UnloadAll();
|
||||
monsterMgr.UnloadAll();
|
||||
roomMgr.UnloadAll();
|
||||
waypointMgr.UnloadAll();
|
||||
|
||||
//APIs
|
||||
lua_close(luaState);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#config
|
||||
INCLUDES+=. ../entities ../server_utilities ../../common/utilities
|
||||
INCLUDES+=. ../server_utilities ../../common/utilities
|
||||
LIBS+=
|
||||
CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES))
|
||||
|
||||
@@ -19,31 +19,5 @@
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
#ifndef DOORDATA_HPP_
|
||||
#define DOORDATA_HPP_
|
||||
#include "waypoint_data.hpp"
|
||||
|
||||
#include "entity.hpp"
|
||||
#include "vector2.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
class DoorData: public Entity {
|
||||
public:
|
||||
DoorData() = default;
|
||||
~DoorData() = default;
|
||||
|
||||
//accessors & mutators
|
||||
std::string SetRoomName(std::string);
|
||||
Vector2 SetDestPosition(Vector2);
|
||||
|
||||
std::string GetRoomName();
|
||||
Vector2 GetDestPosition();
|
||||
|
||||
private:
|
||||
friend class DoorManager;
|
||||
|
||||
std::string roomName;
|
||||
Vector2 destPosition;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -19,20 +19,18 @@
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
#include "door_data.hpp"
|
||||
#ifndef WAYPOINTDATA_HPP_
|
||||
#define WAYPOINTDATA_HPP_
|
||||
|
||||
std::string DoorData::SetRoomName(std::string s) {
|
||||
return roomName = s;
|
||||
}
|
||||
#include <string>
|
||||
|
||||
Vector2 DoorData::SetDestPosition(Vector2 v) {
|
||||
return destPosition = v;
|
||||
}
|
||||
class WaypointData {
|
||||
public:
|
||||
WaypointData() = default;
|
||||
~WaypointData() = default;
|
||||
|
||||
std::string DoorData::GetRoomName() {
|
||||
return roomName;
|
||||
}
|
||||
private:
|
||||
friend class WaypointManager;
|
||||
};
|
||||
|
||||
Vector2 DoorData::GetDestPosition() {
|
||||
return destPosition;
|
||||
}
|
||||
#endif
|
||||
@@ -19,48 +19,48 @@
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
#include "door_manager.hpp"
|
||||
#include "waypoint_manager.hpp"
|
||||
|
||||
int DoorManager::Create(std::string, Vector2) {
|
||||
int WaypointManager::Create() {
|
||||
//TODO
|
||||
}
|
||||
|
||||
int DoorManager::Load(std::string, Vector2) {
|
||||
int WaypointManager::Load() {
|
||||
//TODO
|
||||
}
|
||||
|
||||
int DoorManager::Save(int uid) {
|
||||
int WaypointManager::Save(int uid) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
void DoorManager::Unload(int uid) {
|
||||
void WaypointManager::Unload(int uid) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
void DoorManager::Delete(int uid) {
|
||||
void WaypointManager::Delete(int uid) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
void DoorManager::UnloadAll() {
|
||||
void WaypointManager::UnloadAll() {
|
||||
//TODO
|
||||
}
|
||||
|
||||
void DoorManager::UnloadIf(std::function<bool(std::pair<const int, DoorData>)> fn) {
|
||||
void WaypointManager::UnloadIf(std::function<bool(std::pair<const int, WaypointData>)> fn) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
DoorData* DoorManager::Get(int uid) {
|
||||
WaypointData* WaypointManager::Get(int uid) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
int DoorManager::GetLoadedCount() {
|
||||
int WaypointManager::GetLoadedCount() {
|
||||
//TODO
|
||||
}
|
||||
|
||||
int DoorManager::GetTotalCount() {
|
||||
int WaypointManager::GetTotalCount() {
|
||||
//TODO
|
||||
}
|
||||
|
||||
std::map<int, DoorData>* DoorManager::GetContainer() {
|
||||
std::map<int, WaypointData>* WaypointManager::GetContainer() {
|
||||
//TODO
|
||||
}
|
||||
@@ -19,10 +19,10 @@
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
#ifndef DOORMANAGER_HPP_
|
||||
#define DOORMANAGER_HPP_
|
||||
#ifndef WAYPOINTMANAGER_HPP_
|
||||
#define WAYPOINTMANAGER_HPP_
|
||||
|
||||
#include "door_data.hpp"
|
||||
#include "waypoint_data.hpp"
|
||||
#include "manager_interface.hpp"
|
||||
#include "singleton.hpp"
|
||||
#include "vector2.hpp"
|
||||
@@ -30,32 +30,32 @@
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
class DoorManager:
|
||||
public Singleton<DoorManager>,
|
||||
public ManagerInterface<DoorData, std::string, Vector2>
|
||||
class WaypointManager:
|
||||
public Singleton<WaypointManager>,
|
||||
public ManagerInterface<WaypointData>
|
||||
{
|
||||
public:
|
||||
//common public methods
|
||||
int Create(std::string, Vector2) override;
|
||||
int Load(std::string, Vector2) override;
|
||||
int Create() override;
|
||||
int Load() override;
|
||||
int Save(int uid) override;
|
||||
void Unload(int uid) override;
|
||||
void Delete(int uid) override;
|
||||
|
||||
void UnloadAll() override;
|
||||
void UnloadIf(std::function<bool(std::pair<const int, DoorData>)> fn) override;
|
||||
void UnloadIf(std::function<bool(std::pair<const int, WaypointData>)> fn) override;
|
||||
|
||||
//accessors & mutators
|
||||
DoorData* Get(int uid) override;
|
||||
WaypointData* Get(int uid) override;
|
||||
int GetLoadedCount() override;
|
||||
int GetTotalCount() override;
|
||||
std::map<int, DoorData>* GetContainer() override;
|
||||
std::map<int, WaypointData>* GetContainer() override;
|
||||
|
||||
private:
|
||||
friend Singleton<DoorManager>;
|
||||
friend Singleton<WaypointManager>;
|
||||
|
||||
DoorManager() = default;
|
||||
~DoorManager() = default;
|
||||
WaypointManager() = default;
|
||||
~WaypointManager() = default;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user