修复机器人问题

This commit is contained in:
aozhiwei 2019-05-23 14:28:44 +08:00
parent bb24c44830
commit 46f9c01c9f
4 changed files with 18 additions and 7 deletions

View File

@ -58,6 +58,7 @@ static void SavePerfLog()
App::Instance()->perf.max_run_delay_time,
RoomMgr::Instance()->RoomNum()
});
if (App::Instance()->flags.find(4) != App::Instance()->flags.end()) {
a8::XPrintf("max_mainloop_rundelay:%d max_dispatchmsg_time:%d room_num:%d player_num:%d\n",
{
App::Instance()->perf.max_run_delay_time,
@ -65,6 +66,7 @@ static void SavePerfLog()
RoomMgr::Instance()->RoomNum(),
PlayerMgr::Instance()->GetPlayerNum()
});
}
App::Instance()->perf.max_run_delay_time = 0;
App::Instance()->perf.max_dispatchmsg_time = 0;
App::Instance()->perf.max_timer_idle = 0;

View File

@ -692,6 +692,11 @@ void Human::AddToPartObjects(Entity* entity)
part_objects.insert(entity);
}
void Human::RemovePartObjects(Entity* entity)
{
part_objects.erase(entity);
}
void Human::RemoveObjects(Entity* entity)
{
del_objects.insert(entity->entity_uniid);

View File

@ -134,6 +134,7 @@ class Human : public Entity
void DecHP(float dec_hp, int killer_id, const std::string& killer_name, int weapon_id);
void AddToNewObjects(Entity* entity);
void AddToPartObjects(Entity* entity);
void RemovePartObjects(Entity* entity);
void RemoveObjects(Entity* entity);
void AddOutObjects(Entity* entity);
void RemoveOutObjects(Entity* entity);

View File

@ -1192,6 +1192,9 @@ void Room::RandRemoveAndroid()
human_hash_.erase(hum->entity_uniid);
removed_robot_hash_[hum->entity_uniid] = hum;
--alive_count_;
for (auto& pair : human_hash_) {
pair.second->RemovePartObjects(hum);
}
}
}