1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-06 10:47:45 +00:00

General warning cleanup 1

* A lot of hit has to do with size_t being unsigned long long in 64 bit.
  - Just explicitly casting for a lot of cases removes the warning
* Good bit are also the differences in struct definitions to match packets and function definitions
  - Also just cast to fix
* Used a lot of #pragma warning( disable : 4244/4267 ) for template warnings
* InviteHandlers.cpp line 118 was definitely a typo bug. Needed assignment "=" instead of "=="
This commit is contained in:
Reyli 2024-06-21 03:01:16 -05:00
parent 1a99b56c8b
commit 9435e6e66a
50 changed files with 107 additions and 105 deletions

View file

@ -292,7 +292,7 @@ namespace xiv::dat
DatBlockHeader block_header = extract< DatBlockHeader >( m_handle ); DatBlockHeader block_header = extract< DatBlockHeader >( m_handle );
// Resizing the vector to write directly into it // Resizing the vector to write directly into it
const uint32_t data_size = o_data.size(); const uint32_t data_size = (uint32_t)o_data.size();
o_data.resize( data_size + block_header.uncompressed_size ); o_data.resize( data_size + block_header.uncompressed_size );
// 32000 in compressed_size means it is not compressed so take uncompressed_size // 32000 in compressed_size means it is not compressed so take uncompressed_size
@ -308,7 +308,7 @@ namespace xiv::dat
m_handle.read( temp_buffer.data(), block_header.compressed_size ); m_handle.read( temp_buffer.data(), block_header.compressed_size );
utils::zlib::no_header_decompress( reinterpret_cast<uint8_t*>(temp_buffer.data()), utils::zlib::no_header_decompress( reinterpret_cast<uint8_t*>(temp_buffer.data()),
temp_buffer.size(), (uint32_t)temp_buffer.size(),
reinterpret_cast<uint8_t*>(o_data.data() + data_size), reinterpret_cast<uint8_t*>(o_data.data() + data_size),
block_header.uncompressed_size ); block_header.uncompressed_size );
} }

View file

