diff --git a/src/PlayerManager.cpp b/src/PlayerManager.cpp index 9b080f5..ff6ce02 100644 --- a/src/PlayerManager.cpp +++ b/src/PlayerManager.cpp @@ -210,7 +210,7 @@ static void enterPlayer(CNSocket* sock, CNPacketData* data) { INITSTRUCT(sP_FE2CL_REP_PC_ENTER_SUCC, response); // TODO: check if serialkey exists, if it doesn't send sP_FE2CL_REP_PC_ENTER_FAIL - Player plr = CNSharedData::getPlayer(enter->iEnterSerialKey); + Player plr = CNShared::getPlayer(enter->iEnterSerialKey); plr.groupCnt = 1; plr.iIDGroup = plr.groupIDs[0] = plr.iID; diff --git a/src/core/CNShared.cpp b/src/core/CNShared.cpp index d6859a3..92469a6 100644 --- a/src/core/CNShared.cpp +++ b/src/core/CNShared.cpp @@ -5,22 +5,22 @@ #else #include #endif -std::map CNSharedData::players; +std::map CNShared::players; std::mutex playerCrit; -void CNSharedData::setPlayer(int64_t sk, Player& plr) { +void CNShared::setPlayer(int64_t sk, Player& plr) { std::lock_guard lock(playerCrit); // the lock will be removed when the function ends players[sk] = plr; } -Player CNSharedData::getPlayer(int64_t sk) { +Player CNShared::getPlayer(int64_t sk) { std::lock_guard lock(playerCrit); // the lock will be removed when the function ends return players[sk]; } -void CNSharedData::erasePlayer(int64_t sk) { +void CNShared::erasePlayer(int64_t sk) { std::lock_guard lock(playerCrit); // the lock will be removed when the function ends players.erase(sk); diff --git a/src/core/CNShared.hpp b/src/core/CNShared.hpp index 3382b4e..c0ddd4e 100644 --- a/src/core/CNShared.hpp +++ b/src/core/CNShared.hpp @@ -10,7 +10,7 @@ #include "Player.hpp" -namespace CNSharedData { +namespace CNShared { // serialkey corresponds to player data extern std::map players; diff --git a/src/servers/CNLoginServer.cpp b/src/servers/CNLoginServer.cpp index 52abd0c..b87ef2b 100644 --- a/src/servers/CNLoginServer.cpp +++ b/src/servers/CNLoginServer.cpp @@ -468,7 +468,7 @@ void CNLoginServer::characterSelect(CNSocket* sock, CNPacketData* data) { resp.g_FE_ServerIP[strlen(shard_ip)] = '\0'; resp.g_FE_ServerPort = settings::SHARDPORT; - // pass player to CNSharedData + // pass player to CNShared Player passPlayer = {}; Database::getPlayer(&passPlayer, selection->iPC_UID); // this should never happen but for extra safety @@ -477,7 +477,7 @@ void CNLoginServer::characterSelect(CNSocket* sock, CNPacketData* data) { passPlayer.FEKey = sock->getFEKey(); resp.iEnterSerialKey = passPlayer.iID; - CNSharedData::setPlayer(resp.iEnterSerialKey, passPlayer); + CNShared::setPlayer(resp.iEnterSerialKey, passPlayer); sock->sendPacket(resp, P_LS2CL_REP_SHARD_SELECT_SUCC); diff --git a/src/servers/CNShardServer.cpp b/src/servers/CNShardServer.cpp index 2a5f0a4..0d5c046 100644 --- a/src/servers/CNShardServer.cpp +++ b/src/servers/CNShardServer.cpp @@ -105,8 +105,8 @@ void CNShardServer::_killConnection(CNSocket* cns) { PlayerManager::removePlayer(cns); // removes the player from the list and saves it to DB - // remove from CNSharedData - CNSharedData::erasePlayer(key); + // remove from CNShared + CNShared::erasePlayer(key); } void CNShardServer::killConnection(CNSocket *cns) {