Project builds, and runs with no obvious differences
This commit is contained in:
@@ -33,8 +33,8 @@
|
||||
|
||||
class CharacterData {
|
||||
public:
|
||||
CharacterData();
|
||||
~CharacterData();
|
||||
CharacterData() = default;
|
||||
~CharacterData() = default;
|
||||
|
||||
//location and movement
|
||||
int SetRoomIndex(int i) { return roomIndex = i; }
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@
|
||||
#include "region_pager_api.hpp"
|
||||
#include "tile_sheet_api.hpp"
|
||||
#include "room_api.hpp"
|
||||
#include "room_mgr_api.hpp"
|
||||
#include "room_manager_api.hpp"
|
||||
|
||||
//these libs are loaded by lua.c and are readily available to any Lua program
|
||||
static const luaL_Reg loadedlibs[] = {
|
||||
@@ -61,7 +61,7 @@ static const luaL_Reg loadedlibs[] = {
|
||||
{TORTUGA_REGION_PAGER_NAME, openRegionPagerAPI},
|
||||
{TORTUGA_TILE_SHEET_NAME, openTileSheetAPI},
|
||||
{TORTUGA_ROOM_NAME, openRoomAPI},
|
||||
{TORTUGA_ROOM_MGR_NAME, openRoomMgrAPI},
|
||||
{TORTUGA_ROOM_MANAGER_NAME, openRoomManagerAPI},
|
||||
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
+1
-3
@@ -1,5 +1,5 @@
|
||||
#config
|
||||
INCLUDES+=. accounts characters combat enemies mapgen mapgen/generators rooms ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet ../common/network/serial ../common/utilities
|
||||
INCLUDES+=. accounts characters rooms ../common/debugging ../common/gameplay ../common/map ../common/network ../common/network/packet ../common/network/serial ../common/utilities
|
||||
LIBS+=server.a ../libcommon.a -lSDL_net -lwsock32 -liphlpapi -lmingw32 -lSDLmain -lSDL -llua -lsqlite3
|
||||
CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES))
|
||||
|
||||
@@ -18,8 +18,6 @@ OUT=$(addprefix $(OUTDIR)/,server)
|
||||
all: $(OBJ) $(OUT)
|
||||
$(MAKE) -C accounts
|
||||
$(MAKE) -C characters
|
||||
$(MAKE) -C combat
|
||||
$(MAKE) -C enemies
|
||||
$(MAKE) -C rooms
|
||||
$(CXX) $(CXXFLAGS) -o $(OUT) $(OBJ) $(LIBS)
|
||||
|
||||
|
||||
@@ -291,17 +291,16 @@ void ServerApplication::HandleDisconnect(ClientPacket* const argPacket) {
|
||||
if neither of the above is true, then output a warning to the console, and return
|
||||
*/
|
||||
|
||||
|
||||
//forward to the specified client
|
||||
network.SendTo(
|
||||
&clientMap[ accountMgr.GetAccount(argPacket->accountIndex)->clientIndex ].address,
|
||||
&clientMap[ accountMgr.GetAccount(argPacket->accountIndex)->GetClientIndex() ].address,
|
||||
static_cast<SerialPacket*>(argPacket)
|
||||
);
|
||||
|
||||
//save and unload this account's characters
|
||||
//pump the unload message to all remaining clients
|
||||
characterMgr.UnloadCharacterIf([&](std::map<int, CharacterData>::iterator it) -> bool {
|
||||
if (argPacket->accountIndex == it->second.owner) {
|
||||
if (argPacket->accountIndex == it->second.GetOwner()) {
|
||||
PumpCharacterUnload(it->first);
|
||||
return true;
|
||||
}
|
||||
@@ -309,7 +308,7 @@ void ServerApplication::HandleDisconnect(ClientPacket* const argPacket) {
|
||||
});
|
||||
|
||||
//erase the in-memory stuff
|
||||
clientMap.erase(accountMgr.GetAccount(argPacket->accountIndex)->clientIndex);
|
||||
clientMap.erase(accountMgr.GetAccount(argPacket->accountIndex)->GetClientIndex());
|
||||
accountMgr.UnloadAccount(argPacket->accountIndex);
|
||||
|
||||
//finished this routine
|
||||
@@ -349,7 +348,7 @@ void ServerApplication::HandleRegionRequest(RegionPacket* const argPacket) {
|
||||
newPacket.x = argPacket->x;
|
||||
newPacket.y = argPacket->y;
|
||||
|
||||
newPacket.region = roomMgr.GetRoom(argPacket->roomIndex)->pager.GetRegion(argPacket->x, argPacket->y);
|
||||
newPacket.region = roomMgr.GetRoom(argPacket->roomIndex)->GetPager()->GetRegion(argPacket->x, argPacket->y);
|
||||
|
||||
//send the content
|
||||
network.SendTo(&argPacket->srcAddress, static_cast<SerialPacket*>(&newPacket));
|
||||
@@ -422,11 +421,11 @@ void ServerApplication::HandleCharacterUpdate(CharacterPacket* const argPacket)
|
||||
}
|
||||
|
||||
//accept client-side logic
|
||||
character->roomIndex = argPacket->roomIndex;
|
||||
character->origin = argPacket->origin;
|
||||
character->motion = argPacket->motion;
|
||||
character->SetRoomIndex(argPacket->roomIndex);
|
||||
character->SetOrigin(argPacket->origin);
|
||||
character->SetMotion(argPacket->motion);
|
||||
|
||||
character->stats = argPacket->stats;
|
||||
*character->GetBaseStats() = argPacket->stats;
|
||||
|
||||
//TODO: gameplay components: equipment, items, buffs, debuffs
|
||||
|
||||
@@ -485,11 +484,11 @@ void ServerApplication::CopyCharacterToPacket(CharacterPacket* const packet, int
|
||||
|
||||
//TODO: keep this up to date when the character changes
|
||||
packet->characterIndex = characterIndex;
|
||||
strncpy(packet->handle, character->handle.c_str(), PACKET_STRING_SIZE);
|
||||
strncpy(packet->avatar, character->avatar.c_str(), PACKET_STRING_SIZE);
|
||||
packet->accountIndex = character->owner;
|
||||
packet->roomIndex = character->roomIndex;
|
||||
packet->origin = character->origin;
|
||||
packet->motion = character->motion;
|
||||
packet->stats = character->stats;
|
||||
strncpy(packet->handle, character->GetHandle().c_str(), PACKET_STRING_SIZE);
|
||||
strncpy(packet->avatar, character->GetAvatar().c_str(), PACKET_STRING_SIZE);
|
||||
packet->accountIndex = character->GetOwner();
|
||||
packet->roomIndex = character->GetRoomIndex();
|
||||
packet->origin = character->GetOrigin();
|
||||
packet->motion = character->GetMotion();
|
||||
packet->stats = *character->GetBaseStats();
|
||||
}
|
||||
Reference in New Issue
Block a user