From f17aeff6f2062bf451d3e4c2d67d67a9d2edcb24 Mon Sep 17 00:00:00 2001 From: Inky Date: Wed, 19 Jun 2019 00:10:01 +0300 Subject: [PATCH] Changed: cli character selection --HG-- branch : develop --- code/ryzom/client/src/client.cpp | 7 +++++++ code/ryzom/client/src/connection.cpp | 22 +++++++++++++++------- code/ryzom/client/src/connection.h | 1 + 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/code/ryzom/client/src/client.cpp b/code/ryzom/client/src/client.cpp index 4c0121d2e..37cb36279 100644 --- a/code/ryzom/client/src/client.cpp +++ b/code/ryzom/client/src/client.cpp @@ -180,6 +180,7 @@ int main(int argc, char **argv) Args.addAdditionalArg("login", "Login to use", true, false); Args.addAdditionalArg("password", "Password to use", true, false); Args.addAdditionalArg("shard_id", "Shard ID to use", true, false); + Args.addAdditionalArg("slot", "Char slot to use", true, false); #ifdef TEST_CRASH_COUNTER Args.addArg("", "crash", "", "Crash client before init"); @@ -220,6 +221,12 @@ int main(int argc, char **argv) if (Args.haveAdditionalArg("shard_id")) sLoginShardId = Args.getAdditionalArg("shard_id").front(); + + if (Args.haveAdditionalArg("slot")) + { + if (!fromString(Args.getAdditionalArg("slot").front(), LoginCharsel)) + LoginCharsel = -1; + } } } diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 045822370..dd776b7fb 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -144,14 +144,13 @@ ucstring PlayerSelectedHomeShardName; ucstring PlayerSelectedHomeShardNameWithParenthesis; extern std::string CurrentCookie; - ucstring NewKeysCharNameWanted; // name of the character for which a new keyset must be created ucstring NewKeysCharNameValidated; std::string GameKeySet = "keys.xml"; std::string RingEditorKeySet = "keys_r2ed.xml"; string ScenarioFileName; - +sint LoginCharsel = -1; static const char *KeySetVarName = "BuiltInKeySets"; @@ -1095,8 +1094,15 @@ TInterfaceState globalMenu() noUserChar = userChar = false; if( FarTP.isReselectingChar() || !FarTP.isServerHopInProgress() ) // if doing a Server Hop, expect serverReceivedReady without action from the user { + sint charSelect = -1; + if (ClientCfg.SelectCharacter != -1) + charSelect = ClientCfg.SelectCharacter; + + if (LoginCharsel != -1) + charSelect = LoginCharsel; + WaitServerAnswer = false; - if (ClientCfg.SelectCharacter == -1) + if (charSelect == -1) { CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SERVER_RECEIVED_CHARS", false); if (pNL != NULL) @@ -1112,7 +1118,7 @@ TInterfaceState globalMenu() else { // check that the pre selected character is available - if (CharacterSummaries[ClientCfg.SelectCharacter].People == EGSPD::CPeople::Unknown) + if (CharacterSummaries[charSelect].People == EGSPD::CPeople::Unknown || charSelect > 4) { // BAD ! preselected char does not exist, use the first available or fail uint i; @@ -1132,12 +1138,14 @@ TInterfaceState globalMenu() if (ret == UDriver::noId) exit(-1); else - ClientCfg.SelectCharacter = i; + charSelect = i; } } - // Auto-selection for fast launching (dev only) - CAHManager::getInstance()->runActionHandler("launch_game", NULL, toString("slot=%d|edit_mode=0", ClientCfg.SelectCharacter)); + CAHManager::getInstance()->runActionHandler("launch_game", NULL, toString("slot=%d|edit_mode=0", charSelect)); + + if (LoginCharsel == -1) + ClientCfg.SelectCharacter = charSelect; } } diff --git a/code/ryzom/client/src/connection.h b/code/ryzom/client/src/connection.h index 92dfa859e..a424e80e9 100644 --- a/code/ryzom/client/src/connection.h +++ b/code/ryzom/client/src/connection.h @@ -34,6 +34,7 @@ extern ucstring PlayerSelectedHomeShardName; // The home shard name (aniro, extern ucstring PlayerSelectedHomeShardNameWithParenthesis; // Same with parenthesis extern std::vector CharacterSummaries; extern std::string UserPrivileges; +extern sint LoginCharsel; extern ucstring NewKeysCharNameWanted; extern ucstring NewKeysCharNameValidated;