From 2f5d5e9d186ceb1001446485034643d1e391d597 Mon Sep 17 00:00:00 2001 From: Alice Ogeda Date: Sat, 19 Feb 2022 22:05:30 -0300 Subject: [PATCH] more warning cleanups; general styling fixes; --- src/world/Actor/PlayerInventory.cpp | 2 +- src/world/Manager/LinkshellMgr.cpp | 2 +- src/world/Manager/TerritoryMgr.cpp | 3 ++- src/world/Network/Handlers/CommonListHandler.cpp | 2 +- src/world/Network/Handlers/PacketCommandHandler.cpp | 3 +-- src/world/Network/Handlers/PacketHandlers.cpp | 8 ++++---- src/world/Network/PacketWrappers/PcPartyUpdatePacket.h | 9 --------- src/world/Network/PacketWrappers/PlayerSetupPacket.h | 2 +- src/world/WorldServer.cpp | 3 ++- 9 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/world/Actor/PlayerInventory.cpp b/src/world/Actor/PlayerInventory.cpp index 9f4b8585..b48a63ea 100644 --- a/src/world/Actor/PlayerInventory.cpp +++ b/src/world/Actor/PlayerInventory.cpp @@ -474,7 +474,7 @@ Sapphire::Entity::Player::InvSlotPair Sapphire::Entity::Player::getFreeBagSlot() Sapphire::Entity::Player::InvSlotPair Sapphire::Entity::Player::getFreeContainerSlot( uint32_t containerId ) { - auto freeSlot = static_cast < int8_t >( m_storageMap[ containerId ]->getFreeSlot() ); + auto freeSlot = static_cast< int8_t >( m_storageMap[ containerId ]->getFreeSlot() ); if( freeSlot != -1 ) return std::make_pair( containerId, freeSlot ); diff --git a/src/world/Manager/LinkshellMgr.cpp b/src/world/Manager/LinkshellMgr.cpp index 99063983..3b81951b 100644 --- a/src/world/Manager/LinkshellMgr.cpp +++ b/src/world/Manager/LinkshellMgr.cpp @@ -53,7 +53,7 @@ bool LinkshellMgr::loadLinkshells() size_t entryCount = inData.size() / 8; std::vector< uint64_t > list( entryCount ); - for( int i = 0; i < entryCount; ++i ) + for( uint64_t i = 0; i < entryCount; ++i ) { auto val = *reinterpret_cast< const uint64_t* >( &inData[ i * 8 ] ); list[ i ] = val; diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index 5d834595..5502409a 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -26,7 +26,8 @@ using namespace Sapphire; using namespace Sapphire::World::Manager; TerritoryMgr::TerritoryMgr() : - m_lastInstanceId( 10000 ) + m_lastInstanceId( 10000 ), + m_inRangeDistance( 0 ) { } diff --git a/src/world/Network/Handlers/CommonListHandler.cpp b/src/world/Network/Handlers/CommonListHandler.cpp index 466f3706..23e5cd06 100644 --- a/src/world/Network/Handlers/CommonListHandler.cpp +++ b/src/world/Network/Handlers/CommonListHandler.cpp @@ -78,7 +78,7 @@ void Sapphire::Network::GameConnection::getCommonlistHandler( const Packets::FFX const size_t itemsPerPage = 10; // this func paginates any commonlist entry, associating them with online player data and hierarchy ID (optional) - auto generateEntries = [&]( const auto& idVec, size_t offset, const std::vector< Common::HierarchyData >& hierarchyVec ) -> std::vector< PlayerEntry > + auto generateEntries = [ & ]( const auto& idVec, size_t offset, const std::vector< Common::HierarchyData >& hierarchyVec ) -> std::vector< PlayerEntry > { std::vector< PlayerEntry > entries; diff --git a/src/world/Network/Handlers/PacketCommandHandler.cpp b/src/world/Network/Handlers/PacketCommandHandler.cpp index 627e1a09..4f8e9c8d 100644 --- a/src/world/Network/Handlers/PacketCommandHandler.cpp +++ b/src/world/Network/Handlers/PacketCommandHandler.cpp @@ -447,10 +447,9 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_ } case PacketCommand::TARGET_DECIDE: // Change target { - uint64_t targetId = param1; - if( targetId == player.getTargetId() || targetId == 0xE0000000 ) + if( targetId == player.getTargetId() || targetId == Common::INVALID_GAME_OBJECT_ID ) targetId = 0; player.changeTarget( targetId ); diff --git a/src/world/Network/Handlers/PacketHandlers.cpp b/src/world/Network/Handlers/PacketHandlers.cpp index 1cc700d5..ddb9f7de 100644 --- a/src/world/Network/Handlers/PacketHandlers.cpp +++ b/src/world/Network/Handlers/PacketHandlers.cpp @@ -641,7 +641,7 @@ void Sapphire::Network::GameConnection::gearSetEquip( const Packets::FFXIVARR_PA auto& server = Common::Service< World::WorldServer >::ref(); // Loop over all slots - for (int slot = 0; slot < 14; slot++ ) + for( int slot = 0; slot < 14; ++slot ) { const auto fromSlot = packet.data().containerIndex[ slot ]; const auto fromContainer = packet.data().storageId[ slot ]; @@ -659,19 +659,19 @@ void Sapphire::Network::GameConnection::gearSetEquip( const Packets::FFXIVARR_PA ackPacket->data().operationType = operationType; server.queueForPlayer( player.getCharacterId(), ackPacket ); - if ( fromItem && equippedItem ) + if( fromItem && equippedItem ) { player.swapItem( fromContainer, fromSlot, Common::GearSet0, slot ); server.queueForPlayer( player.getCharacterId(), std::make_shared< UpdateInventorySlotPacket >( player.getId(), fromSlot, fromContainer, *equippedItem, 0 ) ); server.queueForPlayer( player.getCharacterId(), 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 ); server.queueForPlayer( player.getCharacterId(), std::make_shared< UpdateInventorySlotPacket >( player.getId(), fromSlot, fromContainer, 0 ) ); server.queueForPlayer( player.getCharacterId(), std::make_shared< UpdateInventorySlotPacket >( player.getId(), slot, Common::GearSet0, *fromItem, 0 ) ); } - else if ( !fromItem && equippedItem ) + else if( !fromItem && equippedItem ) { auto containerId = World::Manager::ItemMgr::getCharaEquipSlotCategoryToArmoryId( static_cast< Common::EquipSlotCategory >( equippedItem->getSlot() ) ); auto freeSlot = player.getFreeContainerSlot( containerId ).second; diff --git a/src/world/Network/PacketWrappers/PcPartyUpdatePacket.h b/src/world/Network/PacketWrappers/PcPartyUpdatePacket.h index 57261ed8..ec6add44 100644 --- a/src/world/Network/PacketWrappers/PcPartyUpdatePacket.h +++ b/src/world/Network/PacketWrappers/PcPartyUpdatePacket.h @@ -7,15 +7,6 @@ namespace Sapphire::Network::Packets::WorldPackets::Server { - uint64_t ExecuteCharacterID; - uint64_t TargetCharacterID; - uint8_t ExecuteIdentity; - uint8_t TargetIdentity; - uint8_t UpdateStatus; - uint8_t Count; - char ExecuteCharacterName[32]; - char TargetCharacterName[32]; - class PcPartyUpdatePacket : public ZoneChannelPacket< FFXIVIpcPcPartyUpdate > { public: diff --git a/src/world/Network/PacketWrappers/PlayerSetupPacket.h b/src/world/Network/PacketWrappers/PlayerSetupPacket.h index ff505ea0..da562f69 100644 --- a/src/world/Network/PacketWrappers/PlayerSetupPacket.h +++ b/src/world/Network/PacketWrappers/PlayerSetupPacket.h @@ -50,7 +50,7 @@ namespace Sapphire::Network::Packets::WorldPackets::Server memcpy( m_data.Aetheryte, player.getAetheryteArray().data(), sizeof( m_data.Aetheryte ) ); // Set the class levels and exp. - for( uint8_t i = 0; i < 23; i++ ) + for( uint8_t i = 0; i < Common::CLASSJOB_TOTAL; ++i ) { m_data.Lv[ i ] = player.getClassArray()[ i ]; m_data.Exp[ i ] = player.getExpArray()[ i ]; diff --git a/src/world/WorldServer.cpp b/src/world/WorldServer.cpp index a0997aae..1b06ac5c 100644 --- a/src/world/WorldServer.cpp +++ b/src/world/WorldServer.cpp @@ -60,7 +60,8 @@ WorldServer::WorldServer( const std::string& configName ) : m_configName( configName ), m_bRunning( true ), m_lastDBPingTime( 0 ), - m_worldId( 67 ) + m_worldId( 67 ), + m_port( 0 ) { }