From 065c1817bd3dd1e04c43e7adb43f91203b2ba7b7 Mon Sep 17 00:00:00 2001 From: Mordred Date: Mon, 20 Feb 2023 16:41:04 +0100 Subject: [PATCH] Missed a few state flags functions during renaming. --- src/world/Action/EventAction.cpp | 2 +- src/world/Actor/Player.cpp | 6 +++--- src/world/Actor/Player.h | 10 +++++----- src/world/Manager/EventMgr.cpp | 2 +- src/world/Network/Handlers/PacketHandlers.cpp | 6 +++--- src/world/Network/PacketWrappers/ConditionPacket.h | 2 +- src/world/Territory/InstanceContent.cpp | 2 +- src/world/Territory/QuestBattle.cpp | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/world/Action/EventAction.cpp b/src/world/Action/EventAction.cpp index 847b3798..57985df5 100644 --- a/src/world/Action/EventAction.cpp +++ b/src/world/Action/EventAction.cpp @@ -61,7 +61,7 @@ void Action::EventAction::start() server().queueForPlayers( m_pSource->getInRangePlayerIds( true ), control ); - if( pPlayer->hasStateFlag( PlayerCondition::InNpcEvent ) ) + if( pPlayer->hasCondition( PlayerCondition::InNpcEvent ) ) Service< World::Manager::PlayerMgr >::ref().removeCondition( *pPlayer, PlayerCondition::InNpcEvent ); } else diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 68b6c763..e38c3444 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -861,12 +861,12 @@ void Player::setGcRankAt( uint8_t index, uint8_t rank ) m_gcRank[ index ] = rank; } -const Player::StateFlags& Player::getStateFlags() const +const Player::Condition& Player::getConditions() const { return m_condition; } -bool Player::hasStateFlag( Common::PlayerCondition flag ) const +bool Player::hasCondition( Common::PlayerCondition flag ) const { auto iFlag = static_cast< int32_t >( flag ); @@ -890,7 +890,7 @@ void Player::setCondition( Common::PlayerCondition flag ) void Player::removeCondition( Common::PlayerCondition flag ) { - if( !hasStateFlag( flag ) ) + if( !hasCondition( flag ) ) return; auto iFlag = static_cast< int32_t >( flag ); diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index e3ae41da..74977910 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -34,7 +34,7 @@ namespace Sapphire::Entity using AetheryteList = std::array< uint8_t, Common::ARRSIZE_AETHERYTES >; using UnlockList = std::array< uint8_t, Common::ARRSIZE_UNLOCKS >; using OrchestrionList = std::array< uint8_t, Common::ARRSIZE_ORCHESTRION >; - using StateFlags = std::array< uint8_t, 12 >; + using Condition = std::array< uint8_t, 12 >; using ClassList = std::array< uint16_t, Common::ARRSIZE_CLASSJOB >; using ExpList = std::array< uint32_t, Common::ARRSIZE_CLASSJOB >; @@ -526,16 +526,16 @@ namespace Sapphire::Entity // Player State Handling ////////////////////////////////////////////////////////////////////////////////////////////////////// /* return a const pointer to the state flag array */ - const StateFlags& getStateFlags() const; + const Condition& getConditions() const; /* set a specified state flag */ void setCondition( Common::PlayerCondition flag ); /* set a specified state flag */ - void setStateFlags( std::vector< Common::PlayerCondition > flags ); + void setConditions( std::vector< Common::PlayerCondition > flags ); /* check if a specified flag is set */ - bool hasStateFlag( Common::PlayerCondition flag ) const; + bool hasCondition( Common::PlayerCondition flag ) const; /* reset a specified flag */ void removeCondition( Common::PlayerCondition flag ); @@ -901,7 +901,7 @@ namespace Sapphire::Entity OrchestrionList m_orchestrion{}; ClassList m_classArray{}; ExpList m_expArray{}; - StateFlags m_condition{}; + Condition m_condition{}; Common::ClassJob m_firstClass{}; diff --git a/src/world/Manager/EventMgr.cpp b/src/world/Manager/EventMgr.cpp index f2a474d9..81ddefc4 100644 --- a/src/world/Manager/EventMgr.cpp +++ b/src/world/Manager/EventMgr.cpp @@ -550,7 +550,7 @@ void EventMgr::eventFinish( Sapphire::Entity::Player& player, uint32_t eventId, } } - if( player.hasStateFlag( Common::PlayerCondition::WatchingCutscene ) ) + if( player.hasCondition( Common::PlayerCondition::WatchingCutscene ) ) Common::Service< World::Manager::PlayerMgr >::ref().removeCondition( player, Common::PlayerCondition::WatchingCutscene ); player.removeEvent( pEvent->getId() ); diff --git a/src/world/Network/Handlers/PacketHandlers.cpp b/src/world/Network/Handlers/PacketHandlers.cpp index 34be2bf3..b2cc81f0 100644 --- a/src/world/Network/Handlers/PacketHandlers.cpp +++ b/src/world/Network/Handlers/PacketHandlers.cpp @@ -182,7 +182,7 @@ void Sapphire::Network::GameConnection::joinChatChannelHandler( const Packets::F void Sapphire::Network::GameConnection::moveHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player ) { - if( player.hasStateFlag( Common::BetweenAreas ) ) + if( player.hasCondition( Common::BetweenAreas ) ) return; const auto updatePositionPacket = ZoneChannelPacket< Client::FFXIVIpcUpdatePosition >( inPacket ); auto& data = updatePositionPacket.data(); @@ -523,7 +523,7 @@ void Sapphire::Network::GameConnection::tellHandler( const Packets::FFXIVARR_PAC auto pTargetPlayer = pSession->getPlayer(); - if( pTargetPlayer->hasStateFlag( PlayerCondition::BetweenAreas ) ) + if( pTargetPlayer->hasCondition( PlayerCondition::BetweenAreas ) ) { // send error for player between areas // TODO: implement me @@ -538,7 +538,7 @@ void Sapphire::Network::GameConnection::tellHandler( const Packets::FFXIVARR_PAC return; } - if( pTargetPlayer->hasStateFlag( PlayerCondition::BoundByDuty ) && !player.isActingAsGm() ) + if( pTargetPlayer->hasCondition( PlayerCondition::BoundByDuty ) && !player.isActingAsGm() ) { auto boundPacket = makeChatPacket< Packets::Server::FFXIVRecvFinderStatus >( player.getId() ); strcpy( boundPacket->data().toName, data.toName ); diff --git a/src/world/Network/PacketWrappers/ConditionPacket.h b/src/world/Network/PacketWrappers/ConditionPacket.h index a05654bb..6edfb4d4 100644 --- a/src/world/Network/PacketWrappers/ConditionPacket.h +++ b/src/world/Network/PacketWrappers/ConditionPacket.h @@ -17,7 +17,7 @@ namespace Sapphire::Network::Packets::WorldPackets::Server ConditionPacket( Entity::Player& player ) : ZoneChannelPacket< FFXIVIpcCondition >( player.getId(), player.getId() ) { - initialize( player.getStateFlags().data() ); + initialize( player.getConditions().data() ); } ConditionPacket( Entity::Player& player, std::vector< Common::PlayerCondition > flags ) : diff --git a/src/world/Territory/InstanceContent.cpp b/src/world/Territory/InstanceContent.cpp index 661b9a68..1c44f9f2 100644 --- a/src/world/Territory/InstanceContent.cpp +++ b/src/world/Territory/InstanceContent.cpp @@ -140,7 +140,7 @@ void Sapphire::InstanceContent::onUpdate( uint64_t tickCount ) auto player = it->second; if( !player->isLoadingComplete() || !player->isDirectorInitialized() || - player->hasStateFlag( PlayerCondition::WatchingCutscene ) ) + player->hasCondition( PlayerCondition::WatchingCutscene ) ) return; } diff --git a/src/world/Territory/QuestBattle.cpp b/src/world/Territory/QuestBattle.cpp index 8e9ba7b9..a0f3f408 100644 --- a/src/world/Territory/QuestBattle.cpp +++ b/src/world/Territory/QuestBattle.cpp @@ -118,7 +118,7 @@ void Sapphire::QuestBattle::onUpdate( uint64_t tickCount ) if( !m_pPlayer->isLoadingComplete() || !m_pPlayer->isDirectorInitialized() || !m_pPlayer->isOnEnterEventDone() || - m_pPlayer->hasStateFlag( PlayerCondition::WatchingCutscene ) ) + m_pPlayer->hasCondition( PlayerCondition::WatchingCutscene ) ) return; if( m_instanceCommenceTime == 0 )