@ -258,7 +258,7 @@ struct SGB_FILE
if( stateCount > 0 ) if( stateCount > 0 )
{ {
stateCount = stateCount; stateCount = stateCount;
for( int i = 0; i < stateCount; ++i ) for( uint32_t i = 0; i < stateCount; ++i )
{ {
auto state = SGB_STATE_ENTRY( buf + baseOffset + header.statesOffset + 8 + i * sizeof( SGB_STATE_HEADER ) ); auto state = SGB_STATE_ENTRY( buf + baseOffset + header.statesOffset + 8 + i * sizeof( SGB_STATE_HEADER ) );
stateEntries.push_back( state ); stateEntries.push_back( state );

View file

@ -238,7 +238,7 @@ namespace xiv::exd
std::map< ExdRow, std::vector< Field >, exdRowSort > data; std::map< ExdRow, std::vector< Field >, exdRowSort > data;
// Iterates over all the cached ids // Iterates over all the cached ids
const uint32_t memberCount = _exh->get_members().size(); const uint32_t memberCount = (uint32_t)_exh->get_members().size();
for( auto& cacheEntry : _idCache ) for( auto& cacheEntry : _idCache )
{ {
std::vector< char > dataCpy = cacheEntry.second.file->get_data_sections().front(); std::vector< char > dataCpy = cacheEntry.second.file->get_data_sections().front();
@ -249,7 +249,7 @@ namespace xiv::exd
for( int32_t i = 0; i < cacheEntry.second.subRows; i++ ) for( int32_t i = 0; i < cacheEntry.second.subRows; i++ )
{ {
// Get the vector fields for the given record and preallocate it // Get the vector fields for the given record and preallocate it
ExdRow row = { cacheEntry.first, i }; ExdRow row = { cacheEntry.first, (uint8_t)i };
auto& fields = data[ row ]; auto& fields = data[ row ];
fields.reserve( memberCount ); fields.reserve( memberCount );

View file

@ -273,8 +273,8 @@ namespace xiv::dat
std::string filenamePart = pathLower.substr( lastSlashPos + 1 ); std::string filenamePart = pathLower.substr( lastSlashPos + 1 );
// Get the crc32 values from zlib, to compensate the final XOR 0xFFFFFFFF that isnot done in the exe we just reXOR // Get the crc32 values from zlib, to compensate the final XOR 0xFFFFFFFF that isnot done in the exe we just reXOR
dirHash = crc32( 0, reinterpret_cast<const uint8_t*>( dirPart.data() ), dirPart.size() ) ^ 0xFFFFFFFF; dirHash = crc32( 0, reinterpret_cast<const uint8_t*>( dirPart.data() ), (uInt)dirPart.size() ) ^ 0xFFFFFFFF;
filenameHash = crc32( 0, reinterpret_cast<const uint8_t*>( filenamePart.data() ), filenamePart.size() ) ^ 0xFFFFFFFF; filenameHash = crc32( 0, reinterpret_cast<const uint8_t*>( filenamePart.data() ), (uInt)filenamePart.size() ) ^ 0xFFFFFFFF;
} }
void GameData::createCategory( uint32_t catNum ) void GameData::createCategory( uint32_t catNum )

View file

@ -101,7 +101,7 @@ namespace xiv::utils::crc32
void generate_hashes_1( std::string& i_format, const uint32_t i_first_index, std::vector< uint32_t >& o_hashes ) void generate_hashes_1( std::string& i_format, const uint32_t i_first_index, std::vector< uint32_t >& o_hashes )
{ {
char* str = const_cast<char*>(i_format.data()); char* str = const_cast<char*>(i_format.data());
const uint32_t str_size = i_format.size(); const uint32_t str_size = (uint32_t)i_format.size();
o_hashes.resize( 10000 ); o_hashes.resize( 10000 );
@ -130,7 +130,7 @@ namespace xiv::utils::crc32
std::vector< uint32_t >& o_hashes ) std::vector< uint32_t >& o_hashes )
{ {
char* str = const_cast<char*>(i_format.data()); char* str = const_cast<char*>(i_format.data());
const uint32_t str_size = i_format.size(); const uint32_t str_size = (uint32_t)i_format.size();
o_hashes.resize( 100000000 ); o_hashes.resize( 100000000 );

View file

@ -10,11 +10,11 @@ namespace xiv::utils::zlib
void compress( const std::vector< char >& in, std::vector< char >& out ) void compress( const std::vector< char >& in, std::vector< char >& out )
{ {
// Fetching upper bound for out size // Fetching upper bound for out size
auto out_size = compressBound( in.size() ); auto out_size = compressBound( (uLong)in.size() );
out.resize( out_size ); out.resize( out_size );
auto ret = compress2( reinterpret_cast<uint8_t*>(out.data()), &out_size, auto ret = compress2( reinterpret_cast<uint8_t*>(out.data()), &out_size,
reinterpret_cast<const uint8_t*>(in.data()), in.size(), Z_BEST_COMPRESSION ); reinterpret_cast<const uint8_t*>(in.data()), (uLong)in.size(), Z_BEST_COMPRESSION );
if( ret != Z_OK ) if( ret != Z_OK )
{ {

View file

@ -165,7 +165,7 @@ bool Mysql::Connection::getAutoCommit()
{ {
// TODO: should be replaced with wrapped sql query function once available // TODO: should be replaced with wrapped sql query function once available
std::string query("SELECT @@autocommit"); std::string query("SELECT @@autocommit");
auto res = mysql_real_query( m_pRawCon, query.c_str(), query.length() ); auto res = mysql_real_query( m_pRawCon, query.c_str(), (unsigned long)query.length() );
if( res != 0 ) if( res != 0 )
throw std::runtime_error( "Query failed!" ); throw std::runtime_error( "Query failed!" );
@ -237,7 +237,7 @@ std::shared_ptr< Mysql::PreparedStatement > Mysql::Connection::prepareStatement(
if( !stmt ) if( !stmt )
throw std::runtime_error( "Could not init prepared statement: " + getError() ); throw std::runtime_error( "Could not init prepared statement: " + getError() );
if( mysql_stmt_prepare( stmt, sql.c_str(), sql.size() ) ) if( mysql_stmt_prepare( stmt, sql.c_str(), (unsigned long)sql.size() ) )
throw std::runtime_error( "Could not prepare statement: " + getError() ); throw std::runtime_error( "Could not prepare statement: " + getError() );
return std::make_shared< PreparedStatement >( stmt, shared_from_this() ); return std::make_shared< PreparedStatement >( stmt, shared_from_this() );

View file

@ -77,7 +77,7 @@ struct LongDataSender
while( sent < str->length() ) while( sent < str->length() )
{ {
chunkSize = ( sent + MAX_SEND_LONGDATA_CHUNK > str->length() chunkSize = (uint32_t)( sent + MAX_SEND_LONGDATA_CHUNK > str->length()
? str->length() - sent ? str->length() - sent
: MAX_SEND_LONGDATA_CHUNK ); : MAX_SEND_LONGDATA_CHUNK );

View file

@ -17,7 +17,7 @@ Mysql::Statement::Statement( std::shared_ptr< Mysql::Connection > conn ) :
void Mysql::Statement::doQuery( const std::string &q ) void Mysql::Statement::doQuery( const std::string &q )
{ {
mysql_real_query( m_pConnection->getRawCon(), q.c_str(), q.length() ); mysql_real_query( m_pConnection->getRawCon(), q.c_str(), (unsigned long)q.length() );
if( errNo() ) if( errNo() )
throw std::runtime_error( m_pConnection->getError() ); throw std::runtime_error( m_pConnection->getError() );

View file

@ -114,7 +114,7 @@ int SapphireApi::createCharacter( const uint32_t accountId, const std::string& n
const char* ptr = infoJson.c_str() + 50; const char* ptr = infoJson.c_str() + 50;
std::string lookPart( ptr ); std::string lookPart( ptr );
int32_t pos = lookPart.find_first_of( "]" ); int32_t pos = (int32_t)lookPart.find_first_of( "]" );
if( pos != std::string::npos ) if( pos != std::string::npos )
{ {
lookPart = lookPart.substr( 0, pos + 1 ); lookPart = lookPart.substr( 0, pos + 1 );

View file

@ -24,6 +24,8 @@ namespace Sapphire::Common
template< class T > template< class T >
T getValue( const std::string& section, const std::string& name, T defaultValue = T() ) T getValue( const std::string& section, const std::string& name, T defaultValue = T() )
{ {
#pragma warning( push )
#pragma warning( disable : 4244 )
if constexpr ( std::is_same_v< T, uint32_t > ) if constexpr ( std::is_same_v< T, uint32_t > )
return m_pInih->GetInteger( section, name, defaultValue ); return m_pInih->GetInteger( section, name, defaultValue );
else if constexpr ( std::is_same_v< T, int32_t > ) else if constexpr ( std::is_same_v< T, int32_t > )
@ -48,6 +50,7 @@ namespace Sapphire::Common
return m_pInih->GetBoolean( section, name, defaultValue ); return m_pInih->GetBoolean( section, name, defaultValue );
else else
static_assert( always_false< T >::value, "non-exhaustive getter!" ); static_assert( always_false< T >::value, "non-exhaustive getter!" );
#pragma warning( pop )
} }
template< class T > template< class T >

View file

@ -89,7 +89,7 @@ std::string Sapphire::Common::Util::base64Encode( uint8_t const* bytes_to_encode
std::string Sapphire::Common::Util::base64Decode( std::string const& encoded_string ) std::string Sapphire::Common::Util::base64Decode( std::string const& encoded_string )
{ {
int32_t in_len = encoded_string.size(); int32_t in_len = (int32_t)encoded_string.size();
int32_t i = 0; int32_t i = 0;
int32_t j = 0; int32_t j = 0;
int32_t in_ = 0; int32_t in_ = 0;

View file

@ -131,7 +131,7 @@ void Sapphire::Db::DbWorkerPool< T >::escapeString( std::string& str )
return; return;
char* buf = new char[str.size() * 2 + 1]; char* buf = new char[str.size() * 2 + 1];
escapeString( buf, str.c_str(), str.size() ); escapeString( buf, str.c_str(), (unsigned long)str.size() );
str = buf; str = buf;
delete[] buf; delete[] buf;
} }

View file

@ -73,7 +73,7 @@ PacketParseResult Network::Packets::getPackets( const std::vector< uint8_t >& bu
std::vector< uint8_t > outBuf; std::vector< uint8_t > outBuf;
outBuf.resize( packetHeader.oodleDecompressedSize ); outBuf.resize( packetHeader.oodleDecompressedSize );
bool oodleSuccess = oodle->oodleDecode( inBuf, bytesExpected, outBuf, packetHeader.oodleDecompressedSize ); bool oodleSuccess = oodle->oodleDecode( inBuf, (uint32_t)bytesExpected, outBuf, packetHeader.oodleDecompressedSize );
if( !oodleSuccess ) if( !oodleSuccess )
{ {

View file

@ -65,14 +65,14 @@ void Network::Packets::PacketContainer::fillSendBuffer( std::vector< uint8_t >&
std::vector< uint8_t > outBuf; std::vector< uint8_t > outBuf;
outBuf.resize( m_ipcHdr.size ); outBuf.resize( m_ipcHdr.size );
auto compLen = oodle->oodleEncode(inBuf, inBuf.size(), outBuf); auto compLen = oodle->oodleEncode(inBuf, (uint32_t)inBuf.size(), outBuf);
// Check if we compressed at all // Check if we compressed at all
if (compLen != m_ipcHdr.size) { if (compLen != m_ipcHdr.size) {
tempBuffer.resize(compLen); tempBuffer.resize(compLen);
memcpy(&inBuf[0], &outBuf[0], compLen); memcpy(&inBuf[0], &outBuf[0], compLen);
m_ipcHdr.oodleDecompressedSize = m_ipcHdr.size; m_ipcHdr.oodleDecompressedSize = m_ipcHdr.size;
m_ipcHdr.size = compLen; m_ipcHdr.size = (uint32_t)compLen;
m_ipcHdr.compressionType = static_cast< uint8_t >(Packets::CompressionType::Oodle); m_ipcHdr.compressionType = static_cast< uint8_t >(Packets::CompressionType::Oodle);
} }
} }

View file

@ -124,7 +124,7 @@ uint64_t Util::getTimeMs()
uint32_t Util::getTimeSeconds() uint32_t Util::getTimeSeconds()
{ {
auto currClock = std::chrono::system_clock::now(); auto currClock = std::chrono::system_clock::now();
return std::chrono::time_point_cast< std::chrono::seconds >( currClock ).time_since_epoch().count(); return (uint32_t)std::chrono::time_point_cast< std::chrono::seconds >( currClock ).time_since_epoch().count();
} }
uint64_t Util::getEorzeanTimeStamp() uint64_t Util::getEorzeanTimeStamp()

View file

@ -470,7 +470,7 @@ void Lobby::GameConnection::handlePackets( const Network::Packets::FFXIVARR_PACK
BlowFish blowfish; BlowFish blowfish;
blowfish.initialize( m_encKey, 0x10 ); blowfish.initialize( m_encKey, 0x10 );
blowfish.Decode( ( uint8_t* ) ( &inPacket.data[ 0 ] ), ( uint8_t* ) ( &inPacket.data[ 0 ] ), blowfish.Decode( ( uint8_t* ) ( &inPacket.data[ 0 ] ), ( uint8_t* ) ( &inPacket.data[ 0 ] ),
( inPacket.data.size() ) - 0x10 ); ( (uint32_t)inPacket.data.size() ) - 0x10 );
} }
switch( inPacket.segHdr.type ) switch( inPacket.segHdr.type )

View file

@ -32,10 +32,10 @@ void LobbyPacketContainer::addPacket( FFXIVPacketBasePtr pEntry )
{ {
BlowFish blowfish; BlowFish blowfish;
blowfish.initialize( m_encKey, 0x10 ); blowfish.initialize( m_encKey, 0x10 );
blowfish.Encode( m_dataBuf + m_header.size + 0x10, m_dataBuf + m_header.size + 0x10, pEntry->getSize() - 0x10 ); blowfish.Encode( m_dataBuf + m_header.size + 0x10, m_dataBuf + m_header.size + 0x10, (uint32_t)pEntry->getSize() - 0x10 );
} }
m_header.size += pEntry->getSize(); m_header.size += (uint32_t)pEntry->getSize();
m_header.count++; m_header.count++;
} }

View file

@ -289,7 +289,7 @@ int Lobby::RestConnector::createCharacter( char* sId, std::string name, std::str
{ {
std::string json_string = std::string json_string =
"{\"sId\": \"" + std::string( sId, 56 ) + "\",\"secret\": \"" + serverSecret + "\",\"name\": \"" + name + "{\"sId\": \"" + std::string( sId, 56 ) + "\",\"secret\": \"" + serverSecret + "\",\"name\": \"" + name +
"\",\"infoJson\": \"" + Common::Util::base64Encode( ( uint8_t* ) infoJson.c_str(), infoJson.length() ) + "\"}"; "\",\"infoJson\": \"" + Common::Util::base64Encode( ( uint8_t* ) infoJson.c_str(), (uint32_t)infoJson.length() ) + "\"}";
HttpResponse r = requestApi( "createCharacter", json_string ); HttpResponse r = requestApi( "createCharacter", json_string );

View file

@ -125,7 +125,7 @@ private:
{ {
if( player.giveQuestRewards( getId(), result.param3 ) ) if( player.giveQuestRewards( getId(), result.param3 ) )
{ {
player.setQuestUI8BH( getId(), result.param3 ); player.setQuestUI8BH( getId(), (uint8_t)result.param3 );
player.finishQuest( getId() ); player.finishQuest( getId() );
} }
} }

View file

@ -77,11 +77,11 @@ struct DiscoveryMap : std::enable_shared_from_this< DiscoveryMap >
{ {
auto ogX = x, ogY = y; auto ogX = x, ogY = y;
int col = ( mapIndex % ( int ) ( ( float ) img.width / ( float ) tileWidth ) ); int col = ( mapIndex % ( int ) ( ( float ) img.width / ( float ) tileWidth ) );
int row = ( mapIndex / ( ( float ) img.width / ( float ) tileWidth ) ); int row = (int)( mapIndex / ( ( float ) img.width / ( float ) tileWidth ) );
x = ( x / 2048.f ) * ( float ) tileWidth; x = ( x / 2048.f ) * ( float ) tileWidth;
y = ( y / 2048.f ) * ( float ) tileWidth; y = ( y / 2048.f ) * ( float ) tileWidth;
int tileX = ( col * ( float ) tileWidth ) + x; int tileX = (int)(( col * ( float ) tileWidth ) + x);
int tileY = ( row * ( float ) tileWidth ) + y; int tileY = (int)(( row * ( float ) tileWidth ) + y);
if( tileX < 0 || tileY < 0 || tileY > img.data.size() - 1 || tileX > img.data[ 0 ].size() - 1 ) if( tileX < 0 || tileY < 0 || tileY > img.data.size() - 1 || tileX > img.data[ 0 ].size() - 1 )
{ {

View file

@ -63,7 +63,7 @@ struct Image
data[ y ].resize( entries ); data[ y ].resize( entries );
offset += 8; offset += 8;
for( auto x = 0; x < entries; ++x ) for( uint32_t x = 0; x < entries; ++x )
data[ y ][ x ] = *reinterpret_cast< uint32_t* >( buf + offset + ( x * 4 ) ); data[ y ][ x ] = *reinterpret_cast< uint32_t* >( buf + offset + ( x * 4 ) );
offset += entries * 4; offset += entries * 4;
} }
@ -254,9 +254,9 @@ Image DecodeTexDXT1( const TEX_FILE& tex, uint32_t offset, uint32_t targetHeight
Image img( targetHeight, targetWidth ); Image img( targetHeight, targetWidth );
for( int y = 0; y < compressedHeight; y++ ) for( uint32_t y = 0; y < compressedHeight; y++ )
{ {
for( int x = 0; x < compressedWidth; x++ ) for( uint32_t x = 0; x < compressedWidth; x++ )
{ {
const int t0 = *reinterpret_cast< const uint16_t* >( data + pos + 0 ) & 0xffff; const int t0 = *reinterpret_cast< const uint16_t* >( data + pos + 0 ) & 0xffff;
const int t1 = *reinterpret_cast< const uint16_t* >( data + pos + 2 ) & 0xffff; const int t1 = *reinterpret_cast< const uint16_t* >( data + pos + 2 ) & 0xffff;

View file

@ -156,7 +156,7 @@ void loadAllInstanceContentEntries()
if( name.empty() ) if( name.empty() )
continue; continue;
auto i = 0; size_t i = 0;
while( ( i = name.find( ' ' ) ) != std::string::npos ) while( ( i = name.find( ' ' ) ) != std::string::npos )
name = name.replace( name.begin() + i, name.begin() + i + 1, { '_' } ); name = name.replace( name.begin() + i, name.begin() + i + 1, { '_' } );

View file

@ -313,7 +313,7 @@ std::string generateConstructorsDecl( const std::string& exd )
{ {
uint32_t amount = indexCountMap[ count ]; uint32_t amount = indexCountMap[ count ];
for( int i = 0; i < amount; i++ ) for( uint32_t i = 0; i < amount; i++ )
{ {
result += indent + indexToNameMap[ count ] + ".push_back( exdData->getField< " + indexToTypeMap[ count ] + result += indent + indexToNameMap[ count ] + ".push_back( exdData->getField< " + indexToTypeMap[ count ] +

View file

@ -34,7 +34,7 @@ public:
if( num == 0 ) if( num == 0 )
num = std::thread::hardware_concurrency() - 1; num = std::thread::hardware_concurrency() - 1;
for( auto i = 0; i < num; ++i ) for( unsigned int i = 0; i < num; ++i )
{ {
m_workers.push_back( std::async( std::launch::async, [this]{ run(); } ) ); m_workers.push_back( std::async( std::launch::async, [this]{ run(); } ) );
} }

View file

@ -34,7 +34,7 @@ public:
if( num == 0 ) if( num == 0 )
num = std::thread::hardware_concurrency() - 1; num = std::thread::hardware_concurrency() - 1;
for( auto i = 0; i < num; ++i ) for( unsigned int i = 0; i < num; ++i )
{ {
m_workers.push_back( std::async( std::launch::async, [this]{ run(); } ) ); m_workers.push_back( std::async( std::launch::async, [this]{ run(); } ) );
} }

View file

@ -329,7 +329,7 @@ int main( int argc, char** argv )
Logger::info( "Export in progress" ); Logger::info( "Export in progress" );
uint32_t updateInterval = rows.size() / 20; uint32_t updateInterval = (uint32_t)rows.size() / 20;
uint32_t i = 0; uint32_t i = 0;
for( const auto& row : rows ) for( const auto& row : rows )
{ {
@ -386,7 +386,7 @@ int main( int argc, char** argv )
{ {
std::string entry( &section[ offset ] ); std::string entry( &section[ offset ] );
offset += entry.size() + 1; offset += (uint32_t)entry.size() + 1;
if( entry.size() > 3 if( entry.size() > 3
&& entry.find_first_not_of( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_-" ) == && entry.find_first_not_of( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_-" ) ==

View file

@ -122,7 +122,7 @@ int main( int argc, char* argv[] )
} }
catch( const std::exception& ex ) catch( const std::exception& ex )
{ {
(void)ex; // suppress unused variable warning
} }
} }

View file

@ -1572,9 +1572,9 @@ bool Sapphire::Entity::Player::hateListHasEntry( BNpcPtr pBNpc )
void Sapphire::Entity::Player::sendHateList() void Sapphire::Entity::Player::sendHateList()
{ {
auto hateListPacket = makeZonePacket< FFXIVIpcHateList >( getId() ); auto hateListPacket = makeZonePacket< FFXIVIpcHateList >( getId() );
hateListPacket->data().numEntries = m_actorIdTohateSlotMap.size(); hateListPacket->data().numEntries = (uint32_t)m_actorIdTohateSlotMap.size();
auto hateRankPacket = makeZonePacket< FFXIVIpcHateRank >( getId() ); auto hateRankPacket = makeZonePacket< FFXIVIpcHateRank >( getId() );
hateRankPacket->data().numEntries = m_actorIdTohateSlotMap.size(); hateRankPacket->data().numEntries = (uint32_t)m_actorIdTohateSlotMap.size();
auto it = m_actorIdTohateSlotMap.begin(); auto it = m_actorIdTohateSlotMap.begin();
for( int32_t i = 0; it != m_actorIdTohateSlotMap.end(); ++it, i++ ) for( int32_t i = 0; it != m_actorIdTohateSlotMap.end(); ++it, i++ )
{ {
@ -1759,7 +1759,7 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) ); effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
Common::EffectEntry entry{}; Common::EffectEntry entry{};
entry.value = damage.first; entry.value = (int16_t)damage.first;
entry.effectType = Common::ActionEffectType::Damage; entry.effectType = Common::ActionEffectType::Damage;
entry.param0 = static_cast< uint8_t >( damage.second ); entry.param0 = static_cast< uint8_t >( damage.second );
entry.param2 = 0x72; entry.param2 = 0x72;
@ -1774,7 +1774,7 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) ); effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
Common::EffectEntry entry{}; Common::EffectEntry entry{};
entry.value = damage.first; entry.value = (int16_t)damage.first;
entry.effectType = Common::ActionEffectType::Damage; entry.effectType = Common::ActionEffectType::Damage;
entry.param0 = static_cast< uint8_t >( damage.second ); entry.param0 = static_cast< uint8_t >( damage.second );
entry.param2 = 0x73; entry.param2 = 0x73;
@ -1785,7 +1785,7 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
} }
pTarget->takeDamage( damage.first ); pTarget->takeDamage( (uint32_t)damage.first );
} }

View file

@ -338,7 +338,7 @@ void Sapphire::Entity::Player::playScene16( uint32_t eventId, uint32_t scene, ui
eventPlay16->data().scene = scene; eventPlay16->data().scene = scene;
eventPlay16->data().flags = flags; eventPlay16->data().flags = flags;
eventPlay16->data().param3 = param3; eventPlay16->data().param3 = param3;
eventPlay16->data().paramSize = paramList.size(); eventPlay16->data().paramSize = (uint8_t)paramList.size();
int i = 0; int i = 0;
for( auto p : paramList ) for( auto p : paramList )
{ {

View file

@ -1032,13 +1032,13 @@ Sapphire::ItemPtr Sapphire::Entity::Player::dropInventoryItem( Sapphire::Common:
{ {
auto& container = m_storageMap[ type ]; auto& container = m_storageMap[ type ];
auto item = container->getItem( slotId ); auto item = container->getItem( (uint8_t)slotId );
if( !item ) if( !item )
return nullptr; return nullptr;
// unlink item // unlink item
container->removeItem( slotId, false ); container->removeItem((uint8_t)slotId, false );
updateContainer( type, slotId, nullptr ); updateContainer( type, (uint8_t)slotId, nullptr );
if( !silent ) if( !silent )
{ {
@ -1079,7 +1079,7 @@ bool Sapphire::Entity::Player::getFreeInventoryContainerSlot( Inventory::Invento
for( uint16_t idx = 0; idx < container->getMaxSize(); idx++ ) for( uint16_t idx = 0; idx < container->getMaxSize(); idx++ )
{ {
auto item = container->getItem( idx ); auto item = container->getItem((uint8_t)idx );
if( !item ) if( !item )
{ {
containerPair = std::make_pair( bagId, idx ); containerPair = std::make_pair( bagId, idx );
@ -1094,7 +1094,7 @@ bool Sapphire::Entity::Player::getFreeInventoryContainerSlot( Inventory::Invento
void Sapphire::Entity::Player::insertInventoryItem( Sapphire::Common::InventoryType type, uint16_t slot, void Sapphire::Entity::Player::insertInventoryItem( Sapphire::Common::InventoryType type, uint16_t slot,
const Sapphire::ItemPtr item ) const Sapphire::ItemPtr item )
{ {
updateContainer( type, slot, item ); updateContainer( type, (uint8_t)slot, item );
auto slotUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(), slot, type, *item ); auto slotUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(), slot, type, *item );
queuePacket( slotUpdate ); queuePacket( slotUpdate );

View file

@ -527,7 +527,7 @@ void Sapphire::Entity::Player::updateDbMonsterNote()
auto stmt = db.getPreparedStatement( Db::CHARA_MONSTERNOTE_UP ); auto stmt = db.getPreparedStatement( Db::CHARA_MONSTERNOTE_UP );
//std::array< std::vector< uint8_t >, 12 > vectors; //std::array< std::vector< uint8_t >, 12 > vectors;
std::vector< uint8_t > vector( 41 ); std::vector< uint8_t > vector( 41 );
for( std::size_t i = 0; i < m_huntingLogEntries.size(); ++i ) for( uint8_t i = 0; i < m_huntingLogEntries.size(); ++i )
{ {
vector[ 0 ] = m_huntingLogEntries[ i ].rank; vector[ 0 ] = m_huntingLogEntries[ i ].rank;

View file

@ -67,12 +67,12 @@ const Sapphire::ItemMap& Sapphire::ItemContainer::getItemMap() const
int8_t Sapphire::ItemContainer::getFreeSlot() int8_t Sapphire::ItemContainer::getFreeSlot()
{ {
for( uint16_t slotId = 0; slotId < m_size; slotId++ ) for( uint8_t slotId = 0; slotId < m_size; slotId++ )
{ {
ItemMap::iterator it = m_itemMap.find( slotId ); ItemMap::iterator it = m_itemMap.find( slotId );
if( it == m_itemMap.end() || if( it == m_itemMap.end() ||
it->second == nullptr ) it->second == nullptr )
return slotId; return (int8_t)slotId;
} }
return -1; return -1;
} }

View file

@ -446,7 +446,7 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
{ {
uint8_t values[15]; uint8_t values[15];
std::memset( values, 0, sizeof( values ) ); std::memset( values, 0, sizeof( values ) );
sscanf( params.c_str(), "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d", sscanf( params.c_str(), "%hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu %hhu",
&values[ 0 ], &values[ 1 ], &values[ 2 ], &values[ 3 ], &values[ 4 ], &values[ 0 ], &values[ 1 ], &values[ 2 ], &values[ 3 ], &values[ 4 ],
&values[ 5 ], &values[ 6 ], &values[ 7 ], &values[ 8 ], &values[ 9 ], &values[ 5 ], &values[ 6 ], &values[ 7 ], &values[ 8 ], &values[ 9 ],
&values[ 10 ], &values[ 11 ], &values[ 12 ], &values[ 13 ], &values[ 14 ] ); &values[ 10 ], &values[ 11 ], &values[ 12 ], &values[ 13 ], &values[ 14 ] );
@ -686,7 +686,7 @@ void Sapphire::World::Manager::DebugCommandMgr::get( char* data, Entity::Player&
} }
else if( ( subCommand == "poprange" ) ) else if( ( subCommand == "poprange" ) )
{ {
uint32_t id, param; uint32_t id;
sscanf( params.c_str(), "%u", &id ); sscanf( params.c_str(), "%u", &id );
auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref(); auto& instanceObjectCache = Common::Service< InstanceObjectCache >::ref();

View file

@ -89,7 +89,7 @@ bool Sapphire::World::Manager::HousingMgr::init()
{ {
auto count = landSet.second.size(); auto count = landSet.second.size();
houseCount += count; houseCount += (uint32_t)count;
if( landSet.second.size() != 60 ) if( landSet.second.size() != 60 )
{ {
@ -810,7 +810,7 @@ void Sapphire::World::Manager::HousingMgr::requestEstateEditGuestAccess( Entity:
if( !hZone ) if( !hZone )
return; return;
auto land = hZone->getLand( ident.landId ); auto land = hZone->getLand( (uint8_t)ident.landId );
if( !land ) if( !land )
return; return;
@ -1295,6 +1295,7 @@ bool Sapphire::World::Manager::HousingMgr::moveInternalItem( Entity::Player& pla
} }
catch( const std::out_of_range& ex ) catch( const std::out_of_range& ex )
{ {
(void)ex; // suppress unused var warning
return false; return false;
} }
@ -1702,7 +1703,7 @@ void Sapphire::World::Manager::HousingMgr::editAppearance( bool isInterior, Sapp
updateHouseModels( land->getHouse() ); updateHouseModels( land->getHouse() );
if( !isInterior ) if( !isInterior )
{ {
terri->sendLandUpdate( landIdent.landId ); terri->sendLandUpdate( (uint8_t)landIdent.landId );
} }
} }
@ -1758,11 +1759,11 @@ void Sapphire::World::Manager::HousingMgr::removeHouse( Entity::Player& player,
land->setStatus( HouseStatus::Sold ); land->setStatus( HouseStatus::Sold );
land->updateLandDb(); land->updateLandDb();
terri->sendLandUpdate( plot ); terri->sendLandUpdate( (uint8_t)plot );
player.setLandFlags( LandFlagsSlot::Private, 0, land->getLandIdent() ); player.setLandFlags( LandFlagsSlot::Private, 0, land->getLandIdent() );
terri->removeEstateEntranceEObj( plot ); terri->removeEstateEntranceEObj((uint8_t)plot );
// missing reply for ClientTrigger RequestEstateHallRemoval // missing reply for ClientTrigger RequestEstateHallRemoval
} }

View file

@ -620,7 +620,7 @@ void Sapphire::World::Manager::MapMgr::sendPackets( Entity::Player& player, Even
if( mapData.size() <= 2 ) if( mapData.size() <= 2 )
{ {
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate >( player.getId() ); auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate >( player.getId() );
mapUpdatePacket->data().entryCount = mapData.size(); mapUpdatePacket->data().entryCount = (uint8_t)mapData.size();
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds ); fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds );
@ -629,7 +629,7 @@ void Sapphire::World::Manager::MapMgr::sendPackets( Entity::Player& player, Even
else if( mapData.size() <= 4 ) else if( mapData.size() <= 4 )
{ {
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate4 >( player.getId() ); auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate4 >( player.getId() );
mapUpdatePacket->data().entryCount = mapData.size(); mapUpdatePacket->data().entryCount = (uint8_t)mapData.size();
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds ); fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds );
@ -638,7 +638,7 @@ void Sapphire::World::Manager::MapMgr::sendPackets( Entity::Player& player, Even
else if( mapData.size() <= 8 ) else if( mapData.size() <= 8 )
{ {
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate8 >( player.getId() ); auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate8 >( player.getId() );
mapUpdatePacket->data().entryCount = mapData.size(); mapUpdatePacket->data().entryCount = (uint8_t)mapData.size();
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds ); fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds );
@ -647,7 +647,7 @@ void Sapphire::World::Manager::MapMgr::sendPackets( Entity::Player& player, Even
else if( mapData.size() <= 16 ) else if( mapData.size() <= 16 )
{ {
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate16 >( player.getId() ); auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate16 >( player.getId() );
mapUpdatePacket->data().entryCount = mapData.size(); mapUpdatePacket->data().entryCount = (uint8_t)mapData.size();
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds ); fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds );
@ -656,7 +656,7 @@ void Sapphire::World::Manager::MapMgr::sendPackets( Entity::Player& player, Even
else if( mapData.size() <= 32 ) else if( mapData.size() <= 32 )
{ {
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate32 >( player.getId() ); auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate32 >( player.getId() );
mapUpdatePacket->data().entryCount = mapData.size(); mapUpdatePacket->data().entryCount = (uint8_t)mapData.size();
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds ); fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds );
@ -665,7 +665,7 @@ void Sapphire::World::Manager::MapMgr::sendPackets( Entity::Player& player, Even
else if( mapData.size() <= 64 ) else if( mapData.size() <= 64 )
{ {
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate64 >( player.getId() ); auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate64 >( player.getId() );
mapUpdatePacket->data().entryCount = mapData.size(); mapUpdatePacket->data().entryCount = (uint8_t)mapData.size();
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds ); fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds );
@ -674,7 +674,7 @@ void Sapphire::World::Manager::MapMgr::sendPackets( Entity::Player& player, Even
else if( mapData.size() <= 128 ) else if( mapData.size() <= 128 )
{ {
auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate128 >( player.getId() ); auto mapUpdatePacket = makeZonePacket< FFXIVIpcMapUpdate128 >( player.getId() );
mapUpdatePacket->data().entryCount = mapData.size(); mapUpdatePacket->data().entryCount = (uint8_t)mapData.size();
fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds ); fillPacket( mapData, mapUpdatePacket->data().iconIds, mapUpdatePacket->data().levelIds, mapUpdatePacket->data().eventIds );

View file

@ -27,7 +27,7 @@ void Sapphire::World::Manager::PlayerMgr::movePlayerToLandDestination( Sapphire:
if( terriMgr.isHousingTerritory( terriPos->getTargetZoneId() ) ) if( terriMgr.isHousingTerritory( terriPos->getTargetZoneId() ) )
{ {
auto& housingMgr = Common::Service< HousingMgr >::ref(); auto& housingMgr = Common::Service< HousingMgr >::ref();
auto landSetId = housingMgr.toLandSetId( terriPos->getTargetZoneId(), param ); auto landSetId = housingMgr.toLandSetId( terriPos->getTargetZoneId(), (uint8_t)param );
auto housingZone = housingMgr.getHousingZoneByLandSetId( landSetId ); auto housingZone = housingMgr.getHousingZoneByLandSetId( landSetId );

View file

@ -52,7 +52,7 @@ bool Sapphire::World::Manager::ShopMgr::purchaseGilShopItem( Entity::Player& pla
bool Sapphire::World::Manager::ShopMgr::shopSellItem( Sapphire::Entity::Player& player, uint32_t shopId, uint16_t containerId, uint16_t slotId ) bool Sapphire::World::Manager::ShopMgr::shopSellItem( Sapphire::Entity::Player& player, uint32_t shopId, uint16_t containerId, uint16_t slotId )
{ {
auto item = player.getItemAt( containerId, slotId ); auto item = player.getItemAt( containerId, (uint8_t)slotId );
if( item ) if( item )
{ {
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref(); auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();

View file

@ -475,7 +475,7 @@ Sapphire::TerritoryPtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousi
if( !parentZone ) if( !parentZone )
return nullptr; return nullptr;
auto land = parentZone->getLand( landIdent.landId ); auto land = parentZone->getLand( (uint8_t)landIdent.landId );
if( !land ) if( !land )
return nullptr; return nullptr;

View file

@ -205,7 +205,7 @@ float CalcStats::directHitProbability( const Chara& chara )
const auto& baseStats = chara.getStats(); const auto& baseStats = chara.getStats();
auto level = chara.getLevel(); auto level = chara.getLevel();
float dhRate = chara.getStatValue( Common::BaseParam::DirectHitRate ); float dhRate = (float)chara.getStatValue( Common::BaseParam::DirectHitRate );
auto divVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::DIV ] ); auto divVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::DIV ] );
auto subVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::SUB ] ); auto subVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::SUB ] );
@ -218,7 +218,7 @@ float CalcStats::criticalHitProbability( const Chara& chara )
const auto& baseStats = chara.getStats(); const auto& baseStats = chara.getStats();
auto level = chara.getLevel(); auto level = chara.getLevel();
float chRate = chara.getStatValue( Common::BaseParam::CriticalHit ); float chRate = (float)chara.getStatValue( Common::BaseParam::CriticalHit );
auto divVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::DIV ] ); auto divVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::DIV ] );
auto subVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::SUB ] ); auto subVal = static_cast< float >( levelTable[ level ][ Common::LevelTableEntry::SUB ] );

View file

@ -573,7 +573,7 @@ int32_t Sapphire::World::Navi::NaviProvider::addAgent( Entity::Chara& chara )
std::memset( &params, 0, sizeof( params ) ); std::memset( &params, 0, sizeof( params ) );
params.height = 3.f; params.height = 3.f;
params.maxAcceleration = 25.f; params.maxAcceleration = 25.f;
params.maxSpeed = std::pow( 2, chara.getRadius() * 0.35f ) + 1.f; params.maxSpeed = (float)std::pow( 2, chara.getRadius() * 0.35f ) + 1.f;
params.radius = ( chara.getRadius() ) * 0.75f; params.radius = ( chara.getRadius() ) * 0.75f;
params.collisionQueryRange = params.radius * 12.0f; params.collisionQueryRange = params.radius * 12.0f;
params.pathOptimizationRange = params.radius * 20.0f; params.pathOptimizationRange = params.radius * 20.0f;
@ -589,7 +589,7 @@ void Sapphire::World::Navi::NaviProvider::updateAgentParameters( Entity::BNpc& b
std::memset( &params, 0, sizeof( params ) ); std::memset( &params, 0, sizeof( params ) );
params.height = 3.f; params.height = 3.f;
params.maxAcceleration = 25.f; params.maxAcceleration = 25.f;
params.maxSpeed = std::pow( 2, bnpc.getRadius() * 0.35f ) + 1.f; params.maxSpeed = (float)std::pow( 2, bnpc.getRadius() * 0.35f ) + 1.f;
if( bnpc.getState() == Entity::BNpcState::Combat || bnpc.getState() == Entity::BNpcState::Retreat ) if( bnpc.getState() == Entity::BNpcState::Combat || bnpc.getState() == Entity::BNpcState::Retreat )
params.maxSpeed *= 2; params.maxSpeed *= 2;
params.radius = ( bnpc.getRadius() ) * 0.75f; params.radius = ( bnpc.getRadius() ) * 0.75f;

View file

@ -328,7 +328,7 @@ void Sapphire::Network::GameConnection::processOutQueue()
} }
pRP.addPacket( pPacket ); pRP.addPacket( pPacket );
totalSize += pPacket->getSize(); totalSize += (int32_t)pPacket->getSize();
// todo: figure out a good max set size and make it configurable // todo: figure out a good max set size and make it configurable
if( totalSize > 10000 ) if( totalSize > 10000 )

View file

@ -154,7 +154,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( const Packets::FFX
} }
case ClientTriggerType::Examine: case ClientTriggerType::Examine:
{ {
uint32_t targetId = p1u64; uint32_t targetId = (uint32_t)p1u64;
examineHandler( player, targetId ); examineHandler( player, targetId );
break; break;
} }

View file

@ -658,13 +658,13 @@ void Sapphire::Network::GameConnection::landRenameHandler( const Packets::FFXIVA
auto& housingMgr = Common::Service< HousingMgr >::ref(); auto& housingMgr = Common::Service< HousingMgr >::ref();
auto landSetId = housingMgr.toLandSetId( packet.data().ident.territoryTypeId, packet.data().ident.wardNum ); auto landSetId = housingMgr.toLandSetId( packet.data().ident.territoryTypeId, (uint8_t)packet.data().ident.wardNum );
auto pZone = housingMgr.getHousingZoneByLandSetId( landSetId ); auto pZone = housingMgr.getHousingZoneByLandSetId( landSetId );
if( !pZone ) if( !pZone )
return; return;
auto pLand = pZone->getLand( packet.data().ident.landId ); auto pLand = pZone->getLand((uint8_t)packet.data().ident.landId );
if( !pLand ) if( !pLand )
return; return;
@ -712,11 +712,11 @@ void Sapphire::Network::GameConnection::reqPlaceHousingItem( const Packets::FFXI
if( data.shouldPlaceItem == 1 ) if( data.shouldPlaceItem == 1 )
{ {
housingMgr.reqPlaceHousingItem( player, data.landId, data.sourceInvContainerId, data.sourceInvSlotId, housingMgr.reqPlaceHousingItem( player, data.landId, data.sourceInvContainerId, (uint8_t)data.sourceInvSlotId,
data.position, data.rotation ); data.position, data.rotation );
} }
else else
housingMgr.reqPlaceItemInStore( player, data.landId, data.sourceInvContainerId, data.sourceInvSlotId ); housingMgr.reqPlaceItemInStore( player, data.landId, data.sourceInvContainerId, (uint8_t)data.sourceInvSlotId );
} }
@ -728,7 +728,7 @@ void Sapphire::Network::GameConnection::reqMoveHousingItem( const Packets::FFXIV
const auto packet = ZoneChannelPacket< Client::FFXIVIpcHousingUpdateObjectPosition >( inPacket ); const auto packet = ZoneChannelPacket< Client::FFXIVIpcHousingUpdateObjectPosition >( inPacket );
const auto& data = packet.data(); const auto& data = packet.data();
housingMgr.reqMoveHousingItem( player, data.ident, data.slot, data.pos, data.rotation ); housingMgr.reqMoveHousingItem( player, data.ident, (uint8_t)data.slot, data.pos, data.rotation );
} }
void Sapphire::Network::GameConnection::housingEditExterior( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player ) void Sapphire::Network::GameConnection::housingEditExterior( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
@ -748,7 +748,7 @@ void Sapphire::Network::GameConnection::housingEditExterior( const Packets::FFXI
slotList.push_back( container != 0x270F ? static_cast< uint8_t >( packet.data().slot[i] ) : 0xFF ); slotList.push_back( container != 0x270F ? static_cast< uint8_t >( packet.data().slot[i] ) : 0xFF );
} }
housingMgr.editAppearance( false, player, terri->getLand( packet.data().landId )->getLandIdent(), containerList, slotList, packet.data().removeFlag ); housingMgr.editAppearance( false, player, terri->getLand( (uint8_t)packet.data().landId )->getLandIdent(), containerList, slotList, packet.data().removeFlag );
} }
void Sapphire::Network::GameConnection::housingEditInterior( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player ) void Sapphire::Network::GameConnection::housingEditInterior( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player )
@ -847,18 +847,18 @@ void Sapphire::Network::GameConnection::inventoryEquipRecommendedItemsHandler( c
if ( fromContainer == Common::GearSet0 ) if ( fromContainer == Common::GearSet0 )
continue; continue;
const auto fromItem = fromSlot == -1 ? nullptr : player.getItemAt( fromContainer, fromSlot ); const auto fromItem = fromSlot == -1 ? nullptr : player.getItemAt( fromContainer, (uint8_t)fromSlot );
const auto equippedItem = player.getItemAt( Common::GearSet0, slot ); const auto equippedItem = player.getItemAt( Common::GearSet0, slot );
if ( fromItem && equippedItem ) if ( fromItem && equippedItem )
{ {
player.swapItem( fromContainer, fromSlot, Common::GearSet0, slot, slot == 0 || slot == 13 ); player.swapItem( fromContainer, (uint8_t)fromSlot, Common::GearSet0, slot, slot == 0 || slot == 13 );
player.queuePacket( std::make_shared< UpdateInventorySlotPacket >( player.getId(), fromSlot, fromContainer, *equippedItem, 0 ) ); player.queuePacket( std::make_shared< UpdateInventorySlotPacket >( player.getId(), fromSlot, fromContainer, *equippedItem, 0 ) );
player.queuePacket( std::make_shared< UpdateInventorySlotPacket >( player.getId(), slot, Common::GearSet0, *fromItem, 0 ) ); player.queuePacket( std::make_shared< UpdateInventorySlotPacket >( player.getId(), slot, Common::GearSet0, *fromItem, 0 ) );
} }
else if ( fromItem && !equippedItem ) else if ( fromItem && !equippedItem )
{ {
player.moveItem( fromContainer, fromSlot, Common::GearSet0, slot, slot == 0 || slot == 13 ); player.moveItem( fromContainer, (uint8_t)fromSlot, Common::GearSet0, slot, slot == 0 || slot == 13 );
player.queuePacket( std::make_shared< UpdateInventorySlotPacket >( player.getId(), fromSlot, fromContainer, 0 ) ); player.queuePacket( std::make_shared< UpdateInventorySlotPacket >( player.getId(), fromSlot, fromContainer, 0 ) );
player.queuePacket( std::make_shared< UpdateInventorySlotPacket >( player.getId(), slot, Common::GearSet0, *fromItem, 0 ) ); player.queuePacket( std::make_shared< UpdateInventorySlotPacket >( player.getId(), slot, Common::GearSet0, *fromItem, 0 ) );
} }

View file

@ -115,7 +115,7 @@ void Sapphire::Network::GameConnection::socialReplyHandler( const FFXIVARR_PACKE
strcpy( inviteUpPacket->data().name, player.getName().c_str() ); strcpy( inviteUpPacket->data().name, player.getName().c_str() );
pPlayer->queuePacket( inviteUpPacket ); pPlayer->queuePacket( inviteUpPacket );
inviteReplyData.contentId == pPlayer->getContentId(); inviteReplyData.contentId = pPlayer->getContentId();
inviteReplyData.socialType = data.socialType; inviteReplyData.socialType = data.socialType;
inviteReplyData.gender = pPlayer->getGender(); inviteReplyData.gender = pPlayer->getGender();
strcpy( inviteReplyData.name, pPlayer->getName().c_str() ); strcpy( inviteReplyData.name, pPlayer->getName().c_str() );

View file

@ -32,7 +32,7 @@ namespace Sapphire::Network::Packets::Server
m_data.headRotation = headRotation; m_data.headRotation = headRotation;
m_data.animationType = animationType; m_data.animationType = animationType;
m_data.animationState = state; m_data.animationState = state;
m_data.animationSpeed = animationSpeed; m_data.animationSpeed = (uint8_t)animationSpeed;
m_data.unknownRotation = unknownRotation; m_data.unknownRotation = unknownRotation;
m_data.posX = Common::Util::floatToUInt16( actor.getPos().x ); m_data.posX = Common::Util::floatToUInt16( actor.getPos().x );
m_data.posY = Common::Util::floatToUInt16( actor.getPos().y ); m_data.posY = Common::Util::floatToUInt16( actor.getPos().y );

View file

@ -164,7 +164,7 @@ bool Sapphire::Scripting::ScriptMgr::onTalk( Entity::Player& player, uint64_t ac
{ {
// check if the actor is an eobj and call its script if we have one // check if the actor is an eobj and call its script if we have one
auto zone = player.getCurrentTerritory(); auto zone = player.getCurrentTerritory();
if( auto eobj = zone->getEObj( actorId ) ) if( auto eobj = zone->getEObj( (uint32_t)actorId ) )
{ {
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventObjectScript >( eobj->getObjectId() ); auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventObjectScript >( eobj->getObjectId() );
if( script ) if( script )

View file

@ -140,12 +140,12 @@ bool Sapphire::HousingZone::init()
land->setHouse( house ); land->setHouse( house );
} }
land->init( entry.m_type, entry.m_size, entry.m_status, entry.m_currentPrice, entry.m_ownerId, entry.m_houseId ); land->init( entry.m_type, entry.m_size, entry.m_status, (uint32_t)entry.m_currentPrice, entry.m_ownerId, entry.m_houseId );
m_landPtrMap[ entry.m_landId ] = land; m_landPtrMap[ (unsigned char)entry.m_landId ] = land;
if( entry.m_houseId > 0 ) if( entry.m_houseId > 0 )
registerEstateEntranceEObj( entry.m_landId ); registerEstateEntranceEObj( (uint8_t)entry.m_landId );
updateYardObjects( land->getLandIdent() ); updateYardObjects( land->getLandIdent() );
} }
@ -169,7 +169,7 @@ void Sapphire::HousingZone::onPlayerZoneIn( Entity::Player& player )
{ {
auto housingObjectInit = makeZonePacket< FFXIVIpcHousingObjectInitialize >( player.getId() ); auto housingObjectInit = makeZonePacket< FFXIVIpcHousingObjectInitialize >( player.getId() );
memset( &housingObjectInit->data().landIdent, 0xFF, sizeof( Common::LandIdent ) ); memset( &housingObjectInit->data().landIdent, 0xFF, sizeof( Common::LandIdent ) );
housingObjectInit->data().u1 = 0xFF; housingObjectInit->data().u1 |= 0xFF;
housingObjectInit->data().packetNum = yardPacketNum; housingObjectInit->data().packetNum = yardPacketNum;
housingObjectInit->data().packetTotal = yardPacketTotal; housingObjectInit->data().packetTotal = yardPacketTotal;
@ -232,7 +232,7 @@ void Sapphire::HousingZone::sendLandSet( Entity::Player& player )
for( auto i = 0; i != parts.size(); i++ ) for( auto i = 0; i != parts.size(); i++ )
{ {
landData.housePart[ i ] = parts[ i ].first; landData.housePart[ i ] = parts[ i ].first;
landData.houseColour[ i ] = parts[ i ].second; landData.houseColour[ i ] = (uint8_t)parts[ i ].second;
} }
} }
} }
@ -269,7 +269,7 @@ void Sapphire::HousingZone::sendLandUpdate( uint8_t landId )
for( auto i = 0; i != parts.size(); i++ ) for( auto i = 0; i != parts.size(); i++ )
{ {
landData.housePart[ i ] = parts[ i ].first; landData.housePart[ i ] = parts[ i ].first;
landData.houseColour[ i ] = parts[ i ].second; landData.houseColour[ i ] = (uint8_t)parts[ i ].second;
} }
} }
@ -409,11 +409,11 @@ void Sapphire::HousingZone::updateYardObjectPos( Entity::Player& sourcePlayer, u
auto packet = makeZonePacket< Server::FFXIVIpcHousingObjectMove >( player.second->getId() ); auto packet = makeZonePacket< Server::FFXIVIpcHousingObjectMove >( player.second->getId() );
packet->data().itemRotation = item.getRot(); packet->data().itemRotation = (uint16_t)item.getRot();
packet->data().pos = item.getPos(); packet->data().pos = item.getPos();
packet->data().landId = landId; packet->data().landId = (uint8_t)landId;
packet->data().objectArray = slot; packet->data().objectArray = (uint8_t)slot;
player.second->queuePacket( packet ); player.second->queuePacket( packet );
} }

View file

@ -242,18 +242,16 @@ Sapphire::Land::InvMaxItemsPair Sapphire::Land::getInventoryItemMax() const
{ {
switch( m_size ) switch( m_size )
{ {
default:
case HouseSize::Cottage: case HouseSize::Cottage:
{
return std::make_pair( 20, 200 ); return std::make_pair( 20, 200 );
} break;
case HouseSize::House: case HouseSize::House:
{
return std::make_pair( 30, 300 ); return std::make_pair( 30, 300 );
} break;
case HouseSize::Mansion: case HouseSize::Mansion:
{
return std::make_pair( 40, 400 ); return std::make_pair( 40, 400 );
} break;
} }
assert( false ); assert( false );
} }

View file

@ -474,7 +474,7 @@ bool Sapphire::Territory::update( uint64_t tickCount )
auto dt = std::difftime( tickCount, m_lastUpdate ) / 1000.f; auto dt = std::difftime( tickCount, m_lastUpdate ) / 1000.f;
if( m_pNaviProvider ) if( m_pNaviProvider )
m_pNaviProvider->updateCrowd( dt ); m_pNaviProvider->updateCrowd( (float)dt );
updateSessions( tickCount, changedWeather ); updateSessions( tickCount, changedWeather );
onUpdate( tickCount ); onUpdate( tickCount );