Browse Source

Merge pull request #490 from Hoikas/startup_anywhere

Allow internal clients to start in any age
Joseph Davies 10 years ago
parent
commit
435965f44f
  1. 12
      Sources/Plasma/Apps/plClient/winmain.cpp
  2. 42
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp
  3. 3
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h

12
Sources/Plasma/Apps/plClient/winmain.cpp

@ -94,7 +94,9 @@ enum
kArgSkipLoginDialog, kArgSkipLoginDialog,
kArgServerIni, kArgServerIni,
kArgLocalData, kArgLocalData,
kArgSkipPreload kArgSkipPreload,
kArgPlayerId,
kArgStartUpAgeName,
}; };
static const plCmdArgDef s_cmdLineArgs[] = { static const plCmdArgDef s_cmdLineArgs[] = {
@ -102,6 +104,8 @@ static const plCmdArgDef s_cmdLineArgs[] = {
{ kCmdArgFlagged | kCmdTypeString, "ServerIni", kArgServerIni }, { kCmdArgFlagged | kCmdTypeString, "ServerIni", kArgServerIni },
{ kCmdArgFlagged | kCmdTypeBool, "LocalData", kArgLocalData }, { kCmdArgFlagged | kCmdTypeBool, "LocalData", kArgLocalData },
{ kCmdArgFlagged | kCmdTypeBool, "SkipPreload", kArgSkipPreload }, { kCmdArgFlagged | kCmdTypeBool, "SkipPreload", kArgSkipPreload },
{ kCmdArgFlagged | kCmdTypeInt, "PlayerId", kArgPlayerId },
{ kCmdArgFlagged | kCmdTypeString, "Age", kArgStartUpAgeName },
}; };
/// Made globals now, so we can set them to zero if we take the border and /// Made globals now, so we can set them to zero if we take the border and
@ -1153,6 +1157,10 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
} }
if (cmdParser.IsSpecified(kArgSkipPreload)) if (cmdParser.IsSpecified(kArgSkipPreload))
gSkipPreload = true; gSkipPreload = true;
if (cmdParser.IsSpecified(kArgPlayerId))
NetCommSetIniPlayerId(cmdParser.GetInt(kArgPlayerId));
if (cmdParser.IsSpecified(kArgStartUpAgeName))
NetCommSetIniStartUpAge(cmdParser.GetString(kArgStartUpAgeName));
#endif #endif
plFileName serverIni = "server.ini"; plFileName serverIni = "server.ini";
@ -1263,8 +1271,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
} }
NetCliAuthAutoReconnectEnable(false); NetCliAuthAutoReconnectEnable(false);
NetCommSetReadIniAccountInfo(!doIntroDialogs);
InitNetClientComm(); InitNetClientComm();
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);

42
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp

