Rename CNSharedData namespace to CNShared to match the filename

This commit is contained in:
dongresource 2022-07-23 02:07:26 +02:00
parent 998b12617e
commit c5dd745aa1
5 changed files with 10 additions and 10 deletions

View File

@ -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;

View File

@ -5,22 +5,22 @@
#else
#include <mutex>
#endif
std::map<int64_t, Player> CNSharedData::players;
std::map<int64_t, Player> CNShared::players;
std::mutex playerCrit;
void CNSharedData::setPlayer(int64_t sk, Player& plr) {
void CNShared::setPlayer(int64_t sk, Player& plr) {
std::lock_guard<std::mutex> 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<std::mutex> 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<std::mutex> lock(playerCrit); // the lock will be removed when the function ends
players.erase(sk);

View File

@ -10,7 +10,7 @@
#include "Player.hpp"
namespace CNSharedData {
namespace CNShared {
// serialkey corresponds to player data
extern std::map<int64_t, Player> players;

View File

@ -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);

View File

@ -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) {