From 2e101af87d418e42fdefb2f53d7cdaedd7e0bc9e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 17 May 2018 00:44:36 +0000 Subject: [PATCH] more work toward using int64 for station id --- .../src/shared/CharacterCreationTracker.cpp | 62 ++++++++++--------- .../src/shared/ClientConnection.cpp | 23 +++---- .../src/shared/ClientConnection.h | 25 ++++++++ .../src/shared/ClientConnection.cpp | 37 ++++------- .../LoginServer/src/shared/ClientConnection.h | 38 ++++++++---- .../LoginServer/src/shared/LoginServer.cpp | 30 ++++----- .../serverDatabase/src/shared/DataLookup.cpp | 34 +++++----- .../src/shared/TaskChangeStationId.cpp | 3 +- .../serverGame/src/shared/core/GameServer.cpp | 16 ++--- 9 files changed, 148 insertions(+), 120 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp b/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp index b56ee398..85e79f3c 100755 --- a/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp +++ b/engine/server/application/CentralServer/src/shared/CharacterCreationTracker.cpp @@ -5,6 +5,8 @@ // // ====================================================================== +#include + #include "FirstCentralServer.h" #include "CharacterCreationTracker.h" @@ -71,16 +73,16 @@ void CharacterCreationTracker::handleCreateNewCharacter(const ConnectionCreateCh { if (ServerClock::getInstance().getGameTimeSeconds() > (creationRecord->second->m_creationTime + ConfigCentralServer::getCharacterCreationTimeout())) { - LOG("TraceCharacterCreation", ("%d allowing character creation because previous one timed out", msg.getStationId())); - DEBUG_REPORT_LOG(true,("Allowing character creation for account %li because previous one timed out.\n",msg.getStationId())); + LOG("TraceCharacterCreation", ("%" PRId64 " allowing character creation because previous one timed out", msg.getStationId())); + DEBUG_REPORT_LOG(true,("Allowing character creation for account %" PRId64 " because previous one timed out.\n",msg.getStationId())); unlockAccount(msg.getStationId()); creationRecord = m_creations.end(); } else { - LOG("TraceCharacterCreation", ("%d refusing character creation because one is already in progress", msg.getStationId())); - DEBUG_REPORT_LOG(true,("Refusing character creation for account %li because one was already in progress.\n",msg.getStationId())); - ConnectionCreateCharacterFailed f(msg.getStationId(), msg.getCharacterName(), NameErrors::nameDeclinedRetry, FormattedString<2048>().sprintf("%lu refusing character creation because one is already in progress", msg.getStationId())); //lint !e40 // undeclared identifier nameDeclinedEntry + LOG("TraceCharacterCreation", ("%" PRId64 " refusing character creation because one is already in progress", msg.getStationId())); + DEBUG_REPORT_LOG(true,("Refusing character creation for account %" PRId64 " because one was already in progress.\n",msg.getStationId())); + ConnectionCreateCharacterFailed f(msg.getStationId(), msg.getCharacterName(), NameErrors::nameDeclinedRetry, FormattedString<2048>().sprintf("%" PRId64 " refusing character creation because one is already in progress", msg.getStationId())); //lint !e40 // undeclared identifier nameDeclinedEntry CentralServer::getInstance().sendToConnectionServerForAccount(msg.getStationId(), f, true); return; } @@ -93,9 +95,9 @@ void CharacterCreationTracker::handleCreateNewCharacter(const ConnectionCreateCh { if (!msg.getNoRateLimit() && ((Clock::timeSeconds() - fcl->second) < (msg.getIsForCharacterTransfer() ? static_cast(ConfigCentralServer::getCharacterCtsCreationRateLimitSeconds()) : static_cast(ConfigCentralServer::getCharacterCreationRateLimitSeconds())))) { - LOG("TraceCharacterCreation", ("%d refusing character creation because not enough time has passed since the previous one", msg.getStationId())); - DEBUG_REPORT_LOG(true,("Refusing character creation for account %li because not enough time has passed since the previous one\n",msg.getStationId())); - ConnectionCreateCharacterFailed f(msg.getStationId(), msg.getCharacterName(), NameErrors::nameDeclinedTooFast, FormattedString<2048>().sprintf("%lu refusing character creation because not enough time has passed since the previous one", msg.getStationId())); + LOG("TraceCharacterCreation", ("%" PRId64 " refusing character creation because not enough time has passed since the previous one", msg.getStationId())); + DEBUG_REPORT_LOG(true,("Refusing character creation for account %" PRId64 " because not enough time has passed since the previous one\n",msg.getStationId())); + ConnectionCreateCharacterFailed f(msg.getStationId(), msg.getCharacterName(), NameErrors::nameDeclinedTooFast, FormattedString<2048>().sprintf("%" PRId64 " refusing character creation because not enough time has passed since the previous one", msg.getStationId())); CentralServer::getInstance().sendToConnectionServerForAccount(msg.getStationId(), f, true); return; } @@ -117,8 +119,8 @@ void CharacterCreationTracker::handleCreateNewCharacter(const ConnectionCreateCh if (!getStartLocation(msg.getStartingLocation(), planetName, coordinates, cellId)) { // bad starting location - LOG("TraceCharacterCreation", ("%d bad starting location (%s)", msg.getStationId(), msg.getStartingLocation().c_str())); - ConnectionCreateCharacterFailed cccf(msg.getStationId(), msg.getCharacterName(), SharedStringIds::character_create_failed_bad_location, FormattedString<2048>().sprintf("%lu bad starting location (%s)", msg.getStationId(), msg.getStartingLocation().c_str())); + LOG("TraceCharacterCreation", ("%" PRId64 " bad starting location (%s)", msg.getStationId(), msg.getStartingLocation().c_str())); + ConnectionCreateCharacterFailed cccf(msg.getStationId(), msg.getCharacterName(), SharedStringIds::character_create_failed_bad_location, FormattedString<2048>().sprintf("%" PRId64 " bad starting location (%s)", msg.getStationId(), msg.getStartingLocation().c_str())); CentralServer::getInstance().sendToConnectionServerForAccount(msg.getStationId(), cccf, true); unlockAccount(msg.getStationId()); return; @@ -148,13 +150,13 @@ void CharacterCreationTracker::handleCreateNewCharacter(const ConnectionCreateCh if (gameServerId == 0) { DEBUG_REPORT_LOG(true, ("Could not find a game server for character creation, starting a tutorial server\n")); - LOG("TraceCharacterCreation", ("%d waiting for game server", msg.getStationId())); + LOG("TraceCharacterCreation", ("%" PRId64 " waiting for game server", msg.getStationId())); CentralServer::getInstance().startPlanetServer(CentralServer::getInstance().getHostForScene(tutorialPlanetName), tutorialPlanetName, 0); creationRecord->second->m_stage = CreationRecord::S_queuedForGameServer; return; } - LOG("TraceCharacterCreation", ("%d sending CentralCreateCharacter(%s) to game server %lu", msg.getStationId(), Unicode::wideToNarrow(msg.getCharacterName()).c_str(), gameServerId)); + LOG("TraceCharacterCreation", ("%" PRId64 " sending CentralCreateCharacter(%s) to game server %lu", msg.getStationId(), Unicode::wideToNarrow(msg.getCharacterName()).c_str(), gameServerId)); creationRecord->second->m_stage = CreationRecord::S_sentToGameServer; creationRecord->second->m_gameServerId = gameServerId; } @@ -165,7 +167,7 @@ void CharacterCreationTracker::unlockAccount(StationId account) { delete m_creations[account]; IGNORE_RETURN(m_creations.erase(account)); - LOG("TraceCharacterCreation", ("%d removing character creation lock", account)); + LOG("TraceCharacterCreation", ("%" PRId64 " removing character creation lock", account)); } // ---------------------------------------------------------------------- @@ -181,7 +183,7 @@ void CharacterCreationTracker::retryGameServerCreates() { i->second->m_stage = CreationRecord::S_sentToGameServer; i->second->m_gameServerId = gameServerId; - LOG("TraceCharacterCreation", ("%d sending CentralCreateCharacter to game server %lu", i->first,gameServerId)); + LOG("TraceCharacterCreation", ("%" PRId64 " sending CentralCreateCharacter to game server %lu", i->first,gameServerId)); } else { @@ -204,7 +206,7 @@ void CharacterCreationTracker::retryLoginServerCreates() { i->second->m_loginServerId = loginServerId; i->second->m_stage = CreationRecord::S_sentToLoginServer; - LOG("TraceCharacterCreation", ("%d sending LoginCreateCharacterMessage", i->first)); + LOG("TraceCharacterCreation", ("%" PRId64 " sending LoginCreateCharacterMessage", i->first)); } else { @@ -242,7 +244,7 @@ void CharacterCreationTracker::onGameServerDisconnect(uint32 serverId) { i->second->m_stage = CreationRecord::S_queuedForGameServer; i->second->m_gameServerId = 0; - LOG("TraceCharacterCreation", ("%d requeueing because game server disconnected", i->first)); + LOG("TraceCharacterCreation", ("%" PRId64 " requeueing because game server disconnected", i->first)); } } retryGameServerCreates(); @@ -258,7 +260,7 @@ void CharacterCreationTracker::onLoginServerDisconnect(uint32 loginServerId) { i->second->m_stage = CreationRecord::S_queuedForLoginServer; i->second->m_loginServerId = 0; - LOG("TraceCharacterCreation", ("%d requeueing because login server disconnected", i->first)); + LOG("TraceCharacterCreation", ("%" PRId64 " requeueing because login server disconnected", i->first)); } } retryLoginServerCreates(); @@ -269,12 +271,12 @@ void CharacterCreationTracker::onLoginServerDisconnect(uint32 loginServerId) void CharacterCreationTracker::handleDatabaseCreateCharacterSuccess(StationId account, const Unicode::String &characterName, const NetworkId &characterObjectId, int templateId, bool jedi) { // - Check we are at the right stage - LOG("TraceCharacterCreation", ("%d DatabaseCreateCharacterSuccess(%s)", account, characterObjectId.getValueString().c_str())); + LOG("TraceCharacterCreation", ("%" PRId64 " DatabaseCreateCharacterSuccess(%s)", account, characterObjectId.getValueString().c_str())); CreationsType::iterator creationRecord=m_creations.find(account); if (creationRecord==m_creations.end() || creationRecord->second->m_stage != CreationRecord::S_sentToGameServer) { - LOG("TraceCharacterCreation", ("%d DatabaseCreateCharacterSuccess was unexpected - exiting", account)); - DEBUG_WARNING(true,("Programmer bug: got GameCreateCharacter message for accout %d, which we weren't expecting.\n",account)); + LOG("TraceCharacterCreation", ("%" PRId64 " DatabaseCreateCharacterSuccess was unexpected - exiting", account)); + DEBUG_WARNING(true,("Programmer bug: got GameCreateCharacter message for account %" PRId64 ", which we weren't expecting.\n",account)); return; } @@ -287,13 +289,13 @@ void CharacterCreationTracker::handleDatabaseCreateCharacterSuccess(StationId ac { creationRecord->second->m_loginServerId = loginServerId; creationRecord->second->m_stage = CreationRecord::S_sentToLoginServer; - LOG("TraceCharacterCreation", ("%d sending LoginCreateCharacterMessage", account)); + LOG("TraceCharacterCreation", ("%" PRId64 " sending LoginCreateCharacterMessage", account)); } else { creationRecord->second->m_loginServerId = 0; creationRecord->second->m_stage = CreationRecord::S_queuedForLoginServer; - LOG("TraceCharacterCreation", ("%d waiting for login server", account)); + LOG("TraceCharacterCreation", ("%" PRId64 "waiting for login server", account)); } } @@ -302,18 +304,18 @@ void CharacterCreationTracker::handleDatabaseCreateCharacterSuccess(StationId ac void CharacterCreationTracker::handleLoginCreateCharacterAck(StationId account) { // - Check we are at the right stage - LOG("TraceCharacterCreation", ("%d LoginCreateCharacterAckMessage", account)); + LOG("TraceCharacterCreation", ("%" PRId64 " LoginCreateCharacterAckMessage", account)); CreationsType::iterator creationRecord=m_creations.find(account); if (creationRecord==m_creations.end() || creationRecord->second->m_stage != CreationRecord::S_sentToLoginServer) { - LOG("TraceCharacterCreation", ("%d LoginCreateCharacterAckMessage was unexpected - exiting", account)); - DEBUG_WARNING(true,("Programmer bug: got LoginCreateCharacterAckMessage message for account %d, which we weren't expecting.\n",account)); + LOG("TraceCharacterCreation", ("%" PRId64 " LoginCreateCharacterAckMessage was unexpected - exiting", account)); + DEBUG_WARNING(true,("Programmer bug: got LoginCreateCharacterAckMessage message for account %" PRId64 ", which we weren't expecting.\n",account)); return; } // - Tell the client the character has been created - LOG("TraceCharacterCreation", ("%d acknowledgeCharacterCreate(%s)", account, creationRecord->second->m_characterId.getValueString().c_str())); - LOG("CustomerService", ("Player:created character %s for stationId %u", creationRecord->second->m_characterId.getValueString().c_str(), account)); + LOG("TraceCharacterCreation", ("%" PRId64 " acknowledgeCharacterCreate(%s)", account, creationRecord->second->m_characterId.getValueString().c_str())); + LOG("CustomerService", ("Player:created character %s for stationId %" PRId64, creationRecord->second->m_characterId.getValueString().c_str(), account)); const ConnectionCreateCharacterSuccess c(account, creationRecord->second->m_characterId); CentralServer::getInstance().sendToConnectionServerForAccount(account, c, true); unlockAccount(account); @@ -332,12 +334,12 @@ void CharacterCreationTracker::handleGameCreateCharacterFailed(StationId account CreationsType::iterator creationRecord=m_creations.find(account); if (creationRecord==m_creations.end() || creationRecord->second->m_stage != CreationRecord::S_sentToGameServer) { - LOG("TraceCharacterCreation", ("%d got handleGameCreateCharacterFailed, but we weren't in the sentToGameServer stage - ignoring", account)); - DEBUG_WARNING(true,("Programmer bug: got handleGameCreateCharacterFailed message for account %d, which we weren't expecting.\n",account)); + LOG("TraceCharacterCreation", ("%" PRId64 " got handleGameCreateCharacterFailed, but we weren't in the sentToGameServer stage - ignoring", account)); + DEBUG_WARNING(true,("Programmer bug: got handleGameCreateCharacterFailed message for account %" PRId64 ", which we weren't expecting.\n",account)); return; } - LOG("TraceCharacterCreation", ("%d received GameCreateCharacterFailed(%s)", account, Unicode::wideToNarrow(characterName).c_str())); + LOG("TraceCharacterCreation", ("%" PRId64 " received GameCreateCharacterFailed(%s)", account, Unicode::wideToNarrow(characterName).c_str())); ConnectionCreateCharacterFailed cccf(account, characterName, errorMessage, optionalDetailedErrorMessage); CentralServer::getInstance().sendToConnectionServerForAccount(account, cccf, true); unlockAccount(account); diff --git a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp index e30109b2..937c00c1 100755 --- a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp @@ -3,6 +3,8 @@ //----------------------------------------------------------------------- +#include + #include "FirstConnectionServer.h" #include "ClientConnection.h" @@ -306,7 +308,7 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg &msg) { FATAL(clientIP.empty(), ("Remote IP is empty")); - DEBUG_WARNING(true, ("ConnectionServer::handleClientIdMessage - For ip %s suid is %lu requestedSUID is %lu and session is %s", clientIP.c_str(), m_suid, m_requestedSuid, sess.c_str())); + DEBUG_WARNING(true, ("ConnectionServer::handleClientIdMessage - For ip %s suid is %" PRId64 " requestedSUID is %lu and session is %s", clientIP.c_str(), m_suid, m_requestedSuid, sess.c_str())); webAPI api(sessURL); @@ -322,12 +324,9 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg &msg) { int expired = api.getNullableValue("expired"); if (!ConfigConnectionServer::getUseOldSuidGenerator()) { - apiSuid = api.getNullableValue("user_id"); + apiSuid = api.getNullableValue("user_id"); } else { - if (apiUser.length() > MAX_ACCOUNT_NAME_LENGTH) { - apiUser.resize(MAX_ACCOUNT_NAME_LENGTH); - } - apiSuid = std::hash < std::string > {}(apiUser.c_str()); + apiSuid = hashOldSoeSUID(apiUser); } if (apiIP == clientIP && expired == 0) { @@ -338,20 +337,20 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg &msg) { } if (!cont) { - LOG("ClientDisconnect", ("SUID %d (%d) passed a bad token to the connections erver. Disconnecting.", m_suid, apiSuid)); + LOG("ClientDisconnect", ("SUID %" PRId64 " (%" PRId64 ") passed a bad token to the connections erver. Disconnecting.", m_suid, apiSuid)); disconnect(); return; } } static const std::string loginTrace("TRACE_LOGIN"); - LOG(loginTrace, ("ClientConnection SUID = %d", m_suid)); + LOG(loginTrace, ("ClientConnection SUID = %" PRId64, m_suid)); //check for duplicate login ClientConnection *oldConnection = ConnectionServer::getClientConnection(m_suid); if (oldConnection) { //There is already someone connected to this cluster with this suid. - LOG("Network", ("SUID %d already logged in, disconnecting client.\n", m_suid)); + LOG("Network", ("SUID %" PRId64 " already logged in, disconnecting client.\n", m_suid)); ConnectionServer::dropClient(oldConnection, "Already Connected"); @@ -383,11 +382,7 @@ void ClientConnection::handleClientIdMessage(const ClientIdMsg &msg) { if (!m_suid && !ConfigConnectionServer::getValidateStationKey()) { WARNING(true, ("Generating suid from username. This is not safe or secure.")); - m_suid = atoi(m_accountName.c_str()); - - if (m_suid == 0) { - m_suid = std::hash < std::string > {}(m_accountName.c_str()); - } + m_suid = hashOldSoeSUID(m_accountName); } onValidateClient(m_suid, m_accountName, m_isSecure, nullptr, ConfigConnectionServer::getDefaultGameFeatures(), ConfigConnectionServer::getDefaultSubscriptionFeatures(), 0, 0, 0, 0, ConfigConnectionServer::getFakeBuddyPoints()); diff --git a/engine/server/application/ConnectionServer/src/shared/ClientConnection.h b/engine/server/application/ConnectionServer/src/shared/ClientConnection.h index 384f41b6..5dc536bb 100755 --- a/engine/server/application/ConnectionServer/src/shared/ClientConnection.h +++ b/engine/server/application/ConnectionServer/src/shared/ClientConnection.h @@ -197,6 +197,31 @@ private: //----------------------------------------------------------------------- +// thanks for the nasty BS Sony +inline const StationId hashOldSoeSUID(std::string name) { + StationId oldSoeSUID = 0; + + if (name.length()) { + char brokenSuid[50]; + uint32_t hash; + + //if (name.size() > MAX_ACCOUNT_NAME_LENGTH) { + // name.resize(MAX_ACCOUNT_NAME_LENGTH); + //} + + // use SOE's shitty method for generating unique id's + hash = static_cast(std::hash < std::string > {}(name.c_str())); + + // ...running them through sprintf to format, and overflowing or otherwise mangling the value + sprintf(brokenSuid, "%i", hash); + + // and then go back to int...lol + oldSoeSUID = std::stoi(brokenSuid); + } + + return oldSoeSUID; +} + inline const std::string & ClientConnection::getAccountName() const { return m_accountName; diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 129463ce..a8ef2a58 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -45,8 +45,8 @@ ClientConnection::~ClientConnection() { void ClientConnection::onConnectionClosed() { // client has disconnected if (m_stationId) { - DEBUG_REPORT_LOG(true, ("Client %lu disconnected\n", m_stationId)); - LOG("LoginClientConnection", ("onConnectionClosed() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str())); + DEBUG_REPORT_LOG(true, ("Client %" PRId64 " disconnected\n", m_stationId)); + LOG("LoginClientConnection", ("onConnectionClosed() for stationId (%" PRId64 ") at IP (%s)", m_stationId, getRemoteAddress().c_str())); } LoginServer::getInstance().removeClient(m_clientId); @@ -66,7 +66,7 @@ void ClientConnection::onConnectionOpened() { m_clientId = LoginServer::getInstance().addClient(*this); setOverflowLimit(ConfigLoginServer::getClientOverflowLimit()); - LOG("LoginClientConnection", ("onConnectionOpened() for stationId (%lu) at IP (%s)", m_stationId, getRemoteAddress().c_str())); + LOG("LoginClientConnection", ("onConnectionOpened() for stationId (%" PRId64 ") at IP (%s)", m_stationId, getRemoteAddress().c_str())); } //----------------------------------------------------------------------- @@ -105,7 +105,7 @@ void ClientConnection::onReceive(const Archive::ByteStream &message) { } else { - LOG("CustomerService", ("Login:LoginServer dropping client (stationId=[%lu], ip=[%s], id=[%s], key=[%s], version=[%s]) because of network version mismatch (required version=[%s])", m_stationId, getRemoteAddress().c_str(), id.getId().c_str(), id.getKey().c_str(), id.getVersion().c_str(), GameNetworkMessage::NetworkVersionId.c_str())); + LOG("CustomerService", ("Login:LoginServer dropping client (stationId=[%" PRId64 "], ip=[%s], id=[%s], key=[%s], version=[%s]) because of network version mismatch (required version=[%s])", m_stationId, getRemoteAddress().c_str(), id.getId().c_str(), id.getKey().c_str(), id.getVersion().c_str(), GameNetworkMessage::NetworkVersionId.c_str())); // disconnect is handled on the client side, as soon as it recieves this message #if _DEBUG LoginIncorrectClientId incorrectId(GameNetworkMessage::NetworkVersionId, ApplicationVersion::getInternalVersion()); @@ -160,7 +160,7 @@ void ClientConnection::validateClient(const std::string &id, const std::string & std::string uname; std::string parentAccount; std::string sessionID; - + std::string tmp; StationId user_id; StationId parent_id; std::unordered_map childAccounts; @@ -189,16 +189,8 @@ void ClientConnection::validateClient(const std::string &id, const std::string & user_id = static_cast(api.getNullableValue("user_id")); parent_id = static_cast(api.getNullableValue("parent_id")); } else { - if (parentAccount.length() > MAX_ACCOUNT_NAME_LENGTH) { - parentAccount.resize(MAX_ACCOUNT_NAME_LENGTH); - } - - if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) { - uname.resize(MAX_ACCOUNT_NAME_LENGTH); - } - - parent_id = static_cast(std::hash < std::string > {}(parentAccount.c_str())); - user_id = static_cast(std::hash < std::string > {}(uname.c_str())); + parent_id = hashOldSoeSUID(parentAccount); + user_id = hashOldSoeSUID(uname); } } else { std::string msg(api.getString("message")); @@ -218,12 +210,11 @@ void ClientConnection::validateClient(const std::string &id, const std::string & authOK = true; testMode = true; uname = id; + user_id = hashOldSoeSUID(uname); + } - if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) { - uname.resize(MAX_ACCOUNT_NAME_LENGTH); - } - - user_id = static_cast(std::hash < std::string > {}(uname.c_str())); + if (user_id == 0) { + authOK = false; } if (authOK) { @@ -246,11 +237,7 @@ void ClientConnection::validateClient(const std::string &id, const std::string & if (!child.empty() && i.first > 0) { if (ConfigLoginServer::getUseOldSuidGenerator()) { - if (child.length() > MAX_ACCOUNT_NAME_LENGTH) { - child.resize(MAX_ACCOUNT_NAME_LENGTH); - } - - child_id = static_cast(std::hash < std::string > {}(child.c_str())); + child_id = hashOldSoeSUID(child); } REPORT_LOG((parent_id != diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.h b/engine/server/application/LoginServer/src/shared/ClientConnection.h index 8f92f68f..0713b95a 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.h +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.h @@ -55,7 +55,6 @@ private: ClientConnection& operator=( const ClientConnection&); void validateClient(const std::string & id, const std::string & key); - private: int m_clientId; bool m_isValidated; @@ -73,19 +72,32 @@ private: }; //lint !e1712 // default constructor not defined //----------------------------------------------------------------------- - -// stolen from http://www.codeproject.com/Articles/10880/A-trim-implementation-for-std-string -// i'm rusty and haven't gotten to lambdas yet -inline const std::string trim(std::string str) -{ - - str.erase(str.begin(), std::find_if(str.begin(), str.end(), - [](char& ch)->bool { return !isspace(ch); })); - str.erase(std::find_if(str.rbegin(), str.rend(), - [](char& ch)->bool { return !isspace(ch); }).base(), str.end()); - return str; -} +// thanks for the nasty BS Sony +inline const StationId hashOldSoeSUID(std::string name) { + StationId oldSoeSUID = 0; + + if (name.length()) { + char brokenSuid[50]; + uint32_t hash; + + //if (name.size() > MAX_ACCOUNT_NAME_LENGTH) { + // name.resize(MAX_ACCOUNT_NAME_LENGTH); + //} + + // use SOE's shitty method for generating unique id's + hash = static_cast(std::hash < std::string > {}(name.c_str())); + + // ...running them through sprintf to format, and overflowing or otherwise mangling the value + sprintf(brokenSuid, "%i", hash); + + // and then go back to int...lol + oldSoeSUID = std::stoi(brokenSuid); + } + + return oldSoeSUID; +} + //----------------------------------------------------------------------- inline const StationId ClientConnection::getStationId() const diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index 342a2dfb..e1bf8e33 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -4,6 +4,8 @@ //----------------------------------------------------------------------- +#include + #include "FirstLoginServer.h" #include "LoginServer.h" @@ -276,11 +278,11 @@ bool LoginServer::deleteCharacter(uint32 clusterId, NetworkId const &characterId DatabaseConnection::getInstance().deleteCharacter(clusterId, characterId, suid); return true; } else { - DEBUG_REPORT_LOG(true, ("User %lu requested deleting character %s on cluster %lu, but the cluster is not currently connected.\n", suid, characterId.getValueString().c_str(), clusterId)); + DEBUG_REPORT_LOG(true, ("User %" PRId64 " requested deleting character %s on cluster %lu, but the cluster is not currently connected.\n", suid, characterId.getValueString().c_str(), clusterId)); return false; } } else { - DEBUG_REPORT_LOG(true, ("User %lu requested deleting character %s on cluster %lu, but we have no cluster with that number.\n", suid, characterId.getValueString().c_str(), clusterId)); + DEBUG_REPORT_LOG(true, ("User %" PRId64 " requested deleting character %s on cluster %lu, but we have no cluster with that number.\n", suid, characterId.getValueString().c_str(), clusterId)); return false; } } @@ -1136,7 +1138,7 @@ LoginServer::sendAvatarList(const StationId &stationId, int stationIdNumberJediS // CTS API character list request bool result = CentralServerConnection::sendCharacterListResponse(transferData->getSourceStationId(), avatars, *transferData); UNREF(result); - DEBUG_REPORT_LOG(!result, ("Could not send avatar list to StationId %lu because connection has been closed.\n", stationId)); + DEBUG_REPORT_LOG(!result, ("Could not send avatar list to StationId %" PRId64 " because connection has been closed.\n", stationId)); } else { uint32 characterTemplateId = 0; NetworkId characterId = NetworkId::cms_invalid; @@ -1154,7 +1156,7 @@ LoginServer::sendAvatarList(const StationId &stationId, int stationIdNumberJediS } } - LOG("CustomerService", ("CharacterTransfer: sendAvatarList() for stationId=%u, characterName=%s, sourceGalaxy=%s, determined characterId=%s, determined character template id=%lu", transferData->getSourceStationId(), transferData->getSourceCharacterName().c_str(), transferData->getSourceGalaxy().c_str(), characterId.getValueString().c_str(), characterTemplateId)); + LOG("CustomerService", ("CharacterTransfer: sendAvatarList() for stationId=%" PRId64 ", characterName=%s, sourceGalaxy=%s, determined characterId=%s, determined character template id=%lu", transferData->getSourceStationId(), transferData->getSourceCharacterName().c_str(), transferData->getSourceGalaxy().c_str(), characterId.getValueString().c_str(), characterTemplateId)); transferData->setCharacterId(characterId); transferData->setObjectTemplateCrc(characterTemplateId); @@ -1166,7 +1168,7 @@ LoginServer::sendAvatarList(const StationId &stationId, int stationIdNumberJediS } else { ClientConnection *conn = getValidatedClient(stationId); if (conn) { - LOG("LoginClientConnection", ("sendAvatarList() for stationId (%lu) at IP (%s), sending avatar list to client", stationId, conn->getRemoteAddress().c_str())); + LOG("LoginClientConnection", ("sendAvatarList() for stationId (%" PRId64 ") at IP (%s), sending avatar list to client", stationId, conn->getRemoteAddress().c_str())); // this message ***MUST*** be sent first, as the client expects to // receive this information before receiving the avatar list information @@ -1175,8 +1177,8 @@ LoginServer::sendAvatarList(const StationId &stationId, int stationIdNumberJediS conn->send(msg, true); } else { - DEBUG_REPORT_LOG(true, ("Could not send avatar list to StationId %lu.\n", stationId)); - LOG("LoginClientConnection", ("sendAvatarList() for stationId (%lu), cannot find connection to client for sending avatar list", stationId)); + DEBUG_REPORT_LOG(true, ("Could not send avatar list to StationId %" PRId64 ".\n", stationId)); + LOG("LoginClientConnection", ("sendAvatarList() for stationId (%" PRId64 "), cannot find connection to client for sending avatar list", stationId)); } } } @@ -1201,11 +1203,11 @@ void LoginServer::performAccountTransfer(const AvatarList &avatars, TransferAcco avatarData.push_back(AvatarData(clusterName, avatarName)); - LOG("CustomerService", ("CharacterTransfer: Sending request to update game db (via cluster: %s) for account transfer from %lu to %lu (avatar: %s)", clusterName.c_str(), sourceStationId, destinationStationId, avatarName.c_str())); + LOG("CustomerService", ("CharacterTransfer: Sending request to update game db (via cluster: %s) for account transfer from %" PRId64 " to %" PRId64 " (avatar: %s)", clusterName.c_str(), sourceStationId, destinationStationId, avatarName.c_str())); const GenericValueTypeMessage message("TransferAccountRequestCentralDatabase", *transferAccountData); sendToCluster(i->m_clusterId, message); } else { - LOG("CustomerService", ("CharacterTransfer: Could not connect to cluster id %lu to update game db for account transfer from %lu to %lu (avatar: %s)", i->m_clusterId, sourceStationId, destinationStationId, Unicode::wideToNarrow(i->m_name).c_str())); + LOG("CustomerService", ("CharacterTransfer: Could not connect to cluster id %lu to update game db for account transfer from %" PRId64 " to %" PRId64 " (avatar: %s)", i->m_clusterId, sourceStationId, destinationStationId, Unicode::wideToNarrow(i->m_name).c_str())); const GenericValueTypeMessage response("TransferAccountToAccountFailedToUpdateGameDatabase", *transferAccountData); CentralServerConnection::sendToCentralServer(transferAccountData->getStartGalaxy(), response); return; @@ -1226,7 +1228,7 @@ LoginServer::onValidateClient(StationId suid, const std::string &username, Clien UNREF(gameBits); UNREF(subscriptionBits); NOT_NULL(conn); - WARNING_STRICT_FATAL(getValidatedClient(suid), ("Validating an already valid client in onValidateClient(). StationId: %d UserName: %s", suid, username.c_str())); + WARNING_STRICT_FATAL(getValidatedClient(suid), ("Validating an already valid client in onValidateClient(). StationId: %" PRId64 " UserName: %s", suid, username.c_str())); int adminLevel = 0; const bool isAdminAccount = AdminAccountManager::isAdminAccount(Unicode::toLower(username), adminLevel); @@ -1235,13 +1237,13 @@ LoginServer::onValidateClient(StationId suid, const std::string &username, Clien //verify internal, secure, is on the god list bool loginOK = false; if (!isSecure) { - LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %li, but was not using a SecureID token", username.c_str(), suid, conn->getRequestedAdminSuid())); + LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %" PRId64 ", but was not using a SecureID token", username.c_str(), suid, conn->getRequestedAdminSuid())); } else { if (!AdminAccountManager::isInternalIp(conn->getRemoteAddress())) { - LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %li, but was not logging in from an internal IP", username.c_str(), suid, conn->getRequestedAdminSuid())); + LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %" PRId64 ", but was not logging in from an internal IP", username.c_str(), suid, conn->getRequestedAdminSuid())); } else { if (!isAdminAccount || adminLevel < 10) { - LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %li, but did not have sufficient permissions", username.c_str(), suid, conn->getRequestedAdminSuid())); + LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %" PRId64 ", but did not have sufficient permissions", username.c_str(), suid, conn->getRequestedAdminSuid())); } else { suid = conn->getRequestedAdminSuid(); loginOK = true; @@ -1325,7 +1327,7 @@ LoginServer::onValidateClient(StationId suid, const std::string &username, Clien //Send off request for the avatar list from the database. DatabaseConnection::getInstance().requestAvatarListForAccount(suid, 0); - LOG("LoginClientConnection", ("onValidateClient() for stationId (%lu) at IP (%s), id (%s), requesting avatar list for account", suid, conn->getRemoteAddress().c_str(), username.c_str())); + LOG("LoginClientConnection", ("onValidateClient() for stationId (%" PRId64 ") at IP (%s), id (%s), requesting avatar list for account", suid, conn->getRemoteAddress().c_str(), username.c_str())); //Set up the connection as being validated with this suid. conn->setIsValidated(true); diff --git a/engine/server/library/serverDatabase/src/shared/DataLookup.cpp b/engine/server/library/serverDatabase/src/shared/DataLookup.cpp index e03392dc..49f43b88 100755 --- a/engine/server/library/serverDatabase/src/shared/DataLookup.cpp +++ b/engine/server/library/serverDatabase/src/shared/DataLookup.cpp @@ -5,6 +5,8 @@ // // ====================================================================== +#include + #include "serverDatabase/FirstServerDatabase.h" #include "serverDatabase/DataLookup.h" @@ -178,7 +180,7 @@ void DataLookup::onRetrieveItemComplete(NetworkId const &ownerId, NetworkId cons void DataLookup::verifyName(uint32 gameServer, VerifyNameRequest * request) { - DEBUG_REPORT_LOG(true, ("verifyName: stationId %lu, process %lu, name %s: ", request->getStationId(), gameServer, Unicode::wideToNarrow(request->getCharacterName()).c_str())); + DEBUG_REPORT_LOG(true, ("verifyName: stationId %" PRId64 ", process %lu, name %s: ", request->getStationId(), gameServer, Unicode::wideToNarrow(request->getCharacterName()).c_str())); Unicode::String name = normalizeName(request->getCharacterName()); reservationList * rl = getReservationList(request->getStationId()); @@ -250,8 +252,8 @@ void DataLookup::verifyName(uint32 gameServer, VerifyNameRequest * request) { if (i->name == name) { - LOG("TraceCharacterCreation", ("Name (%s) requested by station ID %lu is already reserved by another station ID %lu and/or another character on the same station ID", Unicode::wideToNarrow(request->getCharacterName()).c_str(), request->getStationId(), j->first)); - DEBUG_REPORT_LOG(true, ("Name (%s) requested by station ID %lu is already reserved by another station ID %lu and/or another character on the same station ID\n", Unicode::wideToNarrow(request->getCharacterName()).c_str(), request->getStationId(), j->first)); + LOG("TraceCharacterCreation", ("Name (%s) requested by station ID %" PRId64 " is already reserved by another station ID %" PRId64 " and/or another character on the same station ID", Unicode::wideToNarrow(request->getCharacterName()).c_str(), request->getStationId(), j->first)); + DEBUG_REPORT_LOG(true, ("Name (%s) requested by station ID %" PRId64 " is already reserved by another station ID %" PRId64 " and/or another character on the same station ID\n", Unicode::wideToNarrow(request->getCharacterName()).c_str(), request->getStationId(), j->first)); GameServerConnection * g = DatabaseProcess::getInstance().getConnectionByProcess(gameServer); VerifyNameResponse vnr(request->getStationId(), request->getCharacterId(), request->getCreatureTemplate(), request->getCharacterName(), NameErrors::nameDeclinedInUse); g->send(vnr, true); @@ -296,7 +298,7 @@ void DataLookup::onCharacterNameChecked(uint32 stationId, const Unicode::String reservationList * rl = getReservationList(stationId); if (!rl) { - DEBUG_REPORT_LOG(true, ("Received onCharacterNameChecked (%s) for non-pending name stationid %lu\n", reason.getText().c_str(), stationId)); + DEBUG_REPORT_LOG(true, ("Received onCharacterNameChecked (%s) for non-pending name stationid %" PRId64 "\n", reason.getText().c_str(), stationId)); return; } @@ -311,20 +313,20 @@ void DataLookup::onCharacterNameChecked(uint32 stationId, const Unicode::String if (g) g->send(vnr, true); else - DEBUG_REPORT_LOG(true,("VerifyNameResponse for %lu dropped because GameServer has dropped connection.\n",stationId)); + DEBUG_REPORT_LOG(true,("VerifyNameResponse for %" PRId64 " dropped because GameServer has dropped connection.\n",stationId)); } } if (reason != NameErrors::nameApproved) { - LOG("TraceCharacterCreation", ("%d name released", stationId)); - DEBUG_REPORT_LOG(true, ("Name %s verified for stationId %lu: %s.\n", Unicode::wideToNarrow(name).c_str(), stationId, reason.getText().c_str())); + LOG("TraceCharacterCreation", ("%" PRId64 " name released", stationId)); + DEBUG_REPORT_LOG(true, ("Name %s verified for stationId %" PRId64 ": %s.\n", Unicode::wideToNarrow(name).c_str(), stationId, reason.getText().c_str())); releaseName(stationId, name); } else { - LOG("TraceCharacterCreation", ("%d name %s verified", stationId, Unicode::wideToNarrow(name).c_str())); - DEBUG_REPORT_LOG(true, ("Name %s verified for stationId %lu: %s, holding reservation.\n", Unicode::wideToNarrow(name).c_str(), stationId, reason.getText().c_str())); + LOG("TraceCharacterCreation", ("%" PRId64 " name %s verified", stationId, Unicode::wideToNarrow(name).c_str())); + DEBUG_REPORT_LOG(true, ("Name %s verified for stationId %" PRId64 ": %s, holding reservation.\n", Unicode::wideToNarrow(name).c_str(), stationId, reason.getText().c_str())); approveName(stationId, name); } } @@ -336,7 +338,7 @@ void DataLookup::releaseName(uint32 stationId, const NetworkId & characterId) reservationList * rl = getReservationList(stationId); if (!rl) { - WARNING(true, ("Releasing names for stationId %lu, characterId %s, but no reservations found.\n", stationId, characterId.getValueString().c_str())); + WARNING(true, ("Releasing names for stationId %" PRId64 ", characterId %s, but no reservations found.\n", stationId, characterId.getValueString().c_str())); return; } @@ -356,7 +358,7 @@ void DataLookup::releaseName(uint32 stationId, const NetworkId & characterId) } } - DEBUG_REPORT_LOG(true, ("Releasing %d names for stationId %lu, characterId %s\n", erased, stationId, characterId.getValueString().c_str())); + DEBUG_REPORT_LOG(true, ("Releasing %d names for stationId % " PRId64 ", characterId %s\n", erased, stationId, characterId.getValueString().c_str())); rl->swap(newReservations); if (rl->empty()) @@ -372,7 +374,7 @@ void DataLookup::releaseName(uint32 stationId, const Unicode::String &i_name) reservationList * rl = getReservationList(stationId); if (!rl) { - WARNING(true, ("Releasing name [%s] for stationId %lu, but no reservations found.\n", Unicode::wideToNarrow(i_name).c_str(), stationId)); + WARNING(true, ("Releasing name [%s] for stationId %" PRId64 ", but no reservations found.\n", Unicode::wideToNarrow(i_name).c_str(), stationId)); return; } @@ -392,7 +394,7 @@ void DataLookup::releaseName(uint32 stationId, const Unicode::String &i_name) } } - DEBUG_REPORT_LOG(true, ("Releasing %d names for stationId %lu, name (%s)\n", erased, stationId, Unicode::wideToNarrow(i_name).c_str())); + DEBUG_REPORT_LOG(true, ("Releasing %d names for stationId %" PRId64 ", name (%s)\n", erased, stationId, Unicode::wideToNarrow(i_name).c_str())); rl->swap(newReservations); if (rl->empty()) @@ -408,7 +410,7 @@ void DataLookup::approveName(uint32 stationId, const Unicode::String &i_name) reservationList * rl = getReservationList(stationId); if (!rl) { - WARNING_STRICT_FATAL(true, ("Approving name for stationId %lu, but name not found.\n", stationId)); + WARNING_STRICT_FATAL(true, ("Approving name for stationId %" PRId64 ", but name not found.\n", stationId)); return; } @@ -484,7 +486,7 @@ DataLookup::reservationList * DataLookup::getReservationList(uint32 stationId) DataLookup::reservationList * DataLookup::newReservationList(uint32 stationId) { reservationList * result = new reservationList; - DEBUG_FATAL(m_reservations.find(stationId) != m_reservations.end(), ("DataLookup::newReservationList called, but there is already a reservationList for this stationId %lu.", stationId)); + DEBUG_FATAL(m_reservations.find(stationId) != m_reservations.end(), ("DataLookup::newReservationList called, but there is already a reservationList for this stationId %" PRId64 ".", stationId)); m_reservations[stationId] = result; return result; } @@ -512,7 +514,7 @@ void DataLookup::deleteReservationList(uint32 stationId) reservationList * rl = rlIter->second; if (!rl) { - WARNING_STRICT_FATAL(true, ("Reservation list for stationID %lu is nullptr", stationId)); + WARNING_STRICT_FATAL(true, ("Reservation list for stationID %" PRId64 " is null", stationId)); return; } reservationList::iterator i; diff --git a/engine/server/library/serverDatabase/src/shared/TaskChangeStationId.cpp b/engine/server/library/serverDatabase/src/shared/TaskChangeStationId.cpp index b9c40637..b890e4e5 100755 --- a/engine/server/library/serverDatabase/src/shared/TaskChangeStationId.cpp +++ b/engine/server/library/serverDatabase/src/shared/TaskChangeStationId.cpp @@ -8,6 +8,7 @@ #include "serverDatabase/FirstServerDatabase.h" #include "TaskChangeStationId.h" +#include #include #include "sharedLog/Log.h" #include "serverNetworkMessages/TransferAccountData.h" @@ -57,7 +58,7 @@ bool TaskChangeStationId::process(DB::Session *session) void TaskChangeStationId::onComplete() { - LOG("CustomerService", ("CharacterTransfer: Completed changing station id from %lu to %lu in game database", m_sourceStationId, m_destinationStationId)); + LOG("CustomerService", ("CharacterTransfer: Completed changing station id from %" PRId64 " to %" PRId64 " in game database", m_sourceStationId, m_destinationStationId)); } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/core/GameServer.cpp b/engine/server/library/serverGame/src/shared/core/GameServer.cpp index 80009486..b26a2e1f 100755 --- a/engine/server/library/serverGame/src/shared/core/GameServer.cpp +++ b/engine/server/library/serverGame/src/shared/core/GameServer.cpp @@ -7,6 +7,8 @@ #include "serverGame/FirstServerGame.h" #include "serverGame/GameServer.h" +#include + #include "serverGame/AiMovementBase.h" #include "serverGame/AiCreatureController.h" #include "serverGame/AiShipController.h" @@ -4480,7 +4482,7 @@ void GameServer::handleCreateCharacter(const CentralCreateCharacter * createMess if (NameManager::getInstance().getPlayerId(NameManager::normalizeName(Unicode::wideToNarrow(createMessage->getCharacterName()))) != NetworkId::cms_invalid) { LOG("TraceCharacterCreation", ("%d character create name %s is in use, sending GameCreateCharacterFailed", createMessage->getStationId(), Unicode::wideToNarrow(createMessage->getCharacterName()).c_str())); - DEBUG_REPORT_LOG(true, ("Character create name %s is in use, declined for stationId %lu\n", Unicode::wideToNarrow(createMessage->getCharacterName()).c_str(), createMessage->getStationId())); + DEBUG_REPORT_LOG(true, ("Character create name %s is in use, declined for stationId %" PRId64 "\n", Unicode::wideToNarrow(createMessage->getCharacterName()).c_str(), createMessage->getStationId())); GameCreateCharacterFailed const characterCreateFailed(createMessage->getStationId(), createMessage->getCharacterName(), NameErrors::nameDeclinedInUse, FormattedString<2048>().sprintf("%lu character create name %s is in use, sending GameCreateCharacterFailed", createMessage->getStationId(), Unicode::wideToNarrow(createMessage->getCharacterName()).c_str())); sendToCentralServer(characterCreateFailed); delete createMessage; @@ -4507,7 +4509,7 @@ void GameServer::handleNameFailure(const RandomNameRequest &request, const Strin void GameServer::handleNameRequest(const RandomNameRequest &request) { - DEBUG_REPORT_LOG(true, ("Random name requested for stationId %lu\n", request.getStationId())); + DEBUG_REPORT_LOG(true, ("Random name requested for stationId %" PRId64 "\n", request.getStationId())); std::map::iterator findPendingCreation=m_charactersPendingCreation->find(request.getStationId()); if (findPendingCreation != m_charactersPendingCreation->end()) @@ -4530,7 +4532,7 @@ void GameServer::handleNameRequest(const RandomNameRequest &request) LOG("TraceCharacterCreation", ("%d generated name %s", request.getStationId(), Unicode::wideToNarrow(randomName).c_str(), request.getStationId(), request.getCreatureTemplate().c_str(), Unicode::wideToNarrow(randomName).c_str())); - DEBUG_REPORT_LOG(true, ("VerifyNameResponse: random name %s approved for stationId %lu\n", Unicode::wideToNarrow(randomName).c_str(), request.getStationId())); + DEBUG_REPORT_LOG(true, ("VerifyNameResponse: random name %s approved for stationId %" PRId64 "\n", Unicode::wideToNarrow(randomName).c_str(), request.getStationId())); RandomNameResponse const response(request.getStationId(), request.getCreatureTemplate(), randomName, NameErrors::nameApproved); sendToCentralServer(response); @@ -4558,7 +4560,7 @@ void GameServer::handleNameRequest(const RandomNameRequest &request) const StringId GameServer::handleVerifyAndLockNameRequest(const VerifyAndLockNameRequest &request, bool sendFailedResponseToCentralServer, bool verifyAgainstDb) { - REPORT_LOG(true, ("Verify and lock name requested for stationId %lu\n", request.getStationId())); + REPORT_LOG(true, ("Verify and lock name requested for stationId %" PRId64 "\n", request.getStationId())); const std::string & templateName = request.getTemplateName(); DEBUG_REPORT_LOG(true, ("Received verify and lock name request for account %li (name %s, template %s)\n", request.getStationId(), Unicode::wideToNarrow(request.getCharacterName()).c_str(), templateName.c_str())); @@ -4659,7 +4661,7 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse if (vrn.getErrorMessage() != NameErrors::nameApproved) { LOG("TraceCharacterCreation", ("%d VeryfyNameResponse character create name %s declined, sending GameCreateCharacterFailed(%d, %s, %s)", vrn.getStationId(), Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getStationId(), Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getErrorMessage().getText().c_str())); - DEBUG_REPORT_LOG(true, ("VerifyNameResponse: character create name %s declined (%s) for stationId %lu\n", Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getErrorMessage().getText().c_str(), vrn.getStationId())); + DEBUG_REPORT_LOG(true, ("VerifyNameResponse: character create name %s declined (%s) for stationId %" PRId64 "\n", Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getErrorMessage().getText().c_str(), vrn.getStationId())); GameCreateCharacterFailed const characterCreateFailed(vrn.getStationId(), vrn.getName(), vrn.getErrorMessage(), FormattedString<2048>().sprintf("%lu VeryfyNameResponse character create name %s declined, sending GameCreateCharacterFailed(%lu, %s, %s)", vrn.getStationId(), Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getStationId(), Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getErrorMessage().getText().c_str())); sendToCentralServer(characterCreateFailed); m_charactersPendingCreation->erase(vrn.getStationId()); @@ -4668,7 +4670,7 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse } std::string templateName(createMessage->getTemplateName()); - DEBUG_REPORT_LOG(true, ("VerifyNameResponse: character create name %s approved for stationId %lu\n", Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getStationId())); + DEBUG_REPORT_LOG(true, ("VerifyNameResponse: character create name %s approved for stationId %" PRId64 "\n", Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getStationId())); TangibleObject *newCharacterObject = 0; @@ -4688,7 +4690,7 @@ void GameServer::handleCharacterCreateNameVerification(const VerifyNameResponse if (!newCharacterObject) { LOG("TraceCharacterCreation", ("%d could not create a new character object on the game server, sending GameCreateCharacterFailed(%d, %s, %s) to central server", vrn.getStationId(), vrn.getStationId(), Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getErrorMessage().getText().c_str())); - DEBUG_REPORT_LOG(true, ("handleCharacterCreateNameVerification: failed to create character object (name %s, template %s, stationId %lu)\n", Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getCreatureTemplate().c_str(), vrn.getStationId())); + DEBUG_REPORT_LOG(true, ("handleCharacterCreateNameVerification: failed to create character object (name %s, template %s, stationId %" PRId64 ")\n", Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getCreatureTemplate().c_str(), vrn.getStationId())); GameCreateCharacterFailed const characterCreateFailed(vrn.getStationId(), vrn.getName(), NameErrors::nameDeclinedInternalError, FormattedString<2048>().sprintf("%lu could not create a new character object on the game server, sending GameCreateCharacterFailed(%lu, %s, %s) to central server", vrn.getStationId(), vrn.getStationId(), Unicode::wideToNarrow(vrn.getName()).c_str(), vrn.getErrorMessage().getText().c_str())); sendToCentralServer(characterCreateFailed); m_charactersPendingCreation->erase(vrn.getStationId());