youhua is_permanent
This commit is contained in:
parent
63d910e555
commit
02f25a5ebb
@ -18,6 +18,7 @@ class Building : public Entity
|
|||||||
public:
|
public:
|
||||||
MetaData::Building* meta = nullptr;
|
MetaData::Building* meta = nullptr;
|
||||||
int building_id = 0;
|
int building_id = 0;
|
||||||
|
MapService* permanent_map_service = nullptr;
|
||||||
|
|
||||||
Building();
|
Building();
|
||||||
virtual ~Building() override;
|
virtual ~Building() override;
|
||||||
|
@ -122,17 +122,3 @@ void Entity::AddEntityCollider(ColliderComponent* collider)
|
|||||||
{
|
{
|
||||||
colliders_.push_back(collider);
|
colliders_.push_back(collider);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Entity::IsPermanent()
|
|
||||||
{
|
|
||||||
if (is_permanent) {
|
|
||||||
if (entity_uniid >= FIXED_OBJECT_MAXID) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (entity_uniid < FIXED_OBJECT_MAXID) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return is_permanent;
|
|
||||||
}
|
|
||||||
|
@ -22,8 +22,6 @@ class Entity
|
|||||||
EntitySubType_e entity_subtype = EST_None;
|
EntitySubType_e entity_subtype = EST_None;
|
||||||
|
|
||||||
int grid_id = 0;
|
int grid_id = 0;
|
||||||
bool is_permanent = false;
|
|
||||||
MapService* permanent_map_service = nullptr;
|
|
||||||
|
|
||||||
Entity();
|
Entity();
|
||||||
virtual ~Entity();
|
virtual ~Entity();
|
||||||
@ -43,7 +41,6 @@ class Entity
|
|||||||
void BroadcastDeleteState(Room* room);
|
void BroadcastDeleteState(Room* room);
|
||||||
void AddEntityCollider(ColliderComponent* collider);
|
void AddEntityCollider(ColliderComponent* collider);
|
||||||
a8::Vec2 GetPos() { return pos_; };
|
a8::Vec2 GetPos() { return pos_; };
|
||||||
bool IsPermanent();
|
|
||||||
void SetPos(a8::Vec2 pos)
|
void SetPos(a8::Vec2 pos)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -131,7 +131,6 @@ void MapMgr::CreateBuilding(int thing_id, float building_x, float building_y)
|
|||||||
}
|
}
|
||||||
Building* building = new Building();
|
Building* building = new Building();
|
||||||
building->meta = building_meta;
|
building->meta = building_meta;
|
||||||
building->is_permanent = true;
|
|
||||||
building->permanent_map_service = map_service_;
|
building->permanent_map_service = map_service_;
|
||||||
building->building_id = thing_id;
|
building->building_id = thing_id;
|
||||||
building->entity_uniid = AllocUniid();
|
building->entity_uniid = AllocUniid();
|
||||||
|
@ -405,3 +405,17 @@ void Obstacle::Die(Room* room)
|
|||||||
dead_frameno_ = room->GetFrameNo();
|
dead_frameno_ = room->GetFrameNo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Obstacle::IsPermanent()
|
||||||
|
{
|
||||||
|
if (is_permanent) {
|
||||||
|
if (entity_uniid >= FIXED_OBJECT_MAXID) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (entity_uniid < FIXED_OBJECT_MAXID) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return is_permanent;
|
||||||
|
}
|
||||||
|
@ -23,6 +23,8 @@ class Obstacle : public Entity
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MetaData::MapThing* meta = nullptr;
|
MetaData::MapThing* meta = nullptr;
|
||||||
|
MapService* permanent_map_service = nullptr;
|
||||||
|
bool is_permanent = false;
|
||||||
|
|
||||||
Obstacle();
|
Obstacle();
|
||||||
virtual ~Obstacle() override;
|
virtual ~Obstacle() override;
|
||||||
@ -48,6 +50,7 @@ class Obstacle : public Entity
|
|||||||
float GetHealth(Room* room);
|
float GetHealth(Room* room);
|
||||||
void SetHealth(Room* room, float value);
|
void SetHealth(Room* room, float value);
|
||||||
void Die(Room* room);
|
void Die(Room* room);
|
||||||
|
bool IsPermanent();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CircleCollider* self_collider_ = nullptr;
|
CircleCollider* self_collider_ = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user