mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 16:17:46 +00:00
Some clang-tidy cleanups
This commit is contained in:
parent
125c02d127
commit
8eb0638848
2 changed files with 19 additions and 20 deletions
|
@ -427,7 +427,6 @@ bool Sapphire::Entity::BNpc::moveTo( const Entity::Chara& targetChara )
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::sendPositionUpdate()
|
void Sapphire::Entity::BNpc::sendPositionUpdate()
|
||||||
{
|
{
|
||||||
uint8_t unk1 = 0x3a;
|
|
||||||
uint8_t animationType = 2;
|
uint8_t animationType = 2;
|
||||||
|
|
||||||
if( m_state == BNpcState::Combat || m_state == BNpcState::Retreat )
|
if( m_state == BNpcState::Combat || m_state == BNpcState::Retreat )
|
||||||
|
@ -468,7 +467,7 @@ Sapphire::Entity::CharaPtr Sapphire::Entity::BNpc::hateListGetHighest()
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::hateListAdd( Sapphire::Entity::CharaPtr pChara, int32_t hateAmount )
|
void Sapphire::Entity::BNpc::hateListAdd( const Sapphire::Entity::CharaPtr& pChara, int32_t hateAmount )
|
||||||
{
|
{
|
||||||
auto hateEntry = std::make_shared< HateListEntry >();
|
auto hateEntry = std::make_shared< HateListEntry >();
|
||||||
hateEntry->m_hateAmount = static_cast< uint32_t >( hateAmount );
|
hateEntry->m_hateAmount = static_cast< uint32_t >( hateAmount );
|
||||||
|
@ -482,9 +481,9 @@ void Sapphire::Entity::BNpc::hateListAdd( Sapphire::Entity::CharaPtr pChara, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::hateListUpdate( Sapphire::Entity::CharaPtr pChara, int32_t hateAmount )
|
void Sapphire::Entity::BNpc::hateListUpdate( const Sapphire::Entity::CharaPtr& pChara, int32_t hateAmount )
|
||||||
{
|
{
|
||||||
for( auto listEntry : m_hateList )
|
for( const auto& listEntry : m_hateList )
|
||||||
{
|
{
|
||||||
if( listEntry->m_pChara == pChara )
|
if( listEntry->m_pChara == pChara )
|
||||||
{
|
{
|
||||||
|
@ -499,9 +498,9 @@ void Sapphire::Entity::BNpc::hateListUpdate( Sapphire::Entity::CharaPtr pChara,
|
||||||
m_hateList.insert( hateEntry );
|
m_hateList.insert( hateEntry );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::hateListRemove( Sapphire::Entity::CharaPtr pChara )
|
void Sapphire::Entity::BNpc::hateListRemove( const Sapphire::Entity::CharaPtr& pChara )
|
||||||
{
|
{
|
||||||
for( auto listEntry : m_hateList )
|
for( const auto& listEntry : m_hateList )
|
||||||
{
|
{
|
||||||
if( listEntry->m_pChara == pChara )
|
if( listEntry->m_pChara == pChara )
|
||||||
{
|
{
|
||||||
|
@ -527,7 +526,7 @@ void Sapphire::Entity::BNpc::setTriggerOwnerId( uint32_t triggerOwnerId )
|
||||||
m_triggerOwnerId = triggerOwnerId;
|
m_triggerOwnerId = triggerOwnerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sapphire::Entity::BNpc::hateListHasActor( Sapphire::Entity::CharaPtr pChara )
|
bool Sapphire::Entity::BNpc::hateListHasActor( const Sapphire::Entity::CharaPtr& pChara )
|
||||||
{
|
{
|
||||||
for( auto& listEntry : m_hateList )
|
for( auto& listEntry : m_hateList )
|
||||||
{
|
{
|
||||||
|
@ -537,7 +536,7 @@ bool Sapphire::Entity::BNpc::hateListHasActor( Sapphire::Entity::CharaPtr pChara
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::aggro( Sapphire::Entity::CharaPtr pChara )
|
void Sapphire::Entity::BNpc::aggro( const Sapphire::Entity::CharaPtr& pChara )
|
||||||
{
|
{
|
||||||
auto& pRNGMgr = Common::Service< World::Manager::RNGMgr >::ref();
|
auto& pRNGMgr = Common::Service< World::Manager::RNGMgr >::ref();
|
||||||
auto variation = static_cast< uint32_t >( pRNGMgr.getRandGenerator< float >( 500, 1000 ).next() );
|
auto variation = static_cast< uint32_t >( pRNGMgr.getRandGenerator< float >( 500, 1000 ).next() );
|
||||||
|
@ -560,7 +559,7 @@ void Sapphire::Entity::BNpc::aggro( Sapphire::Entity::CharaPtr pChara )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::deaggro( Sapphire::Entity::CharaPtr pChara )
|
void Sapphire::Entity::BNpc::deaggro( const Sapphire::Entity::CharaPtr& pChara )
|
||||||
{
|
{
|
||||||
if( !hateListHasActor( pChara ) )
|
if( !hateListHasActor( pChara ) )
|
||||||
hateListRemove( pChara );
|
hateListRemove( pChara );
|
||||||
|
@ -858,7 +857,7 @@ void Sapphire::Entity::BNpc::checkAggro()
|
||||||
if( levelDiff >= 10 )
|
if( levelDiff >= 10 )
|
||||||
range = 0.f;
|
range = 0.f;
|
||||||
else
|
else
|
||||||
range = std::max< float >( 0.f, range - std::pow( 1.53f, levelDiff * 0.6f ) );
|
range = std::max< float >( 0.f, range - std::pow( 1.53f, static_cast< float >( levelDiff ) * 0.6f ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto distance = Util::distance( getPos().x, getPos().y, getPos().z,
|
auto distance = Util::distance( getPos().x, getPos().y, getPos().z,
|
||||||
|
@ -873,7 +872,7 @@ void Sapphire::Entity::BNpc::checkAggro()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::setOwner( Sapphire::Entity::CharaPtr m_pChara )
|
void Sapphire::Entity::BNpc::setOwner( const Sapphire::Entity::CharaPtr& m_pChara )
|
||||||
{
|
{
|
||||||
m_pOwner = m_pChara;
|
m_pOwner = m_pChara;
|
||||||
if( m_pChara != nullptr )
|
if( m_pChara != nullptr )
|
||||||
|
@ -958,8 +957,8 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::calculateStats()
|
void Sapphire::Entity::BNpc::calculateStats()
|
||||||
{
|
{
|
||||||
uint8_t level = getLevel();
|
auto level = getLevel();
|
||||||
uint8_t job = static_cast< uint8_t >( getClass() );
|
auto job = static_cast< uint8_t >( getClass() );
|
||||||
|
|
||||||
auto& exdData = Common::Service< Data::ExdData >::ref();
|
auto& exdData = Common::Service< Data::ExdData >::ref();
|
||||||
|
|
||||||
|
|
|
@ -104,13 +104,13 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
void hateListClear();
|
void hateListClear();
|
||||||
CharaPtr hateListGetHighest();
|
CharaPtr hateListGetHighest();
|
||||||
void hateListAdd( CharaPtr pChara, int32_t hateAmount );
|
void hateListAdd( const CharaPtr& pChara, int32_t hateAmount );
|
||||||
void hateListUpdate( CharaPtr pChara, int32_t hateAmount );
|
void hateListUpdate( const CharaPtr& pChara, int32_t hateAmount );
|
||||||
void hateListRemove( CharaPtr pChara );
|
void hateListRemove( const CharaPtr& pChara );
|
||||||
bool hateListHasActor( CharaPtr pChara );
|
bool hateListHasActor( const CharaPtr& pChara );
|
||||||
|
|
||||||
void aggro( CharaPtr pChara );
|
void aggro( const CharaPtr& pChara );
|
||||||
void deaggro( CharaPtr pChara );
|
void deaggro( const CharaPtr& pChara );
|
||||||
|
|
||||||
void update( uint64_t tickCount ) override;
|
void update( uint64_t tickCount ) override;
|
||||||
void onTick() override;
|
void onTick() override;
|
||||||
|
@ -128,7 +128,7 @@ namespace Sapphire::Entity
|
||||||
|
|
||||||
void checkAggro();
|
void checkAggro();
|
||||||
|
|
||||||
void setOwner( CharaPtr m_pChara );
|
void setOwner( const CharaPtr& m_pChara );
|
||||||
|
|
||||||
void setLevelId( uint32_t levelId );
|
void setLevelId( uint32_t levelId );
|
||||||
uint32_t getLevelId() const;
|
uint32_t getLevelId() const;
|
||||||
|
|
Loading…
Add table
Reference in a new issue