@ -114,17 +114,14 @@ static ENetError s_authResult = kNetErrAuthenticationFailed;
static plString s_authSrvAddr; static plString s_authSrvAddr;
static plString s_fileSrvAddr; static plString s_fileSrvAddr;
static char s_iniServerAddr[256];
static char s_iniFileServerAddr[256];
static plString s_iniAccountUsername; static plString s_iniAccountUsername;
static ShaDigest s_namePassHash; static ShaDigest s_namePassHash;
static wchar_t s_iniAuthToken[kMaxPublisherAuthKeyLength]; static wchar_t s_iniAuthToken[kMaxPublisherAuthKeyLength];
static wchar_t s_iniOS[kMaxGTOSIdLength]; static wchar_t s_iniOS[kMaxGTOSIdLength];
static bool s_iniReadAccountInfo = true; static plString s_iniStartupAgeName = "StartUp";
static plString s_iniStartupAgeName; static plUUID s_iniStartupAgeInstId;
static plUUID s_iniStartupAgeInstId; static unsigned s_iniStartupPlayerId = 0;
static plString s_iniStartupPlayerName; static bool s_netError = false;
static bool s_netError = false;
struct NetCommMsgHandler : THashKeyVal<unsigned> { struct NetCommMsgHandler : THashKeyVal<unsigned> {
@ -408,7 +405,7 @@ static void INetCliAuthLoginRequestCallback (
s_players[i].explorer = playerInfoArr[i].explorer; s_players[i].explorer = playerInfoArr[i].explorer;
s_players[i].playerName = playerInfoArr[i].playerName; s_players[i].playerName = playerInfoArr[i].playerName;
s_players[i].avatarDatasetName = playerInfoArr[i].avatarShape; s_players[i].avatarDatasetName = playerInfoArr[i].avatarShape;
if (!wantsStartUpAge && s_players[i].playerName.CompareI(s_iniStartupPlayerName) == 0) if (!wantsStartUpAge && s_players[i].playerInt == s_iniStartupPlayerId)
s_player = &s_players[i]; s_player = &s_players[i];
} }
@ -700,6 +697,16 @@ bool NetCommIsLoginComplete() {
return s_loginComplete; return s_loginComplete;
} }
//============================================================================
void NetCommSetIniPlayerId(unsigned playerId) {
s_iniStartupPlayerId = playerId;
}
//============================================================================
void NetCommSetIniStartUpAge(const plString& ageName) {
s_iniStartupAgeName = ageName;
}
//============================================================================ //============================================================================
const NetCommAge * NetCommGetAge () { const NetCommAge * NetCommGetAge () {
return &s_age; return &s_age;
@ -741,8 +748,6 @@ void NetCommStartup () {
// Set startup age info // Set startup age info
memset(&s_startupAge, 0, sizeof(s_startupAge)); memset(&s_startupAge, 0, sizeof(s_startupAge));
s_iniStartupAgeName = "StartUp";
s_startupAge.ageDatasetName = s_iniStartupAgeName; s_startupAge.ageDatasetName = s_iniStartupAgeName;
s_startupAge.ageInstId = s_iniStartupAgeInstId; s_startupAge.ageInstId = s_iniStartupAgeInstId;
@ -1010,8 +1015,6 @@ void NetCommSetAccountUsernamePassword (
) { ) {
s_iniAccountUsername = username; s_iniAccountUsername = username;
memcpy(s_namePassHash, namePassHash, sizeof(ShaDigest)); memcpy(s_namePassHash, namePassHash, sizeof(ShaDigest));
s_iniReadAccountInfo = false;
} }
//============================================================================ //============================================================================
@ -1030,11 +1033,6 @@ ENetError NetCommGetAuthResult () {
return s_authResult; return s_authResult;
} }
//============================================================================
void NetCommSetReadIniAccountInfo(bool readFromIni) {
s_iniReadAccountInfo = readFromIni;
}
//============================================================================ //============================================================================
void NetCommAuthenticate ( void NetCommAuthenticate (
void * param void * param
@ -1105,10 +1103,6 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg
s_player = &s_players[i]; s_player = &s_players[i];
break; break;
} }
else if (s_players[i].playerName.CompareI(s_iniStartupPlayerName) == 0) {
playerInt = s_players[i].playerInt;
s_player = &s_players[i];
}
} }
ASSERT(s_player); ASSERT(s_player);
} }

3
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.h

@ -105,7 +105,8 @@ const NetCommPlayer * NetCommGetPlayer ();
const ARRAY(NetCommPlayer) & NetCommGetPlayerList (); const ARRAY(NetCommPlayer) & NetCommGetPlayerList ();
unsigned NetCommGetPlayerCount (); unsigned NetCommGetPlayerCount ();
bool NetCommIsLoginComplete (); bool NetCommIsLoginComplete ();
void NetCommSetReadIniAccountInfo (bool readFromIni); void NetCommSetIniPlayerId(unsigned playerId);
void NetCommSetIniStartUpAge(const plString& ageName);
void NetCommSetAccountUsernamePassword (const plString& username, const ShaDigest & namePassHash); void NetCommSetAccountUsernamePassword (const plString& username, const ShaDigest & namePassHash);
void NetCommSetAuthTokenAndOS (wchar_t authToken[], wchar_t os[]); void NetCommSetAuthTokenAndOS (wchar_t authToken[], wchar_t os[]);
ENetError NetCommGetAuthResult (); ENetError NetCommGetAuthResult ();

Loading…
Cancel
Save