diff --git a/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp b/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp index f8d42fdf..bcfb33bf 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp @@ -69,9 +69,9 @@ PyObject* cyAccountManagement::GetPlayerList() for (int i = 0; i < numPlayers; ++i) { PyObject* playerTuple = PyTuple_New(3); - PyObject* playerName = PyUnicode_FromUnicode((const Py_UNICODE*)playerList[i].playerName, wcslen(playerList[i].playerName)); + PyObject* playerName = PyUnicode_FromStringEx(playerList[i].playerName); PyObject* playerId = PyInt_FromLong(playerList[i].playerInt); - PyObject* avatarShape = PyString_FromString(playerList[i].avatarDatasetName); + PyObject* avatarShape = PyString_FromPlString(playerList[i].avatarDatasetName); PyTuple_SetItem(playerTuple, 0, playerName); PyTuple_SetItem(playerTuple, 1, playerId); diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp index 923571b8..7fdc18cd 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp @@ -276,7 +276,7 @@ void plNCAgeJoiner::ExecNextOp () { case kLoadPlayer: { LogMsg(kLogPerf, L"AgeJoiner: Exec:kLoadPlayer"); // Start loading local player - const char * avatarName; + plString avatarName; if (NetCommNeedToLoadAvatar()) { if (nc->GetFlagsBit(plNetClientApp::kLinkingToOfflineAge)) avatarName = "Male"; diff --git a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp index 0f24bc59..2373185a 100644 --- a/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp @@ -1084,9 +1084,9 @@ bool plNetClientMgr::CanSendMsg(plNetMessage * msg) plString plNetClientMgr::GetPlayerName(const plKey avKey) const { // local case - if (!avKey || avKey==GetLocalPlayerKey()) - return plString::FromIso8859_1(NetCommGetPlayer()->playerNameAnsi); - + if (!avKey || avKey == GetLocalPlayerKey()) + return NetCommGetPlayer()->playerName; + plNetTransportMember* mbr=TransportMgr().GetMember(TransportMgr().FindMember(avKey)); return mbr ? mbr->GetPlayerName() : plString::Null; } @@ -1094,15 +1094,15 @@ plString plNetClientMgr::GetPlayerName(const plKey avKey) const plString plNetClientMgr::GetPlayerNameById (unsigned playerId) const { // local case if (NetCommGetPlayer()->playerInt == playerId) - return plString::FromIso8859_1(NetCommGetPlayer()->playerNameAnsi); - + return NetCommGetPlayer()->playerName; + plNetTransportMember * mbr = TransportMgr().GetMember(TransportMgr().FindMember(playerId)); return mbr ? mbr->GetPlayerName() : plString::Null; } unsigned plNetClientMgr::GetPlayerIdByName (const plString & name) const { // local case - if (0 == name.Compare(NetCommGetPlayer()->playerNameAnsi)) + if (name.CompareI(NetCommGetPlayer()->playerName) == 0) return NetCommGetPlayer()->playerInt; unsigned n = TransportMgr().GetNumMembers(); diff --git a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp index d16634e7..becd06f0 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp +++ b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp @@ -123,7 +123,7 @@ static wchar_t s_iniOS[kMaxGTOSIdLength]; static bool s_iniReadAccountInfo = true; static wchar_t s_iniStartupAgeName[kMaxAgeNameLength]; static plUUID s_iniStartupAgeInstId; -static wchar_t s_iniStartupPlayerName[kMaxPlayerNameLength]; +static plString s_iniStartupPlayerName; static bool s_netError = false; @@ -405,13 +405,12 @@ static void INetCliAuthLoginRequestCallback ( s_account.billingType = billingType; s_players.GrowToCount(playerCount, true); for (unsigned i = 0; i < playerCount; ++i) { - LogMsg(kLogDebug, L"Player %u: %s explorer: %u", playerInfoArr[i].playerInt, playerInfoArr[i].playerName, playerInfoArr[i].explorer); - s_players[i].playerInt = playerInfoArr[i].playerInt; - s_players[i].explorer = playerInfoArr[i].explorer; - StrCopy(s_players[i].playerName, playerInfoArr[i].playerName, arrsize(s_players[i].playerName)); - StrToAnsi(s_players[i].playerNameAnsi, playerInfoArr[i].playerName, arrsize(s_players[i].playerNameAnsi)); - StrToAnsi(s_players[i].avatarDatasetName, playerInfoArr[i].avatarShape, arrsize(s_players[i].avatarDatasetName)); - if (!wantsStartUpAge && 0 == StrCmpI(s_players[i].playerName, s_iniStartupPlayerName, (unsigned)-1)) + LogMsg(kLogDebug, L"Player %u: %S explorer: %u", playerInfoArr[i].playerInt, playerInfoArr[i].playerName.c_str(), playerInfoArr[i].explorer); + s_players[i].playerInt = playerInfoArr[i].playerInt; + s_players[i].explorer = playerInfoArr[i].explorer; + s_players[i].playerName = playerInfoArr[i].playerName; + s_players[i].avatarDatasetName = playerInfoArr[i].avatarShape; + if (!wantsStartUpAge && s_players[i].playerName.CompareI(s_iniStartupPlayerName) == 0) s_player = &s_players[i]; } @@ -449,14 +448,13 @@ static void INetCliAuthCreatePlayerRequestCallback ( else { LogMsg(kLogDebug, L"Created player %s: %u", playerInfo.playerName, playerInfo.playerInt); - unsigned currPlayer = s_player ? s_player->playerInt : 0; + unsigned currPlayer = s_player ? s_player->playerInt : 0; NetCommPlayer * newPlayer = s_players.New(); - newPlayer->playerInt = playerInfo.playerInt; - newPlayer->explorer = playerInfo.explorer; - StrCopy(newPlayer->playerName, playerInfo.playerName, arrsize(newPlayer->playerName)); - StrToAnsi(newPlayer->playerNameAnsi, playerInfo.playerName, arrsize(newPlayer->playerNameAnsi)); - StrToAnsi(newPlayer->avatarDatasetName, playerInfo.avatarShape, arrsize(newPlayer->avatarDatasetName)); + newPlayer->playerInt = playerInfo.playerInt; + newPlayer->explorer = playerInfo.explorer; + newPlayer->playerName = playerInfo.playerName; + newPlayer->avatarDatasetName = playerInfo.avatarShape; { for (unsigned i = 0; i < s_players.Count(); ++i) { if (s_players[i].playerInt == currPlayer) { @@ -1137,7 +1135,7 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg s_player = &s_players[i]; break; } - else if (0 == StrCmpI(s_players[i].playerName, s_iniStartupPlayerName, arrsize(s_players[i].playerName))) { + else if (s_players[i].playerName.CompareI(s_iniStartupPlayerName) == 0) { playerInt = s_players[i].playerInt; s_player = &s_players[i]; } diff --git a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h index fdacb391..57fedbb1 100644 --- a/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h +++ b/Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h @@ -56,6 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include "pnUtils/pnUtils.h" #include "pnNetBase/pnNetBase.h" +#include "plString.h" #include "plNetCommon/plNetServerSessionInfo.h" #include "plNetCommon/plNetCommonHelpers.h" #include "plMessage/plNetCommMsgs.h" @@ -72,9 +73,8 @@ class plNetMessage; struct NetCommPlayer { unsigned playerInt; - wchar_t playerName[kMaxPlayerNameLength]; - char playerNameAnsi[kMaxPlayerNameLength]; - char avatarDatasetName[64]; + plString playerName; + plString avatarDatasetName; unsigned explorer; }; diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp index 1912b336..1e1d5259 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp @@ -2613,17 +2613,17 @@ LoginRequestTrans::LoginRequestTrans ( //============================================================================ void LoginRequestTrans::AddPlayer ( - unsigned playerInt, + unsigned playerInt, const wchar_t playerName[], const wchar_t avatarShape[], - unsigned explorer + unsigned explorer ) { unsigned index = m_playerCount++; ASSERT(index < kMaxPlayersPerAccount); - m_players[index].playerInt = playerInt; - m_players[index].explorer = explorer; - StrCopy(m_players[index].playerName, playerName, arrsize(m_players[index].playerName)); - StrCopy(m_players[index].avatarShape, avatarShape, arrsize(m_players[index].avatarShape)); + m_players[index].playerInt = playerInt; + m_players[index].explorer = explorer; + m_players[index].playerName = plString::FromWchar(playerName); + m_players[index].avatarShape = plString::FromWchar(avatarShape); } //============================================================================ @@ -2988,10 +2988,10 @@ bool PlayerCreateRequestTrans::Recv ( ) { const Auth2Cli_PlayerCreateReply & reply = *(const Auth2Cli_PlayerCreateReply *) msg; if (!IS_NET_ERROR(reply.result)) { - m_playerInfo.playerInt = reply.playerInt; - m_playerInfo.explorer = reply.explorer; - StrCopy(m_playerInfo.playerName, reply.playerName, arrsize(m_playerInfo.playerName)); - StrCopy(m_playerInfo.avatarShape, reply.avatarShape, arrsize(m_playerInfo.avatarShape)); + m_playerInfo.playerInt = reply.playerInt; + m_playerInfo.explorer = reply.explorer; + m_playerInfo.playerName = plString::FromWchar(reply.playerName); + m_playerInfo.avatarShape = plString::FromWchar(reply.avatarShape); } m_result = reply.result; m_state = kTransStateComplete; diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h index 33f9ad91..852d9597 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h @@ -119,8 +119,8 @@ void NetCliAuthAccountExistsRequest ( //============================================================================ struct NetCliAuthPlayerInfo { unsigned playerInt; - wchar_t playerName[kMaxPlayerNameLength]; - wchar_t avatarShape[kMaxVaultNodeStringLength]; + plString playerName; + plString avatarShape; unsigned playerFlags; unsigned explorer; };