mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 06:27:45 +00:00
mass replace data types to fixed width ones
This commit is contained in:
parent
91d9427100
commit
82af45e561
38 changed files with 129 additions and 129 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 0f6ea9ddd28f3defc69bb92413442c71db48e8b4
|
||||
Subproject commit 23b9c0a154a327b25d700cd6857a4e53bed2e8a1
|
|
@ -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 ) ) )
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
template<class T>
|
||||
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<class T>
|
||||
|
@ -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 );
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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_] ) ) {
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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] );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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<std::tuple<std::string, uint32_t, uint64_t, std::string>> getCharList( char * sId );
|
||||
bool deleteCharacter( char* sId, std::string name );
|
||||
bool checkNameTaken( std::string name );
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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<int32_t>::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<Core::Db::QueryResult> pQR = g_database.query( "SELECT MAX(CharacterId) FROM charabase" );
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ void reloadConfig()
|
|||
void print_request_info( shared_ptr<HttpServer::Request> 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<string>( "sId" );
|
||||
std::string secret = pt.get<string>( "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 )
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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++ )
|
||||
{
|
||||
|
||||
|
|
|
@ -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() ||
|
||||
|
|
|
@ -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<CPlayer*>::iterator it;
|
||||
|
||||
int i = 0x30;
|
||||
int32_t i = 0x30;
|
||||
for(it = tmpSet.begin(); it != tmpSet.end(); it++)
|
||||
{
|
||||
if((*it)->getId() == pPlayer->getId())
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace Core
|
|||
ScriptManager();
|
||||
~ScriptManager();
|
||||
|
||||
int init();
|
||||
int32_t init();
|
||||
void reload();
|
||||
|
||||
const boost::shared_ptr< chaiscript::ChaiScript >& getHandler() const;
|
||||
|
|
|
@ -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 ) + "_" );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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 )
|
||||
|
|
Loading…
Add table
Reference in a new issue