优化ClearFrameData

This commit is contained in:
aozhiwei 2020-06-03 14:16:08 +08:00
parent 506ffd752e
commit 57d1d278ff

View File

@ -1796,38 +1796,35 @@ void Human::ClearFrameData()
new_objects.clear(); new_objects.clear();
} }
if (!del_objects.empty()) { if (!del_objects.empty()) {
if (!a8::HasBitFlag(status, HS_Disable)) { for (auto& itr : del_objects) {
for (auto& itr : del_objects) { Entity* entity = room->GetEntityByUniId(itr);
Entity* entity = room->GetEntityByUniId(itr); if (entity) {
if (entity) { RemovePartObjects(entity);
RemovePartObjects(entity); if (entity->IsEntityType(ET_Player)) {
if (entity->IsEntityType(ET_Player)) { Human* hum = (Human*)entity;
((Human*)entity)->RemovePartObjects(this); hum->RemovePartObjects(this);
}
#ifdef DEBUG
room->CheckPartObjects();
#endif
}
}
}
del_objects.clear();
}
if (!out_objects.empty()) {
if (!a8::HasBitFlag(status, HS_Disable)) {
for (auto& itr : out_objects) {
Entity* entity = room->GetEntityByUniId(itr);
if (entity) {
RemovePartObjects(entity);
if (entity->IsEntityType(ET_Player)) {
Human* hum = (Human*)entity;
hum->RemovePartObjects(this);
}
} }
#ifdef DEBUG #ifdef DEBUG
room->CheckPartObjects(); room->CheckPartObjects();
#endif #endif
} }
} }
del_objects.clear();
}
if (!out_objects.empty()) {
for (auto& itr : out_objects) {
Entity* entity = room->GetEntityByUniId(itr);
if (entity) {
RemovePartObjects(entity);
if (entity->IsEntityType(ET_Player)) {
Human* hum = (Human*)entity;
hum->RemovePartObjects(this);
}
}
#ifdef DEBUG
room->CheckPartObjects();
#endif
}
out_objects.clear(); out_objects.clear();
} }
if (!shots_.empty()) { if (!shots_.empty()) {