mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-22 05:20:05 +00:00
Rename CNSharedData namespace to CNShared to match the filename
This commit is contained in:
parent
998b12617e
commit
c5dd745aa1
@ -210,7 +210,7 @@ static void enterPlayer(CNSocket* sock, CNPacketData* data) {
|
|||||||
INITSTRUCT(sP_FE2CL_REP_PC_ENTER_SUCC, response);
|
INITSTRUCT(sP_FE2CL_REP_PC_ENTER_SUCC, response);
|
||||||
|
|
||||||
// TODO: check if serialkey exists, if it doesn't send sP_FE2CL_REP_PC_ENTER_FAIL
|
// 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.groupCnt = 1;
|
||||||
plr.iIDGroup = plr.groupIDs[0] = plr.iID;
|
plr.iIDGroup = plr.groupIDs[0] = plr.iID;
|
||||||
|
@ -5,22 +5,22 @@
|
|||||||
#else
|
#else
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#endif
|
#endif
|
||||||
std::map<int64_t, Player> CNSharedData::players;
|
std::map<int64_t, Player> CNShared::players;
|
||||||
std::mutex playerCrit;
|
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
|
std::lock_guard<std::mutex> lock(playerCrit); // the lock will be removed when the function ends
|
||||||
|
|
||||||
players[sk] = plr;
|
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
|
std::lock_guard<std::mutex> lock(playerCrit); // the lock will be removed when the function ends
|
||||||
|
|
||||||
return players[sk];
|
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
|
std::lock_guard<std::mutex> lock(playerCrit); // the lock will be removed when the function ends
|
||||||
|
|
||||||
players.erase(sk);
|
players.erase(sk);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "Player.hpp"
|
#include "Player.hpp"
|
||||||
|
|
||||||
namespace CNSharedData {
|
namespace CNShared {
|
||||||
// serialkey corresponds to player data
|
// serialkey corresponds to player data
|
||||||
extern std::map<int64_t, Player> players;
|
extern std::map<int64_t, Player> players;
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ void CNLoginServer::characterSelect(CNSocket* sock, CNPacketData* data) {
|
|||||||
resp.g_FE_ServerIP[strlen(shard_ip)] = '\0';
|
resp.g_FE_ServerIP[strlen(shard_ip)] = '\0';
|
||||||
resp.g_FE_ServerPort = settings::SHARDPORT;
|
resp.g_FE_ServerPort = settings::SHARDPORT;
|
||||||
|
|
||||||
// pass player to CNSharedData
|
// pass player to CNShared
|
||||||
Player passPlayer = {};
|
Player passPlayer = {};
|
||||||
Database::getPlayer(&passPlayer, selection->iPC_UID);
|
Database::getPlayer(&passPlayer, selection->iPC_UID);
|
||||||
// this should never happen but for extra safety
|
// this should never happen but for extra safety
|
||||||
@ -477,7 +477,7 @@ void CNLoginServer::characterSelect(CNSocket* sock, CNPacketData* data) {
|
|||||||
|
|
||||||
passPlayer.FEKey = sock->getFEKey();
|
passPlayer.FEKey = sock->getFEKey();
|
||||||
resp.iEnterSerialKey = passPlayer.iID;
|
resp.iEnterSerialKey = passPlayer.iID;
|
||||||
CNSharedData::setPlayer(resp.iEnterSerialKey, passPlayer);
|
CNShared::setPlayer(resp.iEnterSerialKey, passPlayer);
|
||||||
|
|
||||||
sock->sendPacket(resp, P_LS2CL_REP_SHARD_SELECT_SUCC);
|
sock->sendPacket(resp, P_LS2CL_REP_SHARD_SELECT_SUCC);
|
||||||
|
|
||||||
|
@ -105,8 +105,8 @@ void CNShardServer::_killConnection(CNSocket* cns) {
|
|||||||
|
|
||||||
PlayerManager::removePlayer(cns); // removes the player from the list and saves it to DB
|
PlayerManager::removePlayer(cns); // removes the player from the list and saves it to DB
|
||||||
|
|
||||||
// remove from CNSharedData
|
// remove from CNShared
|
||||||
CNSharedData::erasePlayer(key);
|
CNShared::erasePlayer(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNShardServer::killConnection(CNSocket *cns) {
|
void CNShardServer::killConnection(CNSocket *cns) {
|
||||||
|
Loading…
Reference in New Issue
Block a user