From a02e58fd35eb5e9a0387202fb67ce45a74bf768d Mon Sep 17 00:00:00 2001 From: Mordred Date: Tue, 17 Jan 2023 11:27:25 +0100 Subject: [PATCH] More overall cleanup and warning reductions --- src/world/Action/Action.cpp | 2 +- src/world/Manager/DebugCommandMgr.cpp | 43 +++++++++++++-------------- src/world/Manager/EventMgr.cpp | 16 ++++------ src/world/Manager/FriendListMgr.cpp | 3 -- src/world/Manager/HousingMgr.cpp | 19 ++++-------- src/world/Manager/InventoryMgr.cpp | 20 ++++++------- src/world/Manager/ItemMgr.cpp | 4 +-- src/world/Manager/LinkshellMgr.cpp | 14 +++------ src/world/Manager/LinkshellMgr.h | 2 +- src/world/Manager/MarketMgr.cpp | 4 --- src/world/Manager/PartyMgr.cpp | 3 +- src/world/Manager/PlayerMgr.cpp | 5 +--- src/world/Manager/QuestMgr.cpp | 3 -- src/world/Manager/ShopMgr.cpp | 1 - src/world/Manager/TerritoryMgr.cpp | 11 ++++--- src/world/Manager/WarpMgr.cpp | 4 --- 16 files changed, 57 insertions(+), 97 deletions(-) diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index d5163fc8..d7394234 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -42,7 +42,7 @@ using namespace Sapphire::World; Action::Action::Action() = default; Action::Action::~Action() = default; -Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence) : +Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence ) : Action( std::move( caster ), actionId, sequence, nullptr ) { } diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index db0886eb..7215954f 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -78,8 +78,8 @@ DebugCommandMgr::DebugCommandMgr() // clear all loaded commands DebugCommandMgr::~DebugCommandMgr() { - for( auto it = m_commandMap.begin(); it != m_commandMap.end(); ++it ) - ( *it ).second.reset(); + for( auto & it : m_commandMap ) + it.second.reset(); } // add a command set to the register map @@ -99,7 +99,7 @@ void DebugCommandMgr::execCommand( char* data, Entity::Player& player ) // check if the command has parameters std::string tmpCommand = std::string( data ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -139,7 +139,7 @@ void DebugCommandMgr::execCommand( char* data, Entity::Player& player ) void DebugCommandMgr::help( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ) { PlayerMgr::sendDebug( player, "Registered debug commands:" ); - for( auto cmd : m_commandMap ) + for( const auto& cmd : m_commandMap ) { if( player.getGmRank() >= cmd.second->m_gmLevel ) { @@ -156,13 +156,13 @@ void DebugCommandMgr::set( char* data, Entity::Player& player, std::shared_ptr< auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() ); auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref(); - std::string subCommand = ""; - std::string params = ""; + std::string subCommand; + std::string params; // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -176,7 +176,7 @@ void DebugCommandMgr::set( char* data, Entity::Player& player, std::shared_ptr< Logger::debug( "[{0}] subCommand: {1} params: {1}", player.getId(), subCommand, params ); - if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( params != "" ) ) + if( ( ( subCommand == "pos" ) || ( subCommand == "posr" ) ) && ( !params.empty() ) ) { int32_t posX; int32_t posY; @@ -206,14 +206,14 @@ void DebugCommandMgr::set( char* data, Entity::Player& player, std::shared_ptr< pSession->getZoneConnection()->queueOutPacket( setActorPosPacket ); } - else if( ( subCommand == "tele" ) && ( params != "" ) ) + else if( ( subCommand == "tele" ) && ( !params.empty() ) ) { int32_t aetheryteId; sscanf( params.c_str(), "%i", &aetheryteId ); player.teleport( static_cast< uint16_t >( aetheryteId ) ); } - else if( ( subCommand == "discovery" ) && ( params != "" ) ) + else if( ( subCommand == "discovery" ) && ( !params.empty() ) ) { int32_t map_id; int32_t discover_id; @@ -392,12 +392,12 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr< auto pCurrentZone = terriMgr.getTerritoryByGuId( player.getTerritoryId() ); std::string subCommand; - std::string params = ""; + std::string params; // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -566,12 +566,12 @@ void DebugCommandMgr::get( char* data, Entity::Player& player, std::shared_ptr< { auto& exdData = Common::Service< Data::ExdData >::ref(); std::string subCommand; - std::string params = ""; + std::string params; // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -624,12 +624,12 @@ void DebugCommandMgr::replay( char* data, Entity::Player& player, std::shared_pt auto& server = Common::Service< World::WorldServer >::ref(); std::string subCommand; - std::string params = ""; + std::string params; // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -681,7 +681,7 @@ void DebugCommandMgr::nudge( char* data, Entity::Player& player, std::shared_ptr // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t spos = tmpCommand.find_first_of( " " ); + std::size_t spos = tmpCommand.find_first_of( ' ' ); auto& pos = player.getPos(); @@ -733,12 +733,12 @@ void DebugCommandMgr::script( char* data, Entity::Player& player, std::shared_pt { auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref(); std::string subCommand; - std::string params = ""; + std::string params; // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part @@ -775,9 +775,8 @@ void DebugCommandMgr::script( char* data, Entity::Player& player, std::shared_pt { PlayerMgr::sendDebug( player, "Found {0} scripts", scripts.size() ); - for( auto it = scripts.begin(); it != scripts.end(); ++it ) + for( auto script : scripts ) { - auto script = *it; PlayerMgr::sendDebug( player, " - '{0}', num scripts: {1}", script->library_name, script->scripts.size() ); } } @@ -1411,7 +1410,7 @@ void DebugCommandMgr::easyWarp( char* data, Sapphire::Entity::Player& player, st // check if the command has parameters std::string tmpCommand = std::string( data + command->getName().length() + 1 ); - std::size_t pos = tmpCommand.find_first_of( " " ); + std::size_t pos = tmpCommand.find_first_of( ' ' ); if( pos != std::string::npos ) // command has parameters, grab the first part diff --git a/src/world/Manager/EventMgr.cpp b/src/world/Manager/EventMgr.cpp index 05cdd1de..79486695 100644 --- a/src/world/Manager/EventMgr.cpp +++ b/src/world/Manager/EventMgr.cpp @@ -6,7 +6,6 @@ #include "PlayerMgr.h" #include "ShopMgr.h" #include "Event/EventHandler.h" -#include "Event/Director.h" #include "Event/EventDefs.h" #include @@ -14,8 +13,6 @@ #include #include "Network/GameConnection.h" -#include "Network/PacketWrappers/ActorControlPacket.h" -#include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/EventStartPacket.h" #include "Network/PacketWrappers/EventPlayPacket.h" @@ -26,7 +23,6 @@ #include "Territory/Territory.h" #include "Territory/InstanceContent.h" -#include "Territory/QuestBattle.h" #include "Action/EventAction.h" #include "WorldServer.h" @@ -53,7 +49,7 @@ std::string EventMgr::getEventName( uint32_t eventId ) return unknown + "Quest"; std::string name = questInfo->getString( questInfo->data().Text.Name ); - std::size_t pos = name.find_first_of( "_" ); + std::size_t pos = name.find_first_of( '_' ); return name.substr( 0, pos ); } @@ -64,7 +60,7 @@ std::string EventMgr::getEventName( uint32_t eventId ) return unknown + "CustomTalk"; std::string name = customTalkInfo->getString( customTalkInfo->data().Text.Name ); - std::size_t pos = name.find_first_of( "_" ); + std::size_t pos = name.find_first_of( '_' ); return name.substr( 0, pos ); } @@ -557,11 +553,11 @@ void EventMgr::playGilShop( Entity::Player& player, uint32_t eventId, uint32_t f params[ 1 ] = static_cast< uint32_t >( params.size() - 3 ); //new max item size auto& exdData = Common::Service< Data::ExdData >::ref(); - for( auto it = player.getSoldItems()->cbegin(); it != player.getSoldItems()->cend(); ++it ) + for( auto it : *player.getSoldItems() ) { - auto item = exdData.getRow< Excel::Item >( it->first ); - params.push_back( it->first ); //itemCatalogId - params.push_back( it->second ); //stack + auto item = exdData.getRow< Excel::Item >( it.first ); + params.push_back( it.first ); //itemCatalogId + params.push_back( it.second ); //stack params.push_back( item->data().Price ); //price params.push_back( 0 );//flag isHQ params.push_back( 0 );//numOfMateria diff --git a/src/world/Manager/FriendListMgr.cpp b/src/world/Manager/FriendListMgr.cpp index e711d9b1..ddf9b989 100644 --- a/src/world/Manager/FriendListMgr.cpp +++ b/src/world/Manager/FriendListMgr.cpp @@ -1,8 +1,5 @@ -#include #include -#include -#include #include #include "Actor/Player.h" diff --git a/src/world/Manager/HousingMgr.cpp b/src/world/Manager/HousingMgr.cpp index 539515c6..db44c1a7 100644 --- a/src/world/Manager/HousingMgr.cpp +++ b/src/world/Manager/HousingMgr.cpp @@ -19,12 +19,9 @@ #include "Event/EventDefs.h" #include "TerritoryMgr.h" -#include "Territory/Territory.h" #include "Territory/HousingZone.h" #include "Territory/Housing/HousingInteriorTerritory.h" -#include "HousingMgr.h" #include "EventMgr.h" -#include "TerritoryMgr.h" #include "Territory/Land.h" #include "WorldServer.h" #include "Territory/House.h" @@ -245,7 +242,7 @@ void HousingMgr::initLandCache() auto& containers = getEstateInventory( ident ); - auto makeContainer = [ &containers, this ]( Common::InventoryType type, uint16_t size ) + auto makeContainer = [ &containers ]( Common::InventoryType type, uint16_t size ) { containers[ type ] = make_ItemContainer( type, size, "houseiteminventory", false, false ); }; @@ -649,15 +646,15 @@ bool HousingMgr::initHouseModels( Entity::Player& player, LandPtr land, uint32_t { auto& container = houseInventory[ destContainer.first ]; - for( auto& item : destContainer.second ) + for( auto& itemIt : destContainer.second ) { // small houses attic is just 0, ignore them - if( item.second == 0 ) + if( itemIt.second == 0 ) continue; - auto pItem = invMgr.createItem( player, static_cast< uint32_t >( item.second ) ); + auto pItem = invMgr.createItem( player, static_cast< uint32_t >( itemIt.second ) ); - container->setItem( static_cast< uint8_t >( item.first ), pItem ); + container->setItem( static_cast< uint8_t >( itemIt.first ), pItem ); } invMgr.saveHousingContainer( land->getLandIdent(), container ); @@ -880,7 +877,6 @@ void HousingMgr::sendEstateInventory( Entity::Player& player, uint16_t inventory auto ident = internalZone->getLandIdent(); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -1028,7 +1024,6 @@ void HousingMgr::reqPlaceHousingItem( Entity::Player& player, uint16_t landId, u auto ident = zone->getLandIdent(); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -1104,7 +1099,6 @@ void HousingMgr::reqPlaceItemInStore( Entity::Player& player, uint16_t landId, u auto ident = zone->getLandIdent(); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); @@ -1232,7 +1226,7 @@ bool HousingMgr::placeInteriorItem( Entity::Player& player, Inventory::HousingIt invMgr.saveHousingContainer( ident, container ); invMgr.updateHousingItemPosition( item ); - auto zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ); + zone = std::dynamic_pointer_cast< Territory::Housing::HousingInteriorTerritory >( pZone ); assert( zone ); zone->spawnHousingObject( containerIdx, static_cast< uint16_t >( freeSlot ), containerId, item ); @@ -1410,7 +1404,6 @@ void HousingMgr::reqRemoveHousingItem( Entity::Player& player, uint16_t plot, ui auto ident = terri->getLandIdent(); auto landSetId = toLandSetId( ident.territoryTypeId, ident.wardNum ); - auto& teriMgr = Common::Service< World::Manager::TerritoryMgr >::ref(); auto pTeri = teriMgr.getTerritoryByGuId( landSetId ); auto hZone = std::dynamic_pointer_cast< HousingZone >( pTeri ); diff --git a/src/world/Manager/InventoryMgr.cpp b/src/world/Manager/InventoryMgr.cpp index 35df61f1..4bf294f7 100644 --- a/src/world/Manager/InventoryMgr.cpp +++ b/src/world/Manager/InventoryMgr.cpp @@ -30,18 +30,18 @@ void InventoryMgr::sendInventoryContainer( Entity::Player& player, ItemContainer auto sequence = player.getNextInventorySequence(); auto pMap = container->getItemMap(); - for( auto itM = pMap.begin(); itM != pMap.end(); ++itM ) + for( auto & itM : pMap ) { - if( !itM->second ) + if( !itM.second ) return; if( container->getId() == Common::InventoryType::Currency || container->getId() == Common::InventoryType::Crystal ) { auto currencyInfoPacket = makeZonePacket< FFXIVIpcGilItem >( player.getId() ); currencyInfoPacket->data().contextId = sequence; - currencyInfoPacket->data().item.catalogId = itM->second->getId(); + currencyInfoPacket->data().item.catalogId = itM.second->getId(); currencyInfoPacket->data().item.subquarity = 1; - currencyInfoPacket->data().item.stack = itM->second->getStackSize(); + currencyInfoPacket->data().item.stack = itM.second->getStackSize(); currencyInfoPacket->data().item.storageId = container->getId(); currencyInfoPacket->data().item.containerIndex = 0; @@ -52,15 +52,15 @@ void InventoryMgr::sendInventoryContainer( Entity::Player& player, ItemContainer auto itemInfoPacket = makeZonePacket< FFXIVIpcNormalItem >( player.getId() ); itemInfoPacket->data().contextId = sequence; itemInfoPacket->data().item.storageId = container->getId(); - itemInfoPacket->data().item.containerIndex = itM->first; - itemInfoPacket->data().item.stack = itM->second->getStackSize(); - itemInfoPacket->data().item.catalogId = itM->second->getId(); - itemInfoPacket->data().item.durability = itM->second->getDurability(); + itemInfoPacket->data().item.containerIndex = itM.first; + itemInfoPacket->data().item.stack = itM.second->getStackSize(); + itemInfoPacket->data().item.catalogId = itM.second->getId(); + itemInfoPacket->data().item.durability = itM.second->getDurability(); // itemInfoPacket->data().spiritBond = itM->second->getSpiritbond(); // itemInfoPacket->data().reservedFlag = itM->second->getReservedFlag(); // todo: not sure if correct flag? - itemInfoPacket->data().item.flags = static_cast< uint8_t >( itM->second->isHq() ? 1 : 0 ); - itemInfoPacket->data().item.stain = itM->second->getStain(); + itemInfoPacket->data().item.flags = static_cast< uint8_t >( itM.second->isHq() ? 1 : 0 ); + itemInfoPacket->data().item.stain = static_cast< uint8_t >( itM.second->getStain() ); server.queueForPlayer( player.getCharacterId(), itemInfoPacket ); } diff --git a/src/world/Manager/ItemMgr.cpp b/src/world/Manager/ItemMgr.cpp index b96579a1..32ba611d 100644 --- a/src/world/Manager/ItemMgr.cpp +++ b/src/world/Manager/ItemMgr.cpp @@ -1,11 +1,9 @@ #include "ItemMgr.h" -#include "Inventory/ItemContainer.h" #include "Inventory/Item.h" #include #include -#include #include #include @@ -180,7 +178,7 @@ Common::ContainerType ItemMgr::getContainerType( uint32_t containerId ) uint32_t ItemMgr::getNextUId() { - uint32_t charId = 0; + uint32_t charId; auto& db = Common::Service< Db::DbWorkerPool< Db::ZoneDbConnection > >::ref(); auto pQR = db.query( "SELECT MAX(ItemId) FROM charaglobalitem" ); diff --git a/src/world/Manager/LinkshellMgr.cpp b/src/world/Manager/LinkshellMgr.cpp index 3b81951b..29912da0 100644 --- a/src/world/Manager/LinkshellMgr.cpp +++ b/src/world/Manager/LinkshellMgr.cpp @@ -1,14 +1,11 @@ -#include #include #include #include -#include #include #include #include -#include #include #include @@ -20,7 +17,6 @@ #include "WorldServer.h" #include -#include #include #include #include @@ -48,7 +44,7 @@ bool LinkshellMgr::loadLinkshells() auto func = []( std::set< uint64_t >& outList, std::vector< char >& inData ) { - if( inData.size() ) + if( !inData.empty() ) { size_t entryCount = inData.size() / 8; std::vector< uint64_t > list( entryCount ); @@ -128,7 +124,7 @@ void LinkshellMgr::writeLinkshell( uint64_t lsId ) query->setBinary( 3, leaderBin ); query->setBinary( 4, inviteBin ); query->setUInt64( 5, ls->getMasterId() ); - query->setInt64( 6, lsId ); + query->setInt64( 6, static_cast< int64_t >( lsId ) ); db.execute( query ); } @@ -227,7 +223,7 @@ void LinkshellMgr::finishLinkshellAction( const std::string& name, uint32_t resu } -const std::vector< LinkshellPtr > LinkshellMgr::getPlayerLinkshells( Entity::Player& player ) const +std::vector< LinkshellPtr > LinkshellMgr::getPlayerLinkshells( Entity::Player& player ) const { std::vector< LinkshellPtr > lsVec; @@ -321,7 +317,7 @@ void LinkshellMgr::sendLinkshellList( Entity::Player& player ) for( int i = 0; i < lsVec.size(); ++i ) { auto pLs = lsVec[ i ]; - uint32_t hierarchy = 0; + uint32_t hierarchy; if( pLs->getMasterId() == player.getCharacterId() ) hierarchy = Common::Ls::LinkshellHierarchy::Master << 8; @@ -486,8 +482,6 @@ void LinkshellMgr::changeMaster( Entity::Player &sourcePlayer, Entity::Player &n bool LinkshellMgr::renameLinkshell( uint64_t linkshellId, const std::string &name, Entity::Player &player ) { - auto& server = Common::Service< World::WorldServer >::ref(); - auto lsPtr = getLinkshellById( linkshellId ); if( !lsPtr ) diff --git a/src/world/Manager/LinkshellMgr.h b/src/world/Manager/LinkshellMgr.h index 398fd09f..14b579a0 100644 --- a/src/world/Manager/LinkshellMgr.h +++ b/src/world/Manager/LinkshellMgr.h @@ -51,7 +51,7 @@ namespace Sapphire::World::Manager void sendLinkshellList( Entity::Player& player ); // get all linkshells associated with player - const std::vector< LinkshellPtr > getPlayerLinkshells( Entity::Player& player ) const; + std::vector< LinkshellPtr > getPlayerLinkshells( Entity::Player& player ) const; LinkshellPtr getLinkshellById( uint64_t lsId ); diff --git a/src/world/Manager/MarketMgr.cpp b/src/world/Manager/MarketMgr.cpp index 9578ea9a..ec48d013 100644 --- a/src/world/Manager/MarketMgr.cpp +++ b/src/world/Manager/MarketMgr.cpp @@ -1,9 +1,5 @@ #include "MarketMgr.h" -#include -#include - -#include #include #include diff --git a/src/world/Manager/PartyMgr.cpp b/src/world/Manager/PartyMgr.cpp index ed2fcbee..3365487e 100644 --- a/src/world/Manager/PartyMgr.cpp +++ b/src/world/Manager/PartyMgr.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include @@ -365,7 +364,7 @@ void PartyMgr::sendPartyUpdate( Party& party ) if( !classJob ) continue; - ZoneProtoDownPartyMember memberEntry; + ZoneProtoDownPartyMember memberEntry{}; memberEntry.ParentEntityId = Common::INVALID_GAME_OBJECT_ID; memberEntry.PetEntityId = Common::INVALID_GAME_OBJECT_ID; diff --git a/src/world/Manager/PlayerMgr.cpp b/src/world/Manager/PlayerMgr.cpp index 634d8df7..1f6bb526 100644 --- a/src/world/Manager/PlayerMgr.cpp +++ b/src/world/Manager/PlayerMgr.cpp @@ -7,7 +7,6 @@ #include #include -#include #include "Script/ScriptMgr.h" #include "WorldServer.h" @@ -23,14 +22,12 @@ #include #include #include -#include "Network/PacketWrappers/PlayerSetupPacket.h" #include "Network/PacketWrappers/ServerNoticePacket.h" #include "Network/PacketWrappers/ChatPacket.h" #include "Network/PacketWrappers/HudParamPacket.h" #include #include -#include "Territory/InstanceObjectCache.h" using namespace Sapphire; using namespace Sapphire::World::Manager; @@ -61,7 +58,6 @@ void PlayerMgr::onOnlineStatusChanged( Entity::Player& player, bool updateProfil void PlayerMgr::onEquipDisplayFlagsChanged( Entity::Player& player ) { - auto& server = Common::Service< World::WorldServer >::ref(); auto paramPacket = makeZonePacket< FFXIVIpcConfig >( player.getId() ); paramPacket->data().flag = player.getEquipDisplayFlags(); player.sendToInRangeSet( paramPacket, true ); @@ -80,6 +76,7 @@ void PlayerMgr::onSendStateFlags( Entity::Player& player, bool updateInRange ) void PlayerMgr::onSendStats( Entity::Player& player ) { std::array< uint32_t, 50 > statParams; + std::fill( std::begin( statParams ), std::end( statParams ), 0 ); auto& exd = Common::Service< Data::ExdData >::ref(); diff --git a/src/world/Manager/QuestMgr.cpp b/src/world/Manager/QuestMgr.cpp index e76119d3..c03f7ac1 100644 --- a/src/world/Manager/QuestMgr.cpp +++ b/src/world/Manager/QuestMgr.cpp @@ -1,12 +1,10 @@ #include #include -#include #include #include "WorldServer.h" #include -#include #include #include "Network/GameConnection.h" @@ -60,7 +58,6 @@ void QuestMgr::onRemoveQuest( Entity::Player &player, uint8_t questIndex ) bool QuestMgr::giveQuestRewards( Entity::Player& player, uint16_t questId, uint32_t optionalChoice ) { auto& exdData = Common::Service< Data::ExdData >::ref(); - uint32_t playerLevel = player.getLevel(); auto questInfo = exdData.getRow< Excel::Quest >( static_cast< uint32_t >( Event::EventHandler::EventHandlerType::Quest ) << 16 | questId ); if( !questInfo ) diff --git a/src/world/Manager/ShopMgr.cpp b/src/world/Manager/ShopMgr.cpp index 2c23293f..2edeec1c 100644 --- a/src/world/Manager/ShopMgr.cpp +++ b/src/world/Manager/ShopMgr.cpp @@ -54,7 +54,6 @@ uint32_t ShopMgr::getShopItemPrices( uint32_t shopId, uint8_t index ) return getShopItemPrices( shopId, index ); } - return 0; } bool ShopMgr::purchaseGilShopItem( Entity::Player& player, uint32_t shopId, uint16_t itemId, uint32_t quantity ) diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index 5502409a..2c830871 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -10,7 +10,6 @@ #include "Actor/Player.h" -#include "Territory/Territory.h" #include "Territory/InstanceContent.h" #include "Territory/QuestBattle.h" #include "TerritoryMgr.h" @@ -519,9 +518,9 @@ void TerritoryMgr::updateTerritoryInstances( uint64_t tickCount ) } // remove internal house zones with nobody in them - for( auto it = m_questBattleIdToInstanceMap.begin(); it != m_questBattleIdToInstanceMap.end(); ++it ) + for( auto & it : m_questBattleIdToInstanceMap ) { - for( auto inIt = it->second.begin(); inIt != it->second.end(); ) + for( auto inIt = it.second.begin(); inIt != it.second.end(); ) { auto zone = std::dynamic_pointer_cast< QuestBattle >( inIt->second ); if( !zone ) @@ -545,9 +544,9 @@ void TerritoryMgr::updateTerritoryInstances( uint64_t tickCount ) } - for( auto it = m_instanceContentIdToInstanceMap.begin(); it != m_instanceContentIdToInstanceMap.end(); ++it ) + for( auto& it : m_instanceContentIdToInstanceMap ) { - for( auto inIt = it->second.begin(); inIt != it->second.end(); ) + for( auto inIt = it.second.begin(); inIt != it.second.end(); ) { auto zone = std::dynamic_pointer_cast< InstanceContent >( inIt->second ); if( !zone ) @@ -668,7 +667,7 @@ void TerritoryMgr::createAndJoinQuestBattle( Entity::Player& player, uint16_t qu bool TerritoryMgr::joinWorld( Entity::Player& player ) { - TerritoryPtr pCurrZone = nullptr; + TerritoryPtr pCurrZone; auto territoryTypeId = player.getTerritoryTypeId(); diff --git a/src/world/Manager/WarpMgr.cpp b/src/world/Manager/WarpMgr.cpp index 324638f9..b5b23f97 100644 --- a/src/world/Manager/WarpMgr.cpp +++ b/src/world/Manager/WarpMgr.cpp @@ -1,4 +1,3 @@ -#include #include #include "TaskMgr.h" @@ -13,7 +12,6 @@ #include "Territory/Territory.h" #include "Network/PacketWrappers/ActorControlSelfPacket.h" #include "Network/PacketWrappers/ActorControlPacket.h" -#include "Network/PacketWrappers/WarpPacket.h" #include "Actor/Player.h" using namespace Sapphire::World::Manager; @@ -98,8 +96,6 @@ void WarpMgr::finishWarp( Entity::Player& player ) void WarpMgr::requestWarp( Entity::Player& player, Common::WarpType warpType, Common::FFXIVARR_POSITION3 targetPos, float targetRot ) { m_entityIdToWarpInfoMap[ player.getId() ] = { 0, warpType, targetPos, targetRot }; - auto& teriMgr = Common::Service< TerritoryMgr >::ref(); - auto& server = Common::Service< WorldServer >::ref(); player.sendToInRangeSet( makeActorControl( player.getId(), WarpStart, warpType, 1, 0, player.getTerritoryTypeId(), 1 ), true ); player.sendToInRangeSet( makeActorControl( player.getId(), ActorDespawnEffect, warpType ) );