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