2021-11-27 00:53:57 +01:00
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-09-09 23:56:22 +02:00
|
|
|
#include "ForwardsZone.h"
|
2017-08-08 13:53:47 +02:00
|
|
|
#include <set>
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
namespace Sapphire {
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
typedef std::set< Entity::GameObjectPtr > ActorSet;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
class Cell
|
|
|
|
{
|
2019-07-21 22:33:33 +10:00
|
|
|
friend class Territory;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_bForcedActive;
|
|
|
|
uint16_t m_posX;
|
|
|
|
uint16_t m_posY;
|
|
|
|
ActorSet m_actors;
|
|
|
|
bool m_bActive;
|
|
|
|
bool m_bLoaded;
|
|
|
|
bool m_bUnloadPending;
|
|
|
|
|
|
|
|
uint16_t m_playerCount;
|
2019-07-21 22:33:33 +10:00
|
|
|
TerritoryPtr m_pZone;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Cell();
|
|
|
|
|
|
|
|
~Cell();
|
|
|
|
|
2019-07-21 22:33:33 +10:00
|
|
|
void init( uint32_t x, uint32_t y, TerritoryPtr pZone );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
void addActor( Entity::GameObjectPtr pAct );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
void removeActorFromCell( Entity::GameObjectPtr pAct );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
bool hasActor( Entity::GameObjectPtr pAct )
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
return ( m_actors.find( pAct ) != m_actors.end() );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool hasPlayers() const
|
|
|
|
{
|
2019-01-27 01:12:31 +01:00
|
|
|
return m_playerCount > 0;
|
2018-08-29 21:40:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isLoaded() const
|
|
|
|
{
|
|
|
|
return m_bLoaded;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t getPlayerCount() const
|
|
|
|
{
|
|
|
|
return m_playerCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isUnloadPending() const
|
|
|
|
{
|
|
|
|
return m_bUnloadPending;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setUnloadPending( bool up )
|
|
|
|
{
|
|
|
|
m_bUnloadPending = up;
|
|
|
|
}
|
|
|
|
|
|
|
|
void queueUnloadPending();
|
|
|
|
|
|
|
|
void cancelPendingUnload();
|
|
|
|
|
|
|
|
void unload();
|
|
|
|
|
|
|
|
void setPermanentActivity( bool val )
|
|
|
|
{
|
|
|
|
m_bForcedActive = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
}
|