1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 14:07:46 +00:00

ActorFilters now functional

This commit is contained in:
mordred 2019-04-05 13:15:14 +02:00
parent ec691c5499
commit 127d969eec
4 changed files with 16 additions and 10 deletions

View file

@ -54,6 +54,11 @@ Sapphire::Common::FFXIVARR_POSITION3& Sapphire::Entity::Actor::getPos()
return m_pos;
}
const Sapphire::Common::FFXIVARR_POSITION3& Sapphire::Entity::Actor::getPos() const
{
return m_pos;
}
void Sapphire::Entity::Actor::setPos( float x, float y, float z, bool broadcastUpdate )
{
m_pos.x = x;

View file

@ -58,6 +58,7 @@ namespace Sapphire::Entity
Common::ObjKind getObjKind() const;
Common::FFXIVARR_POSITION3& getPos();
const Common::FFXIVARR_POSITION3& getPos() const;
void setPos( const Common::FFXIVARR_POSITION3& pos, bool broadcastUpdate = true );

View file

@ -20,6 +20,7 @@ file( GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
StatusEffect/*.c*
Territory/*.c*
Territory/Housing/*.c*
Util/*.c*
Navi/*.c*)
add_executable( world ${SERVER_SOURCE_FILES} )

View file

@ -15,21 +15,18 @@ namespace Sapphire::World::Util
public:
ActorFilter() = default;
virtual ~ActorFilter() = default;
virtual bool conditionApplies( const Entity::Actor& actor );
virtual bool conditionApplies( const Entity::Actor& actor ) = 0;
};
/////////////////////////////////////////////////////////////////////////////
class ActorFilterInRange : public ActorFilter
{
FFXIVARR_POSITION3 m_startPos;
Common::FFXIVARR_POSITION3 m_startPos;
float m_range;
public:
ActorFilterInRange( FFXIVARR_POSITION3 startPos, float range ) : m_startPos( startPos ), m_range( range );
bool conditionApplies( const Entity::Actor& actor ) override
{
return Util::distance( m_startPos.x, m_startPos.y, m_startPos.z,
actor.getPos().x, actor.getPos().y, actor.getPos().z ) <= m_range;
}
ActorFilterInRange( Common::FFXIVARR_POSITION3 startPos, float range );
bool conditionApplies( const Entity::Actor& actor ) override;
};
// usage in psudocode
@ -44,4 +41,6 @@ namespace Sapphire::World::Util
// }
// return resultSet;
//
}
}
#endif