From 82af45e5619c8b24ff77e6ae5fa72e897032d38a Mon Sep 17 00:00:00 2001 From: Tahir Akhlaq Date: Fri, 11 Aug 2017 22:56:30 +0100 Subject: [PATCH 1/3] mass replace data types to fixed width ones --- src/libraries | 2 +- src/servers/Server_Common/Database.cpp | 8 ++--- src/servers/Server_Common/GamePacket.cpp | 4 +-- src/servers/Server_Common/GamePacket.h | 12 ++++---- src/servers/Server_Common/PacketContainer.cpp | 4 +-- src/servers/Server_Common/Util.cpp | 4 +-- src/servers/Server_Common/base64.cpp | 22 +++++++------- src/servers/Server_Common/base64.h | 2 +- src/servers/Server_Common/md5.cpp | 2 +- src/servers/Server_Common/md5.h | 2 +- src/servers/Server_Lobby/GameConnection.cpp | 4 +-- src/servers/Server_Lobby/RestConnector.cpp | 2 +- src/servers/Server_Lobby/RestConnector.h | 2 +- src/servers/Server_Lobby/ServerLobby.cpp | 4 +-- src/servers/Server_Lobby/ServerLobby.h | 4 +-- src/servers/Server_Lobby/blowfish.cpp | 30 +++++++++---------- src/servers/Server_Lobby/blowfish.h | 30 +++++++++---------- src/servers/Server_Lobby/mainLobbyServer.cpp | 2 +- src/servers/Server_REST/PlayerMinimal.cpp | 6 ++-- src/servers/Server_REST/SapphireAPI.cpp | 16 +++++----- src/servers/Server_REST/SapphireAPI.h | 4 +-- src/servers/Server_REST/main.cpp | 12 ++++---- src/servers/Server_REST/server_http.hpp | 2 +- src/servers/Server_Zone/Actor.cpp | 2 +- src/servers/Server_Zone/GameConnection.cpp | 2 +- src/servers/Server_Zone/Inventory.cpp | 18 +++++------ src/servers/Server_Zone/ItemContainer.cpp | 2 +- src/servers/Server_Zone/PacketHandlers.cpp | 6 ++-- src/servers/Server_Zone/Player.cpp | 12 ++++---- src/servers/Server_Zone/PlayerQuest.cpp | 10 +++---- src/servers/Server_Zone/PlayerSql.cpp | 2 +- .../Server_Zone/PlayerStateFlagsPacket.h | 2 +- src/servers/Server_Zone/ScriptManager.h | 2 +- src/servers/Server_Zone/ServerZone.cpp | 4 +-- src/servers/Server_Zone/ServerZone.h | 4 +-- src/servers/Server_Zone/Zone.cpp | 8 ++--- src/servers/Server_Zone/Zone.h | 2 +- src/servers/Server_Zone/mainGameServer.cpp | 2 +- 38 files changed, 129 insertions(+), 129 deletions(-) diff --git a/src/libraries b/src/libraries index 0f6ea9dd..23b9c0a1 160000 --- a/src/libraries +++ b/src/libraries @@ -1 +1 @@ -Subproject commit 0f6ea9ddd28f3defc69bb92413442c71db48e8b4 +Subproject commit 23b9c0a154a327b25d700cd6857a4e53bed2e8a1 diff --git a/src/servers/Server_Common/Database.cpp b/src/servers/Server_Common/Database.cpp index af9ba2ab..f43789bd 100644 --- a/src/servers/Server_Common/Database.cpp +++ b/src/servers/Server_Common/Database.cpp @@ -255,7 +255,7 @@ std::string Database::escapeString( std::string Escape ) DatabaseConnection * con = getFreeConnection(); const char * ret; - if( mysql_real_escape_string( con->conn, a2, Escape.c_str(), ( unsigned long ) Escape.length() ) == 0 ) + if( mysql_real_escape_string( con->conn, a2, Escape.c_str(), ( uint32_t ) Escape.length() ) == 0 ) { ret = Escape.c_str(); } @@ -272,7 +272,7 @@ void Database::escapeLongString( const char * str, uint32_t len, std::stringstre char a2[65536 * 3] = { 0 }; DatabaseConnection * con = getFreeConnection(); - mysql_real_escape_string( con->conn, a2, str, ( unsigned long ) len ); + mysql_real_escape_string( con->conn, a2, str, ( uint32_t ) len ); out.write( a2, ( std::streamsize )strlen( a2 ) ); con->lock.unlock(); @@ -282,7 +282,7 @@ std::string Database::escapeString( const char * esc, DatabaseConnection * con ) { char a2[16384] = { 0 }; const char * ret; - if( mysql_real_escape_string( con->conn, a2, ( char* ) esc, ( unsigned long ) strlen( esc ) ) == 0 ) + if( mysql_real_escape_string( con->conn, a2, ( char* ) esc, ( uint32_t ) strlen( esc ) ) == 0 ) { ret = esc; } @@ -297,7 +297,7 @@ std::string Database::escapeString( const char * esc, DatabaseConnection * con ) bool Database::_SendQuery( DatabaseConnection *con, const char* Sql, bool Self ) { //dunno what it does ...leaving untouched - int result = mysql_query( con->conn, Sql ); + int32_t result = mysql_query( con->conn, Sql ); if( result > 0 ) { if( Self == false && _HandleError( con, mysql_errno( con->conn ) ) ) diff --git a/src/servers/Server_Common/GamePacket.cpp b/src/servers/Server_Common/GamePacket.cpp index a7084c72..180ccfec 100644 --- a/src/servers/Server_Common/GamePacket.cpp +++ b/src/servers/Server_Common/GamePacket.cpp @@ -98,9 +98,9 @@ std::string Core::Network::Packets::GamePacket::toString() { std::string str = "\n"; - for( unsigned int i = 0; i < getSize(); i++ ) + for( uint32_t i = 0; i < getSize(); i++ ) { - str += boost::str( boost::format( "%|02X|" ) % ( int ) ( m_dataBuf[i] & 0xFF ) ) + " "; + str += boost::str( boost::format( "%|02X|" ) % ( int32_t ) ( m_dataBuf[i] & 0xFF ) ) + " "; if( ( i + 1 ) % 16 == 0 ) str += "\n"; diff --git a/src/servers/Server_Common/GamePacket.h b/src/servers/Server_Common/GamePacket.h index bee8675a..d4bf27c3 100644 --- a/src/servers/Server_Common/GamePacket.h +++ b/src/servers/Server_Common/GamePacket.h @@ -38,7 +38,7 @@ public: template void setValAt( uint16_t pos, T value ) { - memcpy( reinterpret_cast< unsigned char* >( &m_dataBuf[0] + pos ), &value, sizeof( T ) ); + memcpy( reinterpret_cast< uint8_t* >( &m_dataBuf[0] + pos ), &value, sizeof( T ) ); } template @@ -47,9 +47,9 @@ public: return *reinterpret_cast< T* >( &m_dataBuf[0] + pos ); } - void setBytesAt( uint16_t offset, unsigned char * bytes, uint16_t length ) + void setBytesAt( uint16_t offset, uint8_t * bytes, uint16_t length ) { - memcpy( reinterpret_cast< unsigned char* >( &m_dataBuf[0] + offset ), bytes, length ); + memcpy( reinterpret_cast< uint8_t* >( &m_dataBuf[0] + offset ), bytes, length ); } char * getStringAt( uint16_t pos ) @@ -59,12 +59,12 @@ public: void setStringAt( uint16_t pos, const std::string& str ) { - memcpy( reinterpret_cast< unsigned char* >( &m_dataBuf[0] + pos ), str.c_str(), str.length() ); + memcpy( reinterpret_cast< uint8_t* >( &m_dataBuf[0] + pos ), str.c_str(), str.length() ); } - unsigned char * getData() + uint8_t * getData() { - return reinterpret_cast< unsigned char* >( &m_dataBuf[0] ); + return reinterpret_cast< uint8_t* >( &m_dataBuf[0] ); } void setHeader( uint16_t size, uint16_t type, uint32_t id1, uint32_t id2, uint16_t subType, uint32_t unknown = 0xFED2E000 ); diff --git a/src/servers/Server_Common/PacketContainer.cpp b/src/servers/Server_Common/PacketContainer.cpp index 956f548d..9c192eae 100644 --- a/src/servers/Server_Common/PacketContainer.cpp +++ b/src/servers/Server_Common/PacketContainer.cpp @@ -65,9 +65,9 @@ std::string Core::Network::Packets::PacketContainer::toString() fillSendBuffer( tmpBuffer ); std::string str = "\n"; - for( unsigned int i = 0; i < m_ipcHdr.size; i++ ) + for( uint32_t i = 0; i < m_ipcHdr.size; i++ ) { - str += boost::str( boost::format( "%|02X|" ) % static_cast< int >( tmpBuffer[i] & 0xFF ) ) + " "; + str += boost::str( boost::format( "%|02X|" ) % static_cast< int32_t >( tmpBuffer[i] & 0xFF ) ) + " "; if( ( i + 1 ) % 16 == 0 ) str += "\n"; diff --git a/src/servers/Server_Common/Util.cpp b/src/servers/Server_Common/Util.cpp index 2d09f7cc..f46c68cc 100644 --- a/src/servers/Server_Common/Util.cpp +++ b/src/servers/Server_Common/Util.cpp @@ -6,9 +6,9 @@ std::string Core::Util::binaryToHexString( uint8_t* pBinData, uint16_t size ) std::string outStr; - for( unsigned int i = 0; i < size; i++ ) + for( uint32_t i = 0; i < size; i++ ) { - outStr += boost::str( boost::format( "%|02X|" ) % ( int ) ( pBinData[i] & 0xFF ) ); + outStr += boost::str( boost::format( "%|02X|" ) % ( int32_t ) ( pBinData[i] & 0xFF ) ); } return outStr; diff --git a/src/servers/Server_Common/base64.cpp b/src/servers/Server_Common/base64.cpp index 16e77159..3ad4db0d 100644 --- a/src/servers/Server_Common/base64.cpp +++ b/src/servers/Server_Common/base64.cpp @@ -34,16 +34,16 @@ static const std::string base64_chars = "0123456789+/"; -static inline bool is_base64( unsigned char c ) { +static inline bool is_base64( uint8_t c ) { return ( isalnum( c ) || ( c == '+' ) || ( c == '/' ) ); } -std::string Core::Util::base64_encode( unsigned char const* bytes_to_encode, unsigned int in_len ) { +std::string Core::Util::base64_encode( uint8_t const* bytes_to_encode, uint32_t in_len ) { std::string ret; - int i = 0; - int j = 0; - unsigned char char_array_3[3]; - unsigned char char_array_4[4]; + int32_t i = 0; + int32_t j = 0; + uint8_t char_array_3[3]; + uint8_t char_array_4[4]; while( in_len-- ) { char_array_3[i++] = *( bytes_to_encode++ ); @@ -82,11 +82,11 @@ std::string Core::Util::base64_encode( unsigned char const* bytes_to_encode, uns } std::string Core::Util::base64_decode( std::string const& encoded_string ) { - int in_len = encoded_string.size(); - int i = 0; - int j = 0; - int in_ = 0; - unsigned char char_array_4[4], char_array_3[3]; + int32_t in_len = encoded_string.size(); + int32_t i = 0; + int32_t j = 0; + int32_t in_ = 0; + uint8_t char_array_4[4], char_array_3[3]; std::string ret; while( in_len-- && ( encoded_string[in_] != '=' ) && is_base64( encoded_string[in_] ) ) { diff --git a/src/servers/Server_Common/base64.h b/src/servers/Server_Common/base64.h index 01b53c55..3840b8af 100644 --- a/src/servers/Server_Common/base64.h +++ b/src/servers/Server_Common/base64.h @@ -4,7 +4,7 @@ namespace Core { namespace Util { - std::string base64_encode( unsigned char const*, unsigned int len ); + std::string base64_encode( uint8_t const*, uint32_t len ); std::string base64_decode( std::string const& s ); } } diff --git a/src/servers/Server_Common/md5.cpp b/src/servers/Server_Common/md5.cpp index 1c1eaf6b..6f9a4152 100644 --- a/src/servers/Server_Common/md5.cpp +++ b/src/servers/Server_Common/md5.cpp @@ -247,7 +247,7 @@ void Core::Util::md5_finish( md5_context *ctx, uint8_t digest[16] ) * those are the standard RFC 1321 test vectors */ -void Core::Util::md5( unsigned char *text, unsigned char *hash, int size ) +void Core::Util::md5( uint8_t *text, uint8_t *hash, int32_t size ) { md5_context ctx; md5_starts( &ctx ); diff --git a/src/servers/Server_Common/md5.h b/src/servers/Server_Common/md5.h index 87bf4d7f..d4162221 100644 --- a/src/servers/Server_Common/md5.h +++ b/src/servers/Server_Common/md5.h @@ -16,7 +16,7 @@ namespace Core md5_context; - void md5( unsigned char *text, unsigned char *hash, int size ); + void md5( uint8_t *text, uint8_t *hash, int32_t size ); void md5_starts( md5_context *ctx ); void md5_update( md5_context *ctx, uint8_t *input, uint32_t length ); void md5_finish( md5_context *ctx, uint8_t digest[16] ); diff --git a/src/servers/Server_Lobby/GameConnection.cpp b/src/servers/Server_Lobby/GameConnection.cpp index 5f40d522..498f8f0b 100644 --- a/src/servers/Server_Lobby/GameConnection.cpp +++ b/src/servers/Server_Lobby/GameConnection.cpp @@ -120,7 +120,7 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui auto charList = g_restConnector.getCharList( ( char * )m_pSession->getSessionId() ); - int charIndex = 0; + int32_t charIndex = 0; for( uint8_t i = 0; i < 4; i++ ) { @@ -455,7 +455,7 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets: { BlowFish blowfish; blowfish.initialize( m_encKey, 0x10 ); - blowfish.Decode( ( unsigned char* )( &inPacket.data[0] ), ( unsigned char* )( &inPacket.data[0] ), + blowfish.Decode( ( uint8_t* )( &inPacket.data[0] ), ( uint8_t* )( &inPacket.data[0] ), ( inPacket.data.size() ) - 0x10 ); } diff --git a/src/servers/Server_Lobby/RestConnector.cpp b/src/servers/Server_Lobby/RestConnector.cpp index 997739e0..8e233f7f 100644 --- a/src/servers/Server_Lobby/RestConnector.cpp +++ b/src/servers/Server_Lobby/RestConnector.cpp @@ -306,7 +306,7 @@ bool Core::Network::RestConnector::deleteCharacter( char* sId, std::string name int Core::Network::RestConnector::createCharacter( char * sId, std::string name, std::string infoJson ) { - std::string json_string = "{\"sId\": \"" + std::string( sId, 56 ) + "\",\"secret\": \"" + serverSecret + "\",\"name\": \"" + name + "\",\"infoJson\": \"" + Core::Util::base64_encode( (unsigned char *)infoJson.c_str(), infoJson.length() ) + "\"}"; + std::string json_string = "{\"sId\": \"" + std::string( sId, 56 ) + "\",\"secret\": \"" + serverSecret + "\",\"name\": \"" + name + "\",\"infoJson\": \"" + Core::Util::base64_encode( (uint8_t *)infoJson.c_str(), infoJson.length() ) + "\"}"; HttpResponse r = requestApi( "createCharacter", json_string ); diff --git a/src/servers/Server_Lobby/RestConnector.h b/src/servers/Server_Lobby/RestConnector.h index c31c2a6e..e76da1ab 100644 --- a/src/servers/Server_Lobby/RestConnector.h +++ b/src/servers/Server_Lobby/RestConnector.h @@ -27,7 +27,7 @@ namespace Core HttpResponse requestApi( std::string endpoint, std::string data ); LobbySessionPtr getSession( char* sId ); - int createCharacter( char * sId, std::string name, std::string infoJson ); + int32_t createCharacter( char * sId, std::string name, std::string infoJson ); std::vector> getCharList( char * sId ); bool deleteCharacter( char* sId, std::string name ); bool checkNameTaken( std::string name ); diff --git a/src/servers/Server_Lobby/ServerLobby.cpp b/src/servers/Server_Lobby/ServerLobby.cpp index c8724111..4d239ac8 100644 --- a/src/servers/Server_Lobby/ServerLobby.cpp +++ b/src/servers/Server_Lobby/ServerLobby.cpp @@ -46,7 +46,7 @@ namespace Core { return g_restConnector.getSession( sessionId ); } - void ServerLobby::run( int argc, char* argv[] ) + void ServerLobby::run( int32_t argc, char* argv[] ) { g_log.setLogPath( "log\\SapphireLobby" ); g_log.init(); @@ -74,7 +74,7 @@ namespace Core { } - bool ServerLobby::loadSettings( int argc, char* argv[] ) + bool ServerLobby::loadSettings( int32_t argc, char* argv[] ) { g_log.info( "Loading config " + m_configPath ); diff --git a/src/servers/Server_Lobby/ServerLobby.h b/src/servers/Server_Lobby/ServerLobby.h index 6bc07868..29031ac4 100644 --- a/src/servers/Server_Lobby/ServerLobby.h +++ b/src/servers/Server_Lobby/ServerLobby.h @@ -34,9 +34,9 @@ namespace Core ServerLobby( const std::string& configPath ); ~ServerLobby( void ); - void run( int argc, char* argv[] ); + void run( int32_t argc, char* argv[] ); - bool loadSettings( int argc, char* argv[] ); + bool loadSettings( int32_t argc, char* argv[] ); void addSession( char* sessionId, LobbySessionPtr pSession ) { diff --git a/src/servers/Server_Lobby/blowfish.cpp b/src/servers/Server_Lobby/blowfish.cpp index 1c23e2b2..96d3badc 100644 --- a/src/servers/Server_Lobby/blowfish.cpp +++ b/src/servers/Server_Lobby/blowfish.cpp @@ -74,7 +74,7 @@ void BlowFish::Blowfish_decipher (DWORD *xl, DWORD *xr) // constructs the enctryption sieve -void BlowFish::initialize (BYTE key[], int keybytes) +void BlowFish::initialize (BYTE key[], int32_t keybytes) { int i, j ; DWORD datal, datar ; @@ -90,23 +90,23 @@ void BlowFish::initialize (BYTE key[], int keybytes) SBoxes [i][j] = bf_S [i][j] ; } - int v12; // eax@6 - int v13; // ecx@6 - int v14; // eax@8 - int v15; // edx@8 - int v16; // edx@8 - int v17; // eax@10 - int v18; // ecx@10 - int v19; // ecx@10 - int v20; // edx@12 - int v21; // edx@12 + int32_t v12; // eax@6 + int32_t v13; // ecx@6 + int32_t v14; // eax@8 + int32_t v15; // edx@8 + int32_t v16; // edx@8 + int32_t v17; // eax@10 + int32_t v18; // ecx@10 + int32_t v19; // ecx@10 + int32_t v20; // edx@12 + int32_t v21; // edx@12 - int v10 = keybytes; - int v9 = (uintptr_t)key; - int v8 = 0; - int v11 = 0; + int32_t v10 = keybytes; + int32_t v9 = (int32_t)key; + int32_t v8 = 0; + int32_t v11 = 0; do { v13 = (char)(*(BYTE *)(v8 + v9)); v12 = v8 + 1; diff --git a/src/servers/Server_Lobby/blowfish.h b/src/servers/Server_Lobby/blowfish.h index e05b422b..8c13144a 100644 --- a/src/servers/Server_Lobby/blowfish.h +++ b/src/servers/Server_Lobby/blowfish.h @@ -7,9 +7,9 @@ #define MAXKEYBYTES 56 // 448 bits max #define NPASS 16 // SBox passes -#define DWORD unsigned long +#define DWORD uint32_t #define WORD unsigned short -#define BYTE unsigned char +#define BYTE uint8_t class BlowFish { @@ -22,7 +22,7 @@ private: public: BlowFish () ; ~BlowFish () ; - void initialize (BYTE key[], int keybytes) ; + void initialize (BYTE key[], int32_t keybytes) ; DWORD GetOutputLength (DWORD lInputLong) ; DWORD Encode (BYTE * pInput, BYTE * pOutput, DWORD lSize) ; void Decode (BYTE * pInput, BYTE * pOutput, DWORD lSize) ; @@ -37,10 +37,10 @@ public: DWORD dword; BYTE byte [4]; struct { - unsigned int byte3:8; - unsigned int byte2:8; - unsigned int byte1:8; - unsigned int byte0:8; + uint32_t byte3:8; + uint32_t byte2:8; + uint32_t byte1:8; + uint32_t byte0:8; } w; }; #endif @@ -50,10 +50,10 @@ public: DWORD dword; BYTE byte [4]; struct { - unsigned int byte0:8; - unsigned int byte1:8; - unsigned int byte2:8; - unsigned int byte3:8; + uint32_t byte0:8; + uint32_t byte1:8; + uint32_t byte2:8; + uint32_t byte3:8; } w; }; #endif @@ -63,10 +63,10 @@ public: DWORD dword; BYTE byte [4]; struct { - unsigned int byte1:8; - unsigned int byte0:8; - unsigned int byte3:8; - unsigned int byte2:8; + uint32_t byte1:8; + uint32_t byte0:8; + uint32_t byte3:8; + uint32_t byte2:8; } w; }; #endif diff --git a/src/servers/Server_Lobby/mainLobbyServer.cpp b/src/servers/Server_Lobby/mainLobbyServer.cpp index 5627449d..e247f3b5 100644 --- a/src/servers/Server_Lobby/mainLobbyServer.cpp +++ b/src/servers/Server_Lobby/mainLobbyServer.cpp @@ -2,7 +2,7 @@ Core::ServerLobby g_serverLobby( "config/settings_lobby.xml" ); -int main( int argc, char* argv[] ) +int main( int32_t argc, char* argv[] ) { g_serverLobby.run( argc, argv ); diff --git a/src/servers/Server_REST/PlayerMinimal.cpp b/src/servers/Server_REST/PlayerMinimal.cpp index 356057a4..5f57fe05 100644 --- a/src/servers/Server_REST/PlayerMinimal.cpp +++ b/src/servers/Server_REST/PlayerMinimal.cpp @@ -62,7 +62,7 @@ namespace Core { field[6].getBinary( (char*)m_modelEquip, 40 ); - for( int i = 0; i < 26; i++ ) + for( int32_t i = 0; i < 26; i++ ) { m_lookMap[i] = m_look[i]; } @@ -179,7 +179,7 @@ namespace Core { uint16_t size = static_cast< uint16_t >( m_lookMap.size() ); - for( int i = 0; i < m_lookMap.size(); i++ ) + for( int32_t i = 0; i < m_lookMap.size(); i++ ) { customize[i] = m_lookMap[i]; } @@ -189,7 +189,7 @@ namespace Core { uint32_t startZone; float x, y, z, o; - int startTown = 0; + int32_t startTown = 0; switch( m_class ) { diff --git a/src/servers/Server_REST/SapphireAPI.cpp b/src/servers/Server_REST/SapphireAPI.cpp index b1bc0e7f..3ea460d0 100644 --- a/src/servers/Server_REST/SapphireAPI.cpp +++ b/src/servers/Server_REST/SapphireAPI.cpp @@ -36,13 +36,13 @@ bool Core::Network::SapphireAPI::login( const std::string& username, const std:: return false; // user found, proceed - int accountId = pQR->fetch()[0].getUInt32(); + int32_t accountId = pQR->fetch()[0].getUInt32(); // session id string generation - srand( ( unsigned int )time( NULL ) + 42 ); + srand( ( uint32_t )time( NULL ) + 42 ); uint8_t sid[58]; - for( int i = 0; i < 56; i += 4 ) + for( int32_t i = 0; i < 56; i += 4 ) { short number = 0x1111 + rand() % 0xFFFF; sprintf( ( char* )sid + i, "%04hx", number ); @@ -96,7 +96,7 @@ bool Core::Network::SapphireAPI::createAccount( const std::string& username, con // we are clear and can create a new account // get the next free account id pQR = g_database.query( "SELECT MAX(account_id) FROM accounts;" ); - int accountId = pQR->fetch()[0].getUInt32() + 1; + int32_t accountId = pQR->fetch()[0].getUInt32() + 1; // store the account to the db g_database.execute( "INSERT INTO accounts (account_Id, account_name, account_pass, account_created) VALUE(%i, '%s', '%s', %i);", @@ -132,7 +132,7 @@ int Core::Network::SapphireAPI::createCharacter( const int& accountId, const std const char *ptr = infoJson.c_str() + 50; std::string lookPart( ptr ); - int pos = lookPart.find_first_of( "]" ); + int32_t pos = lookPart.find_first_of( "]" ); if( pos != std::string::npos ) { lookPart = lookPart.substr( 0, pos + 1 ); @@ -154,7 +154,7 @@ int Core::Network::SapphireAPI::createCharacter( const int& accountId, const std tmpVector2.push_back( std::stoi( v.second.data() ) ); } std::vector::iterator it = tmpVector.begin(); - for( int i = 0; it != tmpVector.end(); ++it, i++ ) + for( int32_t i = 0; it != tmpVector.end(); ++it, i++ ) { newPlayer.setLook( i, *it ); } @@ -187,7 +187,7 @@ void Core::Network::SapphireAPI::deleteCharacter( std::string name, uint32_t acc } } - int id = deletePlayer.getId(); + int32_t id = deletePlayer.getId(); g_database.execute( "DELETE FROM charabase WHERE CharacterId LIKE '" + std::to_string( id ) + "';" ); g_database.execute( "DELETE FROM characlass WHERE CharacterId LIKE '" + std::to_string( id ) + "';" ); @@ -247,7 +247,7 @@ bool Core::Network::SapphireAPI::checkNameTaken( std::string name ) uint32_t Core::Network::SapphireAPI::getNextCharId() { - int charId = 0; + int32_t charId = 0; boost::shared_ptr pQR = g_database.query( "SELECT MAX(CharacterId) FROM charabase" ); diff --git a/src/servers/Server_REST/SapphireAPI.h b/src/servers/Server_REST/SapphireAPI.h index 1a79f2a0..09b86729 100644 --- a/src/servers/Server_REST/SapphireAPI.h +++ b/src/servers/Server_REST/SapphireAPI.h @@ -27,7 +27,7 @@ namespace Core bool createAccount( const std::string& username, const std::string& pass, std::string& sId ); - int createCharacter( const int& accountId, const std::string& name, const std::string& infoJson ); + int32_t createCharacter( const int& accountId, const std::string& name, const std::string& infoJson ); void deleteCharacter( std::string name, uint32_t accountId ); @@ -41,7 +41,7 @@ namespace Core uint64_t getNextContentId(); - int checkSession( const std::string& sId ); + int32_t checkSession( const std::string& sId ); bool removeSession( const std::string& sId ); diff --git a/src/servers/Server_REST/main.cpp b/src/servers/Server_REST/main.cpp index 72e59ca4..fffe5e96 100644 --- a/src/servers/Server_REST/main.cpp +++ b/src/servers/Server_REST/main.cpp @@ -60,7 +60,7 @@ void reloadConfig() void print_request_info( shared_ptr request ) { g_log.info( "Request from " + request->remote_endpoint_address + " (" + request->path + ")" ); } -bool loadSettings( int argc, char* argv[] ) +bool loadSettings( int32_t argc, char* argv[] ) { g_log.info( "Loading config " + configPath ); @@ -282,7 +282,7 @@ int main(int argc, char* argv[]) // reloadConfig(); - int accountId = g_sapphireAPI.checkSession( sId ); + int32_t accountId = g_sapphireAPI.checkSession( sId ); if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret ) { std::string json_string = "{\"result\":\"invalid_secret\"}"; @@ -321,7 +321,7 @@ int main(int argc, char* argv[]) // reloadConfig(); - int result = g_sapphireAPI.checkSession( sId ); + int32_t result = g_sapphireAPI.checkSession( sId ); if( result != -1 ) { @@ -331,7 +331,7 @@ int main(int argc, char* argv[]) } else { - int charId = g_sapphireAPI.createCharacter( result, name, finalJson ); + int32_t charId = g_sapphireAPI.createCharacter( result, name, finalJson ); std::string json_string = "{\"result\":\"" + std::to_string( charId ) + "\"}"; *response << "HTTP/1.1 200\r\nContent-Length: " << json_string.length() << "\r\n\r\n" << json_string; @@ -434,7 +434,7 @@ int main(int argc, char* argv[]) std::string sId = pt.get( "sId" ); std::string secret = pt.get( "secret" ); - int result = g_sapphireAPI.checkSession( sId ); + int32_t result = g_sapphireAPI.checkSession( sId ); // reloadConfig(); @@ -540,7 +540,7 @@ int main(int argc, char* argv[]) // reloadConfig(); - int result = g_sapphireAPI.checkSession( sId ); + int32_t result = g_sapphireAPI.checkSession( sId ); if( result != -1 ) { diff --git a/src/servers/Server_REST/server_http.hpp b/src/servers/Server_REST/server_http.hpp index 2651eaba..82ee541a 100644 --- a/src/servers/Server_REST/server_http.hpp +++ b/src/servers/Server_REST/server_http.hpp @@ -269,7 +269,7 @@ namespace SimpleWeb { //If content, read that as well auto it=request->header.find("Content-Length"); if(it!=request->header.end()) { - unsigned long long content_length; + uint64_t content_length; try { content_length=stoull(it->second); } diff --git a/src/servers/Server_Zone/Actor.cpp b/src/servers/Server_Zone/Actor.cpp index 1512e22f..bd1670a2 100644 --- a/src/servers/Server_Zone/Actor.cpp +++ b/src/servers/Server_Zone/Actor.cpp @@ -109,7 +109,7 @@ Core::Common::ClassJob Core::Entity::Actor::getClass() const return m_class; } -/*! \return current class or job as int ( this feels pointless ) */ +/*! \return current class or job as int32_t ( this feels pointless ) */ uint8_t Core::Entity::Actor::getClassAsInt() const { return static_cast< uint8_t >( m_class ); diff --git a/src/servers/Server_Zone/GameConnection.cpp b/src/servers/Server_Zone/GameConnection.cpp index cca0745a..53b2d2e8 100644 --- a/src/servers/Server_Zone/GameConnection.cpp +++ b/src/servers/Server_Zone/GameConnection.cpp @@ -238,7 +238,7 @@ void Core::Network::GameConnection::injectPacket( const std::string& packetpath, fclose( fp ); // cycle through the packet entries and queue each one - for( int k = 0x18; k < size;) + for( int32_t k = 0x18; k < size;) { uint32_t tmpId = pPlayer->getId(); // replace ids in the entryheader if needed diff --git a/src/servers/Server_Zone/Inventory.cpp b/src/servers/Server_Zone/Inventory.cpp index e6c6e47a..1da5df7a 100644 --- a/src/servers/Server_Zone/Inventory.cpp +++ b/src/servers/Server_Zone/Inventory.cpp @@ -242,7 +242,7 @@ void Core::Inventory::updateCurrencyDb() int32_t firstItemPos = -1; std::string query = "UPDATE charaitemcurrency SET "; - for( int i = 0; i <= 11; i++ ) + for( int32_t i = 0; i <= 11; i++ ) { auto currItem = m_inventoryMap[Currency]->getItem( i ); @@ -269,7 +269,7 @@ void Core::Inventory::updateCrystalDb() int32_t firstItemPos = -1; std::string query = "UPDATE charaitemcrystal SET "; - for( int i = 0; i <= 11; i++ ) + for( int32_t i = 0; i <= 11; i++ ) { auto currItem = m_inventoryMap[Crystal]->getItem( i ); @@ -294,7 +294,7 @@ void Core::Inventory::updateBagDb( InventoryType type ) { std::string query = "UPDATE charaiteminventory SET "; - for( int i = 0; i <= 34; i++ ) + for( int32_t i = 0; i <= 34; i++ ) { auto currItem = m_inventoryMap[type]->getItem( i ); @@ -377,7 +377,7 @@ void Core::Inventory::updateMannequinDb( InventoryType type ) { std::string query = "UPDATE charaitemgearset SET "; - for( int i = 0; i <= 13; i++ ) + for( int32_t i = 0; i <= 13; i++ ) { auto currItem = m_inventoryMap[type]->getItem( i ); @@ -671,7 +671,7 @@ bool Core::Inventory::load() { uint16_t storageId = field[0].getUInt16(); - for( int i = 1; i <= 14; i++ ) + for( int32_t i = 1; i <= 14; i++ ) { uint64_t uItemId = field[i].getUInt64(); if( uItemId == 0 ) @@ -708,7 +708,7 @@ bool Core::Inventory::load() do { uint16_t storageId = bagField[0].getUInt16(); - for( int i = 1; i <= 25; i++ ) + for( int32_t i = 1; i <= 25; i++ ) { uint64_t uItemId = bagField[i].getUInt64(); if( uItemId == 0 ) @@ -741,7 +741,7 @@ bool Core::Inventory::load() do { uint16_t storageId = curField[0].getUInt16(); - for( int i = 1; i <= 12; i++ ) + for( int32_t i = 1; i <= 12; i++ ) { uint64_t uItemId = curField[i].getUInt64(); if( uItemId == 0 ) @@ -775,7 +775,7 @@ bool Core::Inventory::load() do { uint16_t storageId = crystalField[0].getUInt16(); - for( int i = 1; i <= 17; i++ ) + for( int32_t i = 1; i <= 17; i++ ) { uint64_t uItemId = crystalField[i].getUInt64(); if( uItemId == 0 ) @@ -798,7 +798,7 @@ void Core::Inventory::send() { InventoryMap::iterator it; - int count = 0; + int32_t count = 0; for( it = m_inventoryMap.begin(); it != m_inventoryMap.end(); ++it, count++ ) { diff --git a/src/servers/Server_Zone/ItemContainer.cpp b/src/servers/Server_Zone/ItemContainer.cpp index 76d97eb9..0685c0bd 100644 --- a/src/servers/Server_Zone/ItemContainer.cpp +++ b/src/servers/Server_Zone/ItemContainer.cpp @@ -68,7 +68,7 @@ const Core::ItemMap & Core::ItemContainer::getItemMap() const int16_t Core::ItemContainer::getFreeSlot() { - for( unsigned char slotId = 0; slotId < m_size; slotId++ ) + for( uint8_t slotId = 0; slotId < m_size; slotId++ ) { ItemMap::iterator it = m_itemMap.find( slotId ); if( it == m_itemMap.end() || diff --git a/src/servers/Server_Zone/PacketHandlers.cpp b/src/servers/Server_Zone/PacketHandlers.cpp index 95d23962..bba999e2 100644 --- a/src/servers/Server_Zone/PacketHandlers.cpp +++ b/src/servers/Server_Zone/PacketHandlers.cpp @@ -614,7 +614,7 @@ void Core::Network::GameConnection::updatePositionHandler( Core::Network::Packet // } default: { - if( static_cast< int >( IPC_OP_019A.moveBackward ) ) + if( static_cast< int32_t >( IPC_OP_019A.moveBackward ) ) { unk1 = 0xFF; unk2 = 0x06; @@ -999,7 +999,7 @@ void Core::Network::GameConnection::socialListHandler( Core::Network::Packets::G listPacket.data().type = 2; listPacket.data().sequence = count; - int entrysizes = sizeof( listPacket.data().entries ); + int32_t entrysizes = sizeof( listPacket.data().entries ); memset( listPacket.data().entries, 0, sizeof( listPacket.data().entries ) ); listPacket.data().entries[0].bytes[2] = pPlayer->getCurrentZone()->getId(); @@ -1046,7 +1046,7 @@ void Core::Network::GameConnection::socialListHandler( Core::Network::Packets::G std::set::iterator it; - int i = 0x30; + int32_t i = 0x30; for(it = tmpSet.begin(); it != tmpSet.end(); it++) { if((*it)->getId() == pPlayer->getId()) diff --git a/src/servers/Server_Zone/Player.cpp b/src/servers/Server_Zone/Player.cpp index 6a45489d..8703e12b 100644 --- a/src/servers/Server_Zone/Player.cpp +++ b/src/servers/Server_Zone/Player.cpp @@ -462,7 +462,7 @@ void Core::Entity::Player::initSpawnIdQueue() m_freeSpawnIdQueue.pop(); } - for( int i = 1; i < MAX_DISPLAYED_ACTORS; i++ ) + for( int32_t i = 1; i < MAX_DISPLAYED_ACTORS; i++ ) { m_freeSpawnIdQueue.push( i ); } @@ -974,7 +974,7 @@ const uint8_t * Core::Entity::Player::getStateFlags() const bool Core::Entity::Player::hasStateFlag( Core::Common::PlayerStateFlag flag ) const { - int iFlag = static_cast< uint32_t >( flag ); + int32_t iFlag = static_cast< uint32_t >( flag ); uint16_t index; uint8_t value; @@ -985,7 +985,7 @@ bool Core::Entity::Player::hasStateFlag( Core::Common::PlayerStateFlag flag ) co void Core::Entity::Player::setStateFlag( Core::Common::PlayerStateFlag flag ) { - int iFlag = static_cast< uint32_t >( flag ); + int32_t iFlag = static_cast< uint32_t >( flag ); uint16_t index; uint8_t value; @@ -1005,7 +1005,7 @@ void Core::Entity::Player::unsetStateFlag( Core::Common::PlayerStateFlag flag ) if( !hasStateFlag( flag ) ) return; - int iFlag = static_cast< uint32_t >( flag ); + int32_t iFlag = static_cast< uint32_t >( flag ); uint16_t index; uint8_t value; @@ -1381,7 +1381,7 @@ bool Core::Entity::Player::hateListHasMob( Core::Entity::BattleNpcPtr pBNpc ) void Core::Entity::Player::initHateSlotQueue() { m_freeHateSlotQueue = std::queue< uint8_t >(); - for( int i = 1; i < 26; i++ ) + for( int32_t i = 1; i < 26; i++ ) m_freeHateSlotQueue.push( i ); } @@ -1390,7 +1390,7 @@ void Core::Entity::Player::sendHateList() GamePacketNew< FFXIVIpcHateList > hateListPacket( getId() ); hateListPacket.data().numEntries = m_actorIdTohateSlotMap.size(); auto it = m_actorIdTohateSlotMap.begin(); - for( int i = 0; it != m_actorIdTohateSlotMap.end(); ++it, i++ ) + for( int32_t i = 0; it != m_actorIdTohateSlotMap.end(); ++it, i++ ) { hateListPacket.data().entry[i].actorId = it->first; hateListPacket.data().entry[i].hatePercent = 100; diff --git a/src/servers/Server_Zone/PlayerQuest.cpp b/src/servers/Server_Zone/PlayerQuest.cpp index 89e1959d..fd73091d 100644 --- a/src/servers/Server_Zone/PlayerQuest.cpp +++ b/src/servers/Server_Zone/PlayerQuest.cpp @@ -94,7 +94,7 @@ void Core::Entity::Player::finishQuest( uint16_t questId ) setSyncFlag( PlayerSyncFlags::Quests ); setSyncFlag( PlayerSyncFlags::QuestTracker ); - for( int ii = 0; ii < 5; ii++ ) + for( int32_t ii = 0; ii < 5; ii++ ) { if( m_questTracking[ii] == idx ) m_questTracking[ii] = -1; @@ -143,7 +143,7 @@ void Core::Entity::Player::removeQuest( uint16_t questId ) setSyncFlag( PlayerSyncFlags::Quests ); setSyncFlag( PlayerSyncFlags::QuestTracker ); - for( int ii = 0; ii < 5; ii++ ) + for( int32_t ii = 0; ii < 5; ii++ ) { if( m_questTracking[ii] == idx ) m_questTracking[ii] = -1; @@ -1015,7 +1015,7 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint16_t sequence ) setSyncFlag( PlayerSyncFlags::Quests ); setSyncFlag( PlayerSyncFlags::QuestTracker ); - for( int ii = 0; ii < 5; ii++ ) + for( int32_t ii = 0; ii < 5; ii++ ) { if( m_questTracking[ii] == -1 ) { @@ -1033,7 +1033,7 @@ void Core::Entity::Player::sendQuestTracker() { GamePacketNew< FFXIVIpcQuestTracker > trackerPacket( getId() ); - for( int ii = 0; ii < 5; ii++ ) + for( int32_t ii = 0; ii < 5; ii++ ) { if( m_questTracking[ii] >= 0 ) { @@ -1080,7 +1080,7 @@ void Core::Entity::Player::sendQuestInfo() { GamePacketNew< FFXIVIpcQuestActiveList > pe_qa( getId() ); - for( int i = 0; i < 30; i++ ) + for( int32_t i = 0; i < 30; i++ ) { uint8_t offset = i * 12; if( m_activeQuests[i] != nullptr ) diff --git a/src/servers/Server_Zone/PlayerSql.cpp b/src/servers/Server_Zone/PlayerSql.cpp index 4090ae40..bbd7b1ac 100644 --- a/src/servers/Server_Zone/PlayerSql.cpp +++ b/src/servers/Server_Zone/PlayerSql.cpp @@ -350,7 +350,7 @@ void Core::Entity::Player::createUpdateSql() { charaDetailSet.insert( " QuestCompleteFlags = UNHEX('" + std::string( Util::binaryToHexString( static_cast< uint8_t* >( m_questCompleteFlags ), 200 ) ) + "')" ); - for( int i = 0; i < 30; i++ ) + for( int32_t i = 0; i < 30; i++ ) { if( m_activeQuests[i] != nullptr ) { diff --git a/src/servers/Server_Zone/PlayerStateFlagsPacket.h b/src/servers/Server_Zone/PlayerStateFlagsPacket.h index 7b7f801d..ae0f81b9 100644 --- a/src/servers/Server_Zone/PlayerStateFlagsPacket.h +++ b/src/servers/Server_Zone/PlayerStateFlagsPacket.h @@ -31,7 +31,7 @@ public: for( auto& flag : flags ) { - int iFlag = static_cast< uint32_t >( flag ); + int32_t iFlag = static_cast< uint32_t >( flag ); uint8_t index = iFlag / 8; uint8_t bitIndex = iFlag % 8; diff --git a/src/servers/Server_Zone/ScriptManager.h b/src/servers/Server_Zone/ScriptManager.h index b398d4a4..e4c322de 100644 --- a/src/servers/Server_Zone/ScriptManager.h +++ b/src/servers/Server_Zone/ScriptManager.h @@ -32,7 +32,7 @@ namespace Core ScriptManager(); ~ScriptManager(); - int init(); + int32_t init(); void reload(); const boost::shared_ptr< chaiscript::ChaiScript >& getHandler() const; diff --git a/src/servers/Server_Zone/ServerZone.cpp b/src/servers/Server_Zone/ServerZone.cpp index 6c65dbd8..8b7d331a 100644 --- a/src/servers/Server_Zone/ServerZone.cpp +++ b/src/servers/Server_Zone/ServerZone.cpp @@ -87,7 +87,7 @@ void Core::ServerZone::setServerId( uint16_t serverId ) m_serverId = serverId; } -bool Core::ServerZone::loadSettings( int argc, char* argv[] ) +bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] ) { g_log.info( "Loading config " + m_configPath ); @@ -183,7 +183,7 @@ bool Core::ServerZone::loadSettings( int argc, char* argv[] ) return true; } -void Core::ServerZone::run( int argc, char* argv[] ) +void Core::ServerZone::run( int32_t argc, char* argv[] ) { // TODO: add more error checks for the entire initialisation g_log.setLogPath( "log\\SapphireZone_" + std::to_string( m_serverId ) + "_" ); diff --git a/src/servers/Server_Zone/ServerZone.h b/src/servers/Server_Zone/ServerZone.h index 6b615838..1c95e350 100644 --- a/src/servers/Server_Zone/ServerZone.h +++ b/src/servers/Server_Zone/ServerZone.h @@ -18,7 +18,7 @@ namespace Core { ServerZone( const std::string& configPath, uint16_t serverId = 0 ); ~ServerZone(); - void run( int argc, char* argv[] ); + void run( int32_t argc, char* argv[] ); void setServerId( uint16_t serverId ); uint16_t getServerId() const; @@ -27,7 +27,7 @@ namespace Core { void removeSession( uint32_t sessionId ); void removeSession( std::string playerName ); - bool loadSettings( int argc, char* argv[] ); + bool loadSettings( int32_t argc, char* argv[] ); SessionPtr getSession( uint32_t id ); SessionPtr getSession( std::string playerName ); diff --git a/src/servers/Server_Zone/Zone.cpp b/src/servers/Server_Zone/Zone.cpp index 7070252a..209bae83 100644 --- a/src/servers/Server_Zone/Zone.cpp +++ b/src/servers/Server_Zone/Zone.cpp @@ -564,7 +564,7 @@ bool Zone::isCellActive( uint32_t x, uint32_t y ) return false; } -void Zone::updateCellActivity( uint32_t x, uint32_t y, int radius ) +void Zone::updateCellActivity( uint32_t x, uint32_t y, int32_t radius ) { uint32_t endX = ( x + radius ) <= _sizeX ? x + radius : ( _sizeX - 1 ); @@ -692,8 +692,8 @@ void Zone::changeActorPosition( Entity::ActorPtr pActor ) if( pOldCell != nullptr ) { // only do the second check if theres -/+ 2 difference - if( abs( ( int ) cellX - ( int ) pOldCell->m_posX ) > 2 || - abs( ( int ) cellY - ( int ) pOldCell->m_posY ) > 2 ) + if( abs( ( int32_t ) cellX - ( int32_t ) pOldCell->m_posX ) > 2 || + abs( ( int32_t ) cellY - ( int32_t ) pOldCell->m_posY ) > 2 ) updateCellActivity( pOldCell->m_posX, pOldCell->m_posY, 2 ); } } @@ -728,7 +728,7 @@ void Zone::updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell ) auto iter = pCell->m_actors.begin(); float fRange = 70.0f; - int count = 0; + int32_t count = 0; while( iter != pCell->m_actors.end() ) { pCurAct = *iter; diff --git a/src/servers/Server_Zone/Zone.h b/src/servers/Server_Zone/Zone.h index a1f6a599..162a8a32 100644 --- a/src/servers/Server_Zone/Zone.h +++ b/src/servers/Server_Zone/Zone.h @@ -86,7 +86,7 @@ public: bool isCellActive( uint32_t x, uint32_t y ); - void updateCellActivity( uint32_t x, uint32_t y, int radius ); + void updateCellActivity( uint32_t x, uint32_t y, int32_t radius ); void updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell ); diff --git a/src/servers/Server_Zone/mainGameServer.cpp b/src/servers/Server_Zone/mainGameServer.cpp index 6a9bcdfc..0706dc08 100644 --- a/src/servers/Server_Zone/mainGameServer.cpp +++ b/src/servers/Server_Zone/mainGameServer.cpp @@ -4,7 +4,7 @@ Core::ServerZone g_serverZone( "config/settings_zone.xml" ); -int main( int argc, char* argv[] ) +int main( int32_t argc, char* argv[] ) { // i hate to do this, but we need to set this first... for(auto i = 1; i < argc; ++i ) From 9d87f23caf5ea256d11260c52fe7fb082f2bb1e9 Mon Sep 17 00:00:00 2001 From: Tahir Akhlaq Date: Fri, 11 Aug 2017 23:13:00 +0100 Subject: [PATCH 2/3] fix lobby config, add default values for ip/port, change blowfish back to uintptr_t --- src/servers/Server_Lobby/ServerLobby.cpp | 14 +++++++------- src/servers/Server_Lobby/blowfish.cpp | 2 +- src/servers/Server_Zone/ServerZone.cpp | 7 ++++--- src/servers/Server_Zone/mainGameServer.cpp | 3 ++- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/servers/Server_Lobby/ServerLobby.cpp b/src/servers/Server_Lobby/ServerLobby.cpp index 4d239ac8..1adbe99a 100644 --- a/src/servers/Server_Lobby/ServerLobby.cpp +++ b/src/servers/Server_Lobby/ServerLobby.cpp @@ -21,7 +21,7 @@ #include #include - +#include #include Core::Logger g_log; @@ -91,7 +91,7 @@ namespace Core { try { - arg = std::string( args[i] ); + arg = boost::to_lower_copy( std::string( args[i] ) ); val = std::string( args[i + 1] ); // trim '-' from start of arg @@ -100,7 +100,7 @@ namespace Core { if( arg == "ip" ) { // todo: ip addr in config - m_pConfig->setValue< std::string >( "Settings.General.ListenIP", val ); + m_pConfig->setValue< std::string >( "Settings.General.ListenIp", val ); } else if( arg == "p" || arg == "port" ) { @@ -110,11 +110,11 @@ namespace Core { { m_pConfig->setValue< std::string>( "Settings.General.AuthPort", val ); } - else if( arg == "worldIP" || arg == "worldIp" ) + else if( arg == "worldip" || arg == "worldip" ) { m_pConfig->setValue < std::string >( "Settings.General.WorldIp", val ); } - else if( arg == "worldPort" ) + else if( arg == "worldport" ) { m_pConfig->setValue< std::string >( "Settings.General.WorldPort", val ); } @@ -126,8 +126,8 @@ namespace Core { } } - m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort" ); - m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp" ); + m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort", 54994 ); + m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp", "0.0.0.0" ); g_restConnector.restHost = m_pConfig->getValue< std::string >( "Settings.General.RestHost" ); g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ); diff --git a/src/servers/Server_Lobby/blowfish.cpp b/src/servers/Server_Lobby/blowfish.cpp index 96d3badc..236be5d9 100644 --- a/src/servers/Server_Lobby/blowfish.cpp +++ b/src/servers/Server_Lobby/blowfish.cpp @@ -104,7 +104,7 @@ void BlowFish::initialize (BYTE key[], int32_t keybytes) int32_t v10 = keybytes; - int32_t v9 = (int32_t)key; + int32_t v9 = (uintptr_t)key; int32_t v8 = 0; int32_t v11 = 0; do { diff --git a/src/servers/Server_Zone/ServerZone.cpp b/src/servers/Server_Zone/ServerZone.cpp index 8b7d331a..2582a9c1 100644 --- a/src/servers/Server_Zone/ServerZone.cpp +++ b/src/servers/Server_Zone/ServerZone.cpp @@ -27,6 +27,7 @@ #include "Forwards.h" #include #include +#include Core::Logger g_log; @@ -120,7 +121,7 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] ) { m_pConfig->setValue< std::string >( "Settings.General.ListenPort", val ); } - else if( arg == "exdPath" || arg == "dataPath" ) + else if( arg == "exdpath" || arg == "datapath" ) { m_pConfig->setValue< std::string >( "Settings.General.DataPath", val ); } @@ -175,8 +176,8 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] ) } m_serverId = m_serverId ? m_serverId : m_pConfig->getValue< uint16_t >( "Settings.General.ServerId" ); - m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort" ); - m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp" );; + m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort", 54992 ); + m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp", "0.0.0.0" );; g_log.info( "Server ID: " + std::to_string( m_serverId ) ); diff --git a/src/servers/Server_Zone/mainGameServer.cpp b/src/servers/Server_Zone/mainGameServer.cpp index 0706dc08..c6d6a6f4 100644 --- a/src/servers/Server_Zone/mainGameServer.cpp +++ b/src/servers/Server_Zone/mainGameServer.cpp @@ -1,6 +1,7 @@ #include #include "ServerZone.h" +#include Core::ServerZone g_serverZone( "config/settings_zone.xml" ); @@ -9,7 +10,7 @@ int main( int32_t argc, char* argv[] ) // i hate to do this, but we need to set this first... for(auto i = 1; i < argc; ++i ) { - std::string arg( argv[i] ); + auto arg = boost::to_lower_copy( std::string( argv[i] ) ); // trim '-' from start of arg arg = arg.erase( 0, arg.find_first_not_of( '-' ) ); From 8488e7679fe90ea29d1f7b41d988b84ebb65c46c Mon Sep 17 00:00:00 2001 From: Tahir Akhlaq Date: Fri, 11 Aug 2017 23:15:55 +0100 Subject: [PATCH 3/3] missed a crap from previous commit --- src/servers/Server_Zone/ServerZone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/servers/Server_Zone/ServerZone.cpp b/src/servers/Server_Zone/ServerZone.cpp index 2582a9c1..d670047a 100644 --- a/src/servers/Server_Zone/ServerZone.cpp +++ b/src/servers/Server_Zone/ServerZone.cpp @@ -106,7 +106,7 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] ) try { - arg = std::string( args[i] ); + arg = boost::to_lower_copy( std::string( args[i] ) ); val = std::string( args[i + 1] ); // trim '-' from start of arg