Add helper function to get socket from player ID

Co-authored-by: Jade <jadeshrinemaiden@gmail.com>
This commit is contained in:
Gent 2020-10-02 17:00:36 -04:00
parent 21b7500e13
commit 1b55ab44e3
2 changed files with 9 additions and 0 deletions

View File

@ -933,4 +933,12 @@ void PlayerManager::setSpecialState(CNSocket* sock, CNPacketData* data) {
sock->sendPacket((void*)&response, P_FE2CL_REP_PC_SPECIAL_STATE_SWITCH_SUCC, sizeof(sP_FE2CL_REP_PC_SPECIAL_STATE_SWITCH_SUCC)); sock->sendPacket((void*)&response, P_FE2CL_REP_PC_SPECIAL_STATE_SWITCH_SUCC, sizeof(sP_FE2CL_REP_PC_SPECIAL_STATE_SWITCH_SUCC));
sendToViewable(sock, (void*)&response, P_FE2CL_PC_SPECIAL_STATE_CHANGE, sizeof(sP_FE2CL_PC_SPECIAL_STATE_CHANGE)); sendToViewable(sock, (void*)&response, P_FE2CL_PC_SPECIAL_STATE_CHANGE, sizeof(sP_FE2CL_PC_SPECIAL_STATE_CHANGE));
} }
CNSocket* PlayerManager::getSockFromID(int32_t iID) {
for (auto& pair : PlayerManager::players)
if (pair.second.plr->iID == iID)
return pair.first;
return nullptr;
}
#pragma endregion #pragma endregion

View File

@ -66,4 +66,5 @@ namespace PlayerManager {
bool isAccountInUse(int accountId); bool isAccountInUse(int accountId);
void exitDuplicate(int accountId); void exitDuplicate(int accountId);
void setSpecialState(CNSocket* sock, CNPacketData* data); void setSpecialState(CNSocket* sock, CNPacketData* data);
CNSocket* getSockFromID(int32_t iID);
} }