This commit is contained in:
aozhiwei 2024-02-02 17:20:30 +08:00
parent 1c2414342f
commit 2fb4b632be

View File

@ -2615,17 +2615,21 @@ Human* Room::GetOneCanEnableAndroid()
void Room::GetCanEnableAndroids(std::vector<Human*>& humans, size_t num)
{
for (auto& pair : human_hash_) {
if (pair.second->IsAndroid() &&
!pair.second->real_dead &&
a8::HasBitFlag(pair.second->status, CS_Disable)
) {
if (humans.size() >= num) {
break;
}
humans.push_back(pair.second);
}
}
TraverseHumanList
(
[&humans, num] (Human* ele_hum) -> bool
{
if (ele_hum->IsAndroid() &&
!ele_hum->real_dead &&
a8::HasBitFlag(ele_hum->status, CS_Disable)
) {
if (humans.size() >= num) {
return false;
}
humans.push_back(ele_hum);
}
return true;
});
}
Player* Room::GetOneAlivePlayer()
@ -2664,18 +2668,26 @@ void Room::SyncFrameData()
long long begin_tick = a8::XGetTickCount();
long long end_tick = a8::XGetTickCount();
#endif
for (auto& pair : human_hash_) {
pair.second->SendUpdateMsg();
TraverseHumanList
(
#ifdef MYDEBUG
end_tick = a8::XGetTickCount();
#if 0
if (a8::XGetTickCount() - begin_tick > 100) {
A8_ABORT();
}
#endif
begin_tick = a8::XGetTickCount();
[&begin_tick, &end_tick] (Human* ele_hum) -> bool
#else
[] (Human* ele_hum) -> bool
#endif
}
{
ele_hum->SendUpdateMsg();
#ifdef MYDEBUG
end_tick = a8::XGetTickCount();
#if 0
if (a8::XGetTickCount() - begin_tick > 100) {
A8_ABORT();
}
#endif
begin_tick = a8::XGetTickCount();
#endif
return true;
});
#ifdef MYDEBUG
end_tick = a8::XGetTickCount();
if (a8::XGetTickCount() - begin_tick > 1000) {