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