mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-06 10:47:45 +00:00
Merge b588f424b5
into 1a99b56c8b
This commit is contained in:
commit
973af39dd5
62 changed files with 137 additions and 130 deletions
4
deps/datReader/Dat.cpp
vendored
4
deps/datReader/Dat.cpp
vendored
|
@ -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 = static_cast<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(),
|
static_cast<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 );
|
||||||
}
|
}
|
||||||
|
|
2
deps/datReader/DatCategories/bg/sgb.h
vendored
2
deps/datReader/DatCategories/bg/sgb.h
vendored
|
@ -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 );
|
||||||
|
|
4
deps/datReader/Exd.cpp
vendored
4
deps/datReader/Exd.cpp
vendored
|
@ -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 = static_cast<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, static_cast<uint8_t>(i) };
|
||||||
auto& fields = data[ row ];
|
auto& fields = data[ row ];
|
||||||
fields.reserve( memberCount );
|
fields.reserve( memberCount );
|
||||||
|
|
||||||
|
|
4
deps/datReader/GameData.cpp
vendored
4
deps/datReader/GameData.cpp
vendored
|
@ -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() ), static_cast<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() ), static_cast<uInt>(filenamePart.size()) ) ^ 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameData::createCategory( uint32_t catNum )
|
void GameData::createCategory( uint32_t catNum )
|
||||||
|
|
4
deps/datReader/crc32.cpp
vendored
4
deps/datReader/crc32.cpp
vendored
|
@ -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 = static_cast<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 = static_cast<uint32_t>(i_format.size());
|
||||||
|
|
||||||
o_hashes.resize( 100000000 );
|
o_hashes.resize( 100000000 );
|
||||||
|
|
||||||
|
|
4
deps/datReader/zlib.cpp
vendored
4
deps/datReader/zlib.cpp
vendored
|
@ -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( static_cast<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()), static_cast<uLong>(in.size()), Z_BEST_COMPRESSION );
|
||||||
|
|
||||||
if( ret != Z_OK )
|
if( ret != Z_OK )
|
||||||
{
|
{
|
||||||
|
|
7
deps/mysqlConnector/Connection.cpp
vendored
7
deps/mysqlConnector/Connection.cpp
vendored
|
@ -29,7 +29,8 @@ Mysql::Connection::Connection( std::shared_ptr< MySqlBase > pBase,
|
||||||
const std::string& password,
|
const std::string& password,
|
||||||
const optionMap& options,
|
const optionMap& options,
|
||||||
uint16_t port ) :
|
uint16_t port ) :
|
||||||
m_pBase( pBase )
|
m_pBase( pBase ),
|
||||||
|
m_bConnected( false )
|
||||||
{
|
{
|
||||||
m_pRawCon = mysql_init( nullptr );
|
m_pRawCon = mysql_init( nullptr );
|
||||||
// Different mysql versions support different options, for now whatever was unsupporter here was commented out
|
// Different mysql versions support different options, for now whatever was unsupporter here was commented out
|
||||||
|
@ -165,7 +166,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(), static_cast<unsigned long>(query.length()) );
|
||||||
|
|
||||||
if( res != 0 )
|
if( res != 0 )
|
||||||
throw std::runtime_error( "Query failed!" );
|
throw std::runtime_error( "Query failed!" );
|
||||||
|
@ -237,7 +238,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(), static_cast<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() );
|
||||||
|
|
8
deps/mysqlConnector/PreparedStatement.cpp
vendored
8
deps/mysqlConnector/PreparedStatement.cpp
vendored
|
@ -18,7 +18,7 @@ struct LongDataSender
|
||||||
{
|
{
|
||||||
unsigned position;
|
unsigned position;
|
||||||
MYSQL_STMT* m_pStmt;
|
MYSQL_STMT* m_pStmt;
|
||||||
LongDataSender()
|
LongDataSender() : position( 0 ), m_pStmt(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ struct LongDataSender
|
||||||
|
|
||||||
while( sent < str->length() )
|
while( sent < str->length() )
|
||||||
{
|
{
|
||||||
chunkSize = ( sent + MAX_SEND_LONGDATA_CHUNK > str->length()
|
chunkSize = static_cast<uint32_t>(( sent + MAX_SEND_LONGDATA_CHUNK > str->length()
|
||||||
? str->length() - sent
|
? str->length() - sent
|
||||||
: MAX_SEND_LONGDATA_CHUNK );
|
: MAX_SEND_LONGDATA_CHUNK ));
|
||||||
|
|
||||||
if( mysql_stmt_send_long_data( m_pStmt, position, str->c_str() + sent, chunkSize ) )
|
if( mysql_stmt_send_long_data( m_pStmt, position, str->c_str() + sent, chunkSize ) )
|
||||||
{
|
{
|
||||||
|
@ -307,7 +307,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
Mysql::PreparedStatement::PreparedStatement( MYSQL_STMT* pStmt, std::shared_ptr< Mysql::Connection > pConn )
|
Mysql::PreparedStatement::PreparedStatement( MYSQL_STMT* pStmt, std::shared_ptr< Mysql::Connection > pConn )
|
||||||
: Statement( pConn )
|
: Statement( pConn ), m_paramCount( 0 ), resultSetConcurrency ( 0 ), resultSetType( 0 ), warningsCount( 0 )
|
||||||
{
|
{
|
||||||
m_pStmt = pStmt;
|
m_pStmt = pStmt;
|
||||||
m_pConnection = pConn;
|
m_pConnection = pConn;
|
||||||
|
|
4
deps/mysqlConnector/Statement.cpp
vendored
4
deps/mysqlConnector/Statement.cpp
vendored
|
@ -10,14 +10,14 @@ std::shared_ptr< Mysql::Connection > Mysql::Statement::getConnection()
|
||||||
}
|
}
|
||||||
|
|
||||||
Mysql::Statement::Statement( std::shared_ptr< Mysql::Connection > conn ) :
|
Mysql::Statement::Statement( std::shared_ptr< Mysql::Connection > conn ) :
|
||||||
m_pConnection( conn )
|
m_pConnection( conn ), m_lastUpdateCount( 0 ), m_warningsCount( 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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(), static_cast<unsigned long>(q.length()) );
|
||||||
|
|
||||||
if( errNo() )
|
if( errNo() )
|
||||||
throw std::runtime_error( m_pConnection->getError() );
|
throw std::runtime_error( m_pConnection->getError() );
|
||||||
|
|
|
@ -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 = static_cast<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 );
|
||||||
|
|
|
@ -242,7 +242,7 @@ namespace SimpleWeb {
|
||||||
std::shared_ptr<Request> request(new Request(*socket));
|
std::shared_ptr<Request> request(new Request(*socket));
|
||||||
|
|
||||||
//Set timeout on the following asio::async-read or write function
|
//Set timeout on the following asio::async-read or write function
|
||||||
auto timer=this->get_timeout_timer(socket, config.timeout_request);
|
auto timer=this->get_timeout_timer(socket, static_cast<long>(config.timeout_request));
|
||||||
|
|
||||||
asio::async_read_until(*socket, request->streambuf, "\r\n\r\n",
|
asio::async_read_until(*socket, request->streambuf, "\r\n\r\n",
|
||||||
[this, socket, request, timer](const std::error_code& ec, size_t bytes_transferred) {
|
[this, socket, request, timer](const std::error_code& ec, size_t bytes_transferred) {
|
||||||
|
@ -272,7 +272,7 @@ namespace SimpleWeb {
|
||||||
}
|
}
|
||||||
if(content_length>num_additional_bytes) {
|
if(content_length>num_additional_bytes) {
|
||||||
//Set timeout on the following asio::async-read or write function
|
//Set timeout on the following asio::async-read or write function
|
||||||
auto timer=this->get_timeout_timer(socket, config.timeout_content);
|
auto timer=this->get_timeout_timer(socket, static_cast<long>(config.timeout_content));
|
||||||
asio::async_read(*socket, request->streambuf,
|
asio::async_read(*socket, request->streambuf,
|
||||||
asio::transfer_exactly(static_cast< size_t >(content_length-num_additional_bytes)),
|
asio::transfer_exactly(static_cast< size_t >(content_length-num_additional_bytes)),
|
||||||
[this, socket, request, timer]
|
[this, socket, request, timer]
|
||||||
|
@ -368,7 +368,7 @@ namespace SimpleWeb {
|
||||||
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>,
|
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>,
|
||||||
std::shared_ptr<typename ServerBase<socket_type>::Request>)>& resource_function) {
|
std::shared_ptr<typename ServerBase<socket_type>::Request>)>& resource_function) {
|
||||||
//Set timeout on the following asio::async-read or write function
|
//Set timeout on the following asio::async-read or write function
|
||||||
auto timer=this->get_timeout_timer(socket, config.timeout_content);
|
auto timer=this->get_timeout_timer(socket, static_cast<long>(config.timeout_content));
|
||||||
|
|
||||||
auto response=std::shared_ptr<Response>(new Response(socket), [this, request, timer](Response *response_ptr) {
|
auto response=std::shared_ptr<Response>(new Response(socket), [this, request, timer](Response *response_ptr) {
|
||||||
auto response=std::shared_ptr<Response>(response_ptr);
|
auto response=std::shared_ptr<Response>(response_ptr);
|
||||||
|
|
|
@ -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 >
|
||||||
|
|
|
@ -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 = static_cast<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;
|
||||||
|
|
|
@ -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(), static_cast<unsigned long>(str.size()) );
|
||||||
str = buf;
|
str = buf;
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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, static_cast<uint32_t>(bytesExpected), outBuf, packetHeader.oodleDecompressedSize );
|
||||||
|
|
||||||
if( !oodleSuccess )
|
if( !oodleSuccess )
|
||||||
{
|
{
|
||||||
|
|
|
@ -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, static_cast<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 = static_cast<uint32_t>(compLen);
|
||||||
m_ipcHdr.compressionType = static_cast< uint8_t >(Packets::CompressionType::Oodle);
|
m_ipcHdr.compressionType = static_cast< uint8_t >(Packets::CompressionType::Oodle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 static_cast<uint32_t>(std::chrono::time_point_cast< std::chrono::seconds >( currClock ).time_since_epoch().count());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Util::getEorzeanTimeStamp()
|
uint64_t Util::getEorzeanTimeStamp()
|
||||||
|
|
|
@ -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 );
|
( static_cast<uint32_t>(inPacket.data.size() ) - 0x10 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( inPacket.segHdr.type )
|
switch( inPacket.segHdr.type )
|
||||||
|
|
|
@ -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 += static_cast<uint32_t>(pEntry->getSize());
|
||||||
m_header.count++;
|
m_header.count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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(), static_cast<uint32_t>(infoJson.length()) ) + "\"}";
|
||||||
|
|
||||||
HttpResponse r = requestApi( "createCharacter", json_string );
|
HttpResponse r = requestApi( "createCharacter", json_string );
|
||||||
|
|
||||||
|
|
|
@ -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(), static_cast<uint8_t>(result.param3) );
|
||||||
player.finishQuest( getId() );
|
player.finishQuest( getId() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = static_cast<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 = static_cast<int>((col * (float)tileWidth) + x);
|
||||||
int tileY = ( row * ( float ) tileWidth ) + y;
|
int tileY = static_cast<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 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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, { '_' } );
|
||||||
|
|
||||||
|
|
|
@ -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 ] +
|
||||||
|
|
|
@ -119,6 +119,7 @@ private:
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
|
(void)e; // suppress unused var warning
|
||||||
std::vector< char > empty;
|
std::vector< char > empty;
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,7 +380,7 @@ struct LGB_FILE
|
||||||
for( auto i = 0; i < header.groupCount; ++i )
|
for( auto i = 0; i < header.groupCount; ++i )
|
||||||
{
|
{
|
||||||
const auto groupOffset = baseOffset + *reinterpret_cast< int32_t* >( buf + ( baseOffset + i * 4 ) );
|
const auto groupOffset = baseOffset + *reinterpret_cast< int32_t* >( buf + ( baseOffset + i * 4 ) );
|
||||||
const auto group = LGB_GROUP( buf, this, groupOffset );
|
const auto group = LGB_GROUP( buf, this, static_cast<uint32_t>(groupOffset) );
|
||||||
groups.push_back( group );
|
groups.push_back( group );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -332,6 +332,7 @@ int main( int argc, char* argv[] )
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
|
printf("An exception has occurred: %s", e.what());
|
||||||
printf( "Unable to initialise EXD!\n" );
|
printf( "Unable to initialise EXD!\n" );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -492,7 +493,7 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
printf( "Built export struct for %s in %lu seconds \n",
|
printf( "Built export struct for %s in %lu seconds \n",
|
||||||
zoneName.c_str(),
|
zoneName.c_str(),
|
||||||
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - entryStartTime ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - entryStartTime ).count() ));
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
|
@ -506,7 +507,7 @@ int main( int argc, char* argv[] )
|
||||||
std::cout << "\n\n\n";
|
std::cout << "\n\n\n";
|
||||||
|
|
||||||
printf( "Finished all tasks in %lu seconds\n",
|
printf( "Finished all tasks in %lu seconds\n",
|
||||||
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - startTime ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - startTime ).count() ));
|
||||||
|
|
||||||
delete eData;
|
delete eData;
|
||||||
delete gameData;
|
delete gameData;
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
|
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
printf( "[Navmesh] Finished exporting %s in %lu ms\n", zone.name.c_str(),
|
printf( "[Navmesh] Finished exporting %s in %lu ms\n", zone.name.c_str(),
|
||||||
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
|
|
||||||
printf( "[Obj] Finished exporting %s in %lu ms\n",
|
printf( "[Obj] Finished exporting %s in %lu ms\n",
|
||||||
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
|
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
|
||||||
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ));
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public:
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
printf( "[Obj] Finished exporting %s in %lu ms\n",
|
printf( "[Obj] Finished exporting %s in %lu ms\n",
|
||||||
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
|
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
|
||||||
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ));
|
||||||
|
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ private:
|
||||||
std::to_string( mesh.indices[ i + 1 ] + indicesOffset + 1 ) << ' ' +
|
std::to_string( mesh.indices[ i + 1 ] + indicesOffset + 1 ) << ' ' +
|
||||||
std::to_string( mesh.indices[ i + 2 ] + indicesOffset + 1 ) << '\n';
|
std::to_string( mesh.indices[ i + 2 ] + indicesOffset + 1 ) << '\n';
|
||||||
}
|
}
|
||||||
indicesOffset += mesh.verts.size() / 3;
|
indicesOffset += static_cast<int>(mesh.verts.size()) / 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//of.flush();
|
//of.flush();
|
||||||
|
|
|
@ -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(); } ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,7 @@ private:
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
|
(void)e; // suppress unused warning
|
||||||
std::vector< char > empty;
|
std::vector< char > empty;
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,7 @@ struct LGB_FILE
|
||||||
for( auto i = 0; i < header.groupCount; ++i )
|
for( auto i = 0; i < header.groupCount; ++i )
|
||||||
{
|
{
|
||||||
const auto groupOffset = baseOffset + *reinterpret_cast< int32_t* >( buf + ( baseOffset + i * 4 ) );
|
const auto groupOffset = baseOffset + *reinterpret_cast< int32_t* >( buf + ( baseOffset + i * 4 ) );
|
||||||
const auto group = LGB_GROUP( buf, this, groupOffset );
|
const auto group = LGB_GROUP( buf, this, static_cast<uint32_t>(groupOffset) );
|
||||||
groups.push_back( group );
|
groups.push_back( group );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -212,6 +212,7 @@ int main( int argc, char* argv[] )
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
|
printf("An exception has occurred: %s", e.what());
|
||||||
printf( "Unable to initialise EXD!\n Usage: pcb_reader <teri> \"path/to/FINAL FANTASY XIV - A REALM REBORN/game/sqpack\" [--no-obj, --dump-all, --navmesh, --jobs #]\n" );
|
printf( "Unable to initialise EXD!\n Usage: pcb_reader <teri> \"path/to/FINAL FANTASY XIV - A REALM REBORN/game/sqpack\" [--no-obj, --dump-all, --navmesh, --jobs #]\n" );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -390,7 +391,7 @@ int main( int argc, char* argv[] )
|
||||||
mesh.indices[ indices++ ] = index.index[ 2 ];
|
mesh.indices[ indices++ ] = index.index[ 2 ];
|
||||||
// std::cout << std::to_string( index.unknown[0] )<< " " << std::to_string( index.unknown[1] )<< " " << std::to_string( index.unknown[2]) << std::endl;
|
// std::cout << std::to_string( index.unknown[0] )<< " " << std::to_string( index.unknown[1] )<< " " << std::to_string( index.unknown[2]) << std::endl;
|
||||||
}
|
}
|
||||||
max_index += entry.data.vertices.size() + entry.data.vertices_i16.size();
|
max_index += static_cast<uint32_t>((entry.data.vertices.size() + entry.data.vertices_i16.size()));
|
||||||
model.meshes[ meshCount++ ] = mesh;
|
model.meshes[ meshCount++ ] = mesh;
|
||||||
}
|
}
|
||||||
exportedGroup.models[model.name] = model;
|
exportedGroup.models[model.name] = model;
|
||||||
|
@ -521,7 +522,7 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
printf( "Built export struct for %s in %lu seconds \n",
|
printf( "Built export struct for %s in %lu seconds \n",
|
||||||
zoneName.c_str(),
|
zoneName.c_str(),
|
||||||
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - entryStartTime ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - entryStartTime ).count() ));
|
||||||
if( zoneCount++ % nJobs == 0 )
|
if( zoneCount++ % nJobs == 0 )
|
||||||
{
|
{
|
||||||
exportMgr.restart();
|
exportMgr.restart();
|
||||||
|
@ -540,7 +541,7 @@ int main( int argc, char* argv[] )
|
||||||
std::cout << "\n\n\n";
|
std::cout << "\n\n\n";
|
||||||
|
|
||||||
printf( "Finished all tasks in %lu seconds\n",
|
printf( "Finished all tasks in %lu seconds\n",
|
||||||
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - startTime ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::seconds >( std::chrono::high_resolution_clock::now() - startTime ).count() ));
|
||||||
|
|
||||||
delete eData;
|
delete eData;
|
||||||
delete gameData;
|
delete gameData;
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
printf( "[Navmesh] Finished exporting %s in %lu ms\n",
|
printf( "[Navmesh] Finished exporting %s in %lu ms\n",
|
||||||
zone.name.c_str(),
|
zone.name.c_str(),
|
||||||
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exportGroup( const std::string& zoneName, const ExportedGroup& group )
|
static void exportGroup( const std::string& zoneName, const ExportedGroup& group )
|
||||||
|
@ -91,7 +91,7 @@ public:
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
printf( "[Navmesh] Finished exporting %s in %lu ms\n",
|
printf( "[Navmesh] Finished exporting %s in %lu ms\n",
|
||||||
fileName.c_str(),
|
fileName.c_str(),
|
||||||
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
#endif // !OBJ_EXPORTER_H
|
#endif // !OBJ_EXPORTER_H
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
|
|
||||||
printf( "[Obj] Finished exporting %s in %lu ms\n",
|
printf( "[Obj] Finished exporting %s in %lu ms\n",
|
||||||
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
|
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
|
||||||
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ));
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public:
|
||||||
auto end = std::chrono::high_resolution_clock::now();
|
auto end = std::chrono::high_resolution_clock::now();
|
||||||
printf( "[Obj] Finished exporting %s in %lu ms\n",
|
printf( "[Obj] Finished exporting %s in %lu ms\n",
|
||||||
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
|
fileName.substr( fileName.find( "pcb_export" ) - 1 ).c_str(),
|
||||||
std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() );
|
static_cast<unsigned long>(std::chrono::duration_cast< std::chrono::milliseconds >( end - start ).count() ));
|
||||||
|
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ private:
|
||||||
std::to_string( mesh.indices[ i + 1 ] + indicesOffset + 1 ) << ' ' +
|
std::to_string( mesh.indices[ i + 1 ] + indicesOffset + 1 ) << ' ' +
|
||||||
std::to_string( mesh.indices[ i + 2 ] + indicesOffset + 1 ) << '\n';
|
std::to_string( mesh.indices[ i + 2 ] + indicesOffset + 1 ) << '\n';
|
||||||
}
|
}
|
||||||
indicesOffset += mesh.verts.size() / 3;
|
indicesOffset += static_cast<int>(mesh.verts.size()) / 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//of.flush();
|
//of.flush();
|
||||||
|
|
|
@ -121,7 +121,7 @@ struct PCB_FILE
|
||||||
/* printf( "\tnum_v16: %i, num_indices: %i, num_vertices: %i\n\n",
|
/* printf( "\tnum_v16: %i, num_indices: %i, num_vertices: %i\n\n",
|
||||||
block_entry.header.num_v16, block_entry.header.num_indices, block_entry.header.num_vertices );*/
|
block_entry.header.num_v16, block_entry.header.num_indices, block_entry.header.num_vertices );*/
|
||||||
int doffset = sizeof( block_entry.header ) + offset;
|
int doffset = sizeof( block_entry.header ) + offset;
|
||||||
uint16_t block_size = sizeof( block_entry.header ) +
|
uint16_t block_size = static_cast<uint16_t>(sizeof( block_entry.header )) +
|
||||||
block_entry.header.num_vertices * 3 * 4 +
|
block_entry.header.num_vertices * 3 * 4 +
|
||||||
block_entry.header.num_v16 * 6 +
|
block_entry.header.num_v16 * 6 +
|
||||||
block_entry.header.num_indices * 6;
|
block_entry.header.num_indices * 6;
|
||||||
|
|
|
@ -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(); } ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = static_cast<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( §ion[ offset ] );
|
std::string entry( §ion[ offset ] );
|
||||||
offset += entry.size() + 1;
|
offset += static_cast<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_-" ) ==
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 = static_cast<uint32_t>(m_actorIdTohateSlotMap.size());
|
||||||
auto hateRankPacket = makeZonePacket< FFXIVIpcHateRank >( getId() );
|
auto hateRankPacket = makeZonePacket< FFXIVIpcHateRank >( getId() );
|
||||||
hateRankPacket->data().numEntries = m_actorIdTohateSlotMap.size();
|
hateRankPacket->data().numEntries = static_cast<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 = static_cast<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 = static_cast<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(static_cast<uint32_t>(damage.first) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 = static_cast<uint8_t>(paramList.size());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for( auto p : paramList )
|
for( auto p : paramList )
|
||||||
{
|
{
|
||||||
|
|
|
@ -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( static_cast<uint8_t>(slotId) );
|
||||||
if( !item )
|
if( !item )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// unlink item
|
// unlink item
|
||||||
container->removeItem( slotId, false );
|
container->removeItem(static_cast<uint8_t>(slotId), false );
|
||||||
updateContainer( type, slotId, nullptr );
|
updateContainer( type, static_cast<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(static_cast<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, static_cast<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 );
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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 static_cast<int8_t>(slotId);
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -89,7 +89,7 @@ bool Sapphire::World::Manager::HousingMgr::init()
|
||||||
{
|
{
|
||||||
auto count = landSet.second.size();
|
auto count = landSet.second.size();
|
||||||
|
|
||||||
houseCount += count;
|
houseCount += static_cast<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(static_cast<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(static_cast<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(static_cast<uint8_t>(plot) );
|
||||||
|
|
||||||
player.setLandFlags( LandFlagsSlot::Private, 0, land->getLandIdent() );
|
player.setLandFlags( LandFlagsSlot::Private, 0, land->getLandIdent() );
|
||||||
|
|
||||||
terri->removeEstateEntranceEObj( plot );
|
terri->removeEstateEntranceEObj(static_cast<uint8_t>(plot) );
|
||||||
|
|
||||||
// missing reply for ClientTrigger RequestEstateHallRemoval
|
// missing reply for ClientTrigger RequestEstateHallRemoval
|
||||||
}
|
}
|
|
@ -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 = static_cast<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 = static_cast<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 = static_cast<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 = static_cast<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 = static_cast<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 = static_cast<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 = static_cast<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 );
|
||||||
|
|
||||||
|
|
|
@ -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(), static_cast<uint8_t>(param) );
|
||||||
|
|
||||||
auto housingZone = housingMgr.getHousingZoneByLandSetId( landSetId );
|
auto housingZone = housingMgr.getHousingZoneByLandSetId( landSetId );
|
||||||
|
|
||||||
|
|
|
@ -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, static_cast<uint8_t>(slotId) );
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
auto& exdData = Common::Service< Data::ExdDataGenerated >::ref();
|
||||||
|
|
|
@ -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(static_cast<uint8_t>(landIdent.landId) );
|
||||||
if( !land )
|
if( !land )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|
|
@ -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 = static_cast<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 ] );
|
||||||
|
|
|
@ -573,7 +573,7 @@ int32_t Sapphire::World::Navi::NaviProvider::addAgent( Entity::Chara& chara )
|
||||||
std::memset( ¶ms, 0, sizeof( params ) );
|
std::memset( ¶ms, 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 = static_cast<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( ¶ms, 0, sizeof( params ) );
|
std::memset( ¶ms, 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;
|
||||||
|
|
|
@ -328,7 +328,7 @@ void Sapphire::Network::GameConnection::processOutQueue()
|
||||||
}
|
}
|
||||||
|
|
||||||
pRP.addPacket( pPacket );
|
pRP.addPacket( pPacket );
|
||||||
totalSize += pPacket->getSize();
|
totalSize += static_cast<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 )
|
||||||
|
|
|
@ -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 = static_cast<uint32_t>(p1u64);
|
||||||
examineHandler( player, targetId );
|
examineHandler( player, targetId );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(static_cast<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, static_cast<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, static_cast<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, static_cast<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( static_cast<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, static_cast<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, static_cast<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, static_cast<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 ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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() );
|
||||||
|
|
|
@ -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 = static_cast<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 );
|
||||||
|
|
|
@ -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( static_cast<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 )
|
||||||
|
|
|
@ -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, static_cast<uint32_t>(entry.m_currentPrice), entry.m_ownerId, entry.m_houseId );
|
||||||
|
|
||||||
m_landPtrMap[ entry.m_landId ] = land;
|
m_landPtrMap[ static_cast<unsigned char>(entry.m_landId) ] = land;
|
||||||
|
|
||||||
if( entry.m_houseId > 0 )
|
if( entry.m_houseId > 0 )
|
||||||
registerEstateEntranceEObj( entry.m_landId );
|
registerEstateEntranceEObj( static_cast<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 ] = static_cast<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 ] = static_cast<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 = static_cast<uint16_t>(item.getRot());
|
||||||
packet->data().pos = item.getPos();
|
packet->data().pos = item.getPos();
|
||||||
|
|
||||||
packet->data().landId = landId;
|
packet->data().landId = static_cast<uint8_t>(landId);
|
||||||
packet->data().objectArray = slot;
|
packet->data().objectArray = static_cast<uint8_t>(slot);
|
||||||
|
|
||||||
player.second->queuePacket( packet );
|
player.second->queuePacket( packet );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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( static_cast<float>(dt) );
|
||||||
|
|
||||||
updateSessions( tickCount, changedWeather );
|
updateSessions( tickCount, changedWeather );
|
||||||
onUpdate( tickCount );
|
onUpdate( tickCount );
|
||||||
|
|
Loading…
Add table
Reference in a new issue