Browse Source

Convert NetComm player name to plString

Adam Johnson 10 years ago
parent
commit
5b0a8f62e6
  1. 4
      Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp
  2. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp
  3. 6
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp
  4. 18
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp
  5. 6
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h
  6. 8
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp
  7. 4
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h

4
Sources/Plasma/FeatureLib/pfPython/cyAccountManagement.cpp

@ -69,9 +69,9 @@ PyObject* cyAccountManagement::GetPlayerList()
for (int i = 0; i < numPlayers; ++i) for (int i = 0; i < numPlayers; ++i)
{ {
PyObject* playerTuple = PyTuple_New(3); 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* 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, 0, playerName);
PyTuple_SetItem(playerTuple, 1, playerId); PyTuple_SetItem(playerTuple, 1, playerId);

2
Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp

@ -276,7 +276,7 @@ void plNCAgeJoiner::ExecNextOp () {
case kLoadPlayer: { case kLoadPlayer: {
LogMsg(kLogPerf, L"AgeJoiner: Exec:kLoadPlayer"); LogMsg(kLogPerf, L"AgeJoiner: Exec:kLoadPlayer");
// Start loading local player // Start loading local player
const char * avatarName; plString avatarName;
if (NetCommNeedToLoadAvatar()) { if (NetCommNeedToLoadAvatar()) {
if (nc->GetFlagsBit(plNetClientApp::kLinkingToOfflineAge)) if (nc->GetFlagsBit(plNetClientApp::kLinkingToOfflineAge))
avatarName = "Male"; avatarName = "Male";

6
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp

@ -1085,7 +1085,7 @@ plString plNetClientMgr::GetPlayerName(const plKey avKey) const
{ {
// local case // local case
if (!avKey || avKey == GetLocalPlayerKey()) if (!avKey || avKey == GetLocalPlayerKey())
return plString::FromIso8859_1(NetCommGetPlayer()->playerNameAnsi); return NetCommGetPlayer()->playerName;
plNetTransportMember* mbr=TransportMgr().GetMember(TransportMgr().FindMember(avKey)); plNetTransportMember* mbr=TransportMgr().GetMember(TransportMgr().FindMember(avKey));
return mbr ? mbr->GetPlayerName() : plString::Null; return mbr ? mbr->GetPlayerName() : plString::Null;
@ -1094,7 +1094,7 @@ plString plNetClientMgr::GetPlayerName(const plKey avKey) const
plString plNetClientMgr::GetPlayerNameById (unsigned playerId) const { plString plNetClientMgr::GetPlayerNameById (unsigned playerId) const {
// local case // local case
if (NetCommGetPlayer()->playerInt == playerId) if (NetCommGetPlayer()->playerInt == playerId)
return plString::FromIso8859_1(NetCommGetPlayer()->playerNameAnsi); return NetCommGetPlayer()->playerName;
plNetTransportMember * mbr = TransportMgr().GetMember(TransportMgr().FindMember(playerId)); plNetTransportMember * mbr = TransportMgr().GetMember(TransportMgr().FindMember(playerId));
return mbr ? mbr->GetPlayerName() : plString::Null; return mbr ? mbr->GetPlayerName() : plString::Null;
@ -1102,7 +1102,7 @@ plString plNetClientMgr::GetPlayerNameById (unsigned playerId) const {
unsigned plNetClientMgr::GetPlayerIdByName (const plString & name) const { unsigned plNetClientMgr::GetPlayerIdByName (const plString & name) const {
// local case // local case
if (0 == name.Compare(NetCommGetPlayer()->playerNameAnsi)) if (name.CompareI(NetCommGetPlayer()->playerName) == 0)
return NetCommGetPlayer()->playerInt; return NetCommGetPlayer()->playerInt;
unsigned n = TransportMgr().GetNumMembers(); unsigned n = TransportMgr().GetNumMembers();

18
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp

@ -123,7 +123,7 @@ static wchar_t s_iniOS[kMaxGTOSIdLength];
static bool s_iniReadAccountInfo = true; static bool s_iniReadAccountInfo = true;
static wchar_t s_iniStartupAgeName[kMaxAgeNameLength]; static wchar_t s_iniStartupAgeName[kMaxAgeNameLength];
static plUUID s_iniStartupAgeInstId; static plUUID s_iniStartupAgeInstId;
static wchar_t s_iniStartupPlayerName[kMaxPlayerNameLength]; static plString s_iniStartupPlayerName;
static bool s_netError = false; static bool s_netError = false;
@ -405,13 +405,12 @@ static void INetCliAuthLoginRequestCallback (
s_account.billingType = billingType; s_account.billingType = billingType;
s_players.GrowToCount(playerCount, true); s_players.GrowToCount(playerCount, true);
for (unsigned i = 0; i < playerCount; ++i) { for (unsigned i = 0; i < playerCount; ++i) {
LogMsg(kLogDebug, L"Player %u: %s explorer: %u", playerInfoArr[i].playerInt, playerInfoArr[i].playerName, playerInfoArr[i].explorer); 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].playerInt = playerInfoArr[i].playerInt;
s_players[i].explorer = playerInfoArr[i].explorer; s_players[i].explorer = playerInfoArr[i].explorer;
StrCopy(s_players[i].playerName, playerInfoArr[i].playerName, arrsize(s_players[i].playerName)); s_players[i].playerName = playerInfoArr[i].playerName;
StrToAnsi(s_players[i].playerNameAnsi, playerInfoArr[i].playerName, arrsize(s_players[i].playerNameAnsi)); s_players[i].avatarDatasetName = playerInfoArr[i].avatarShape;
StrToAnsi(s_players[i].avatarDatasetName, playerInfoArr[i].avatarShape, arrsize(s_players[i].avatarDatasetName)); if (!wantsStartUpAge && s_players[i].playerName.CompareI(s_iniStartupPlayerName) == 0)
if (!wantsStartUpAge && 0 == StrCmpI(s_players[i].playerName, s_iniStartupPlayerName, (unsigned)-1))
s_player = &s_players[i]; s_player = &s_players[i];
} }
@ -454,9 +453,8 @@ static void INetCliAuthCreatePlayerRequestCallback (
newPlayer->playerInt = playerInfo.playerInt; newPlayer->playerInt = playerInfo.playerInt;
newPlayer->explorer = playerInfo.explorer; newPlayer->explorer = playerInfo.explorer;
StrCopy(newPlayer->playerName, playerInfo.playerName, arrsize(newPlayer->playerName)); newPlayer->playerName = playerInfo.playerName;
StrToAnsi(newPlayer->playerNameAnsi, playerInfo.playerName, arrsize(newPlayer->playerNameAnsi)); newPlayer->avatarDatasetName = playerInfo.avatarShape;
StrToAnsi(newPlayer->avatarDatasetName, playerInfo.avatarShape, arrsize(newPlayer->avatarDatasetName));
{ for (unsigned i = 0; i < s_players.Count(); ++i) { { for (unsigned i = 0; i < s_players.Count(); ++i) {
if (s_players[i].playerInt == currPlayer) { if (s_players[i].playerInt == currPlayer) {
@ -1137,7 +1135,7 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg
s_player = &s_players[i]; s_player = &s_players[i];
break; 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; playerInt = s_players[i].playerInt;
s_player = &s_players[i]; s_player = &s_players[i];
} }

6
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 "HeadSpin.h"
#include "pnUtils/pnUtils.h" #include "pnUtils/pnUtils.h"
#include "pnNetBase/pnNetBase.h" #include "pnNetBase/pnNetBase.h"
#include "plString.h"
#include "plNetCommon/plNetServerSessionInfo.h" #include "plNetCommon/plNetServerSessionInfo.h"
#include "plNetCommon/plNetCommonHelpers.h" #include "plNetCommon/plNetCommonHelpers.h"
#include "plMessage/plNetCommMsgs.h" #include "plMessage/plNetCommMsgs.h"
@ -72,9 +73,8 @@ class plNetMessage;
struct NetCommPlayer { struct NetCommPlayer {
unsigned playerInt; unsigned playerInt;
wchar_t playerName[kMaxPlayerNameLength]; plString playerName;
char playerNameAnsi[kMaxPlayerNameLength]; plString avatarDatasetName;
char avatarDatasetName[64];
unsigned explorer; unsigned explorer;
}; };

8
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp

@ -2622,8 +2622,8 @@ void LoginRequestTrans::AddPlayer (
ASSERT(index < kMaxPlayersPerAccount); ASSERT(index < kMaxPlayersPerAccount);
m_players[index].playerInt = playerInt; m_players[index].playerInt = playerInt;
m_players[index].explorer = explorer; m_players[index].explorer = explorer;
StrCopy(m_players[index].playerName, playerName, arrsize(m_players[index].playerName)); m_players[index].playerName = plString::FromWchar(playerName);
StrCopy(m_players[index].avatarShape, avatarShape, arrsize(m_players[index].avatarShape)); m_players[index].avatarShape = plString::FromWchar(avatarShape);
} }
//============================================================================ //============================================================================
@ -2990,8 +2990,8 @@ bool PlayerCreateRequestTrans::Recv (
if (!IS_NET_ERROR(reply.result)) { if (!IS_NET_ERROR(reply.result)) {
m_playerInfo.playerInt = reply.playerInt; m_playerInfo.playerInt = reply.playerInt;
m_playerInfo.explorer = reply.explorer; m_playerInfo.explorer = reply.explorer;
StrCopy(m_playerInfo.playerName, reply.playerName, arrsize(m_playerInfo.playerName)); m_playerInfo.playerName = plString::FromWchar(reply.playerName);
StrCopy(m_playerInfo.avatarShape, reply.avatarShape, arrsize(m_playerInfo.avatarShape)); m_playerInfo.avatarShape = plString::FromWchar(reply.avatarShape);
} }
m_result = reply.result; m_result = reply.result;
m_state = kTransStateComplete; m_state = kTransStateComplete;

4
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.h

@ -119,8 +119,8 @@ void NetCliAuthAccountExistsRequest (
//============================================================================ //============================================================================
struct NetCliAuthPlayerInfo { struct NetCliAuthPlayerInfo {
unsigned playerInt; unsigned playerInt;
wchar_t playerName[kMaxPlayerNameLength]; plString playerName;
wchar_t avatarShape[kMaxVaultNodeStringLength]; plString avatarShape;
unsigned playerFlags; unsigned playerFlags;
unsigned explorer; unsigned explorer;
}; };

Loading…
Cancel
Save