|
|
@ -106,7 +106,7 @@ struct NetCommParam { |
|
|
|
static bool s_shutdown; |
|
|
|
static bool s_shutdown; |
|
|
|
|
|
|
|
|
|
|
|
static NetCommAccount s_account; |
|
|
|
static NetCommAccount s_account; |
|
|
|
static ARRAY(NetCommPlayer) s_players; |
|
|
|
static std::vector<NetCommPlayer> s_players; |
|
|
|
static NetCommPlayer * s_player; |
|
|
|
static NetCommPlayer * s_player; |
|
|
|
static NetCommAge s_age; |
|
|
|
static NetCommAge s_age; |
|
|
|
static NetCommAge s_startupAge; |
|
|
|
static NetCommAge s_startupAge; |
|
|
@ -391,7 +391,7 @@ static void INetCliAuthLoginRequestCallback ( |
|
|
|
s_authResult = result; |
|
|
|
s_authResult = result; |
|
|
|
|
|
|
|
|
|
|
|
s_player = nil; |
|
|
|
s_player = nil; |
|
|
|
s_players.Clear(); |
|
|
|
s_players.clear(); |
|
|
|
|
|
|
|
|
|
|
|
bool wantsStartUpAge = (s_startupAge.ageDatasetName.IsEmpty() || |
|
|
|
bool wantsStartUpAge = (s_startupAge.ageDatasetName.IsEmpty() || |
|
|
|
s_startupAge.ageDatasetName.CompareI("StartUp") == 0); |
|
|
|
s_startupAge.ageDatasetName.CompareI("StartUp") == 0); |
|
|
@ -402,7 +402,7 @@ static void INetCliAuthLoginRequestCallback ( |
|
|
|
s_account.accountUuid = accountUuid; |
|
|
|
s_account.accountUuid = accountUuid; |
|
|
|
s_account.accountFlags = accountFlags; |
|
|
|
s_account.accountFlags = accountFlags; |
|
|
|
s_account.billingType = billingType; |
|
|
|
s_account.billingType = billingType; |
|
|
|
s_players.GrowToCount(playerCount, true); |
|
|
|
s_players.resize(playerCount); |
|
|
|
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.c_str(), 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; |
|
|
@ -448,19 +448,15 @@ static void INetCliAuthCreatePlayerRequestCallback ( |
|
|
|
LogMsg(kLogDebug, L"Created player %S: %u", playerInfo.playerName.c_str(), playerInfo.playerInt); |
|
|
|
LogMsg(kLogDebug, L"Created player %S: %u", playerInfo.playerName.c_str(), playerInfo.playerInt); |
|
|
|
|
|
|
|
|
|
|
|
unsigned currPlayer = s_player ? s_player->playerInt : 0; |
|
|
|
unsigned currPlayer = s_player ? s_player->playerInt : 0; |
|
|
|
NetCommPlayer * newPlayer = s_players.New(); |
|
|
|
s_players.emplace_back(playerInfo.playerInt, playerInfo.playerName, |
|
|
|
|
|
|
|
playerInfo.avatarShape, playerInfo.explorer); |
|
|
|
|
|
|
|
|
|
|
|
newPlayer->playerInt = playerInfo.playerInt; |
|
|
|
for (NetCommPlayer& player : s_players) { |
|
|
|
newPlayer->explorer = playerInfo.explorer; |
|
|
|
if (player.playerInt == currPlayer) { |
|
|
|
newPlayer->playerName = playerInfo.playerName; |
|
|
|
s_player = &player; |
|
|
|
newPlayer->avatarDatasetName = playerInfo.avatarShape; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ for (unsigned i = 0; i < s_players.Count(); ++i) { |
|
|
|
|
|
|
|
if (s_players[i].playerInt == currPlayer) { |
|
|
|
|
|
|
|
s_player = &s_players[i]; |
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
plAccountUpdateMsg* updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kCreatePlayer); |
|
|
|
plAccountUpdateMsg* updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kCreatePlayer); |
|
|
@ -485,19 +481,19 @@ static void INetCliAuthDeletePlayerCallback ( |
|
|
|
|
|
|
|
|
|
|
|
uint32_t currPlayer = s_player ? s_player->playerInt : 0; |
|
|
|
uint32_t currPlayer = s_player ? s_player->playerInt : 0; |
|
|
|
|
|
|
|
|
|
|
|
{for (uint32_t i = 0; i < s_players.Count(); ++i) { |
|
|
|
for (auto it = s_players.begin(); it != s_players.end(); ++it) { |
|
|
|
if (s_players[i].playerInt == playerInt) { |
|
|
|
if (it->playerInt == playerInt) { |
|
|
|
s_players.DeleteUnordered(i); |
|
|
|
s_players.erase(it); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
{for (uint32_t i = 0; i < s_players.Count(); ++i) { |
|
|
|
for (NetCommPlayer& player : s_players) { |
|
|
|
if (s_players[i].playerInt == currPlayer) { |
|
|
|
if (player.playerInt == currPlayer) { |
|
|
|
s_player = &s_players[i]; |
|
|
|
s_player = &player; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
plAccountUpdateMsg* updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kDeletePlayer); |
|
|
|
plAccountUpdateMsg* updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kDeletePlayer); |
|
|
@ -623,12 +619,12 @@ static void INetCliAuthUpgradeVisitorRequestCallback ( |
|
|
|
else { |
|
|
|
else { |
|
|
|
LogMsg(kLogDebug, L"Upgrade visitor succeeded: %d", playerInt); |
|
|
|
LogMsg(kLogDebug, L"Upgrade visitor succeeded: %d", playerInt); |
|
|
|
|
|
|
|
|
|
|
|
{for (uint32_t i = 0; i < s_players.Count(); ++i) { |
|
|
|
for (NetCommPlayer& player : s_players) { |
|
|
|
if (s_players[i].playerInt == playerInt) { |
|
|
|
if (player.playerInt == playerInt) { |
|
|
|
s_players[i].explorer = true; |
|
|
|
player.explorer = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
plAccountUpdateMsg* updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kUpgradePlayer); |
|
|
|
plAccountUpdateMsg* updateMsg = new plAccountUpdateMsg(plAccountUpdateMsg::kUpgradePlayer); |
|
|
@ -682,13 +678,13 @@ const NetCommPlayer * NetCommGetPlayer () { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//============================================================================
|
|
|
|
const ARRAY(NetCommPlayer)& NetCommGetPlayerList () { |
|
|
|
const std::vector<NetCommPlayer>& NetCommGetPlayerList () { |
|
|
|
return s_players; |
|
|
|
return s_players; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//============================================================================
|
|
|
|
unsigned NetCommGetPlayerCount () { |
|
|
|
unsigned NetCommGetPlayerCount () { |
|
|
|
return s_players.Count(); |
|
|
|
return s_players.size(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//============================================================================
|
|
|
@ -1101,10 +1097,10 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg |
|
|
|
if (desiredPlayerInt == 0) |
|
|
|
if (desiredPlayerInt == 0) |
|
|
|
s_player = nil; |
|
|
|
s_player = nil; |
|
|
|
else { |
|
|
|
else { |
|
|
|
for (unsigned i = 0; i < s_players.Count(); ++i) { |
|
|
|
for (NetCommPlayer& player : s_players) { |
|
|
|
if (s_players[i].playerInt == desiredPlayerInt) { |
|
|
|
if (player.playerInt == desiredPlayerInt) { |
|
|
|
playerInt = desiredPlayerInt; |
|
|
|
playerInt = desiredPlayerInt; |
|
|
|
s_player = &s_players[i]; |
|
|
|
s_player = &player; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|