1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-19 08:57:46 +00:00
sapphire/src/world/Territory/Cell.h

88 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#include <cstdint>
2017-08-08 13:53:47 +02:00
#include "ForwardsZone.h"
2017-08-08 13:53:47 +02:00
#include <set>
namespace Sapphire {
2017-08-08 13:53:47 +02:00
typedef std::set< Entity::GameObjectPtr > ActorSet;
class Cell
{
2019-07-21 22:33:33 +10:00
friend class Territory;
private:
bool m_bForcedActive;
uint16_t m_posX;
uint16_t m_posY;
ActorSet m_actors;
bool m_bActive;
uint16_t m_playerCount;
public:
Cell();
~Cell();
2022-02-22 23:47:11 +01:00
void init( uint32_t x, uint32_t y );
void addActor( Entity::GameObjectPtr pAct );
void removeActorFromCell( Entity::GameObjectPtr pAct );
bool hasActor( Entity::GameObjectPtr pAct )
{
return ( m_actors.find( pAct ) != m_actors.end() );
}
bool hasPlayers() const
{
return m_playerCount > 0;
}
size_t getActorCount() const
{
return m_actors.size();
}
void removeActors();
ActorSet::iterator begin()
{
return m_actors.begin();
}
ActorSet::iterator end()
{
return m_actors.end();
}
void setActivity( bool state );
bool isActive() const
{
return m_bActive;
}
void unload();
bool isForcedActive() const
{
return m_bForcedActive;
}
uint16_t getPosX() const
{
return m_posX;
}
uint16_t getPosY() const
{
return m_posY;
}
};
2017-08-08 13:53:47 +02:00
}