This commit is contained in:
aozhiwei 2024-02-02 17:31:42 +08:00
parent af84f142b1
commit 688c6c728c

View File

@ -1195,6 +1195,11 @@ void Room::TraverseHumanList(std::function<bool (Human*)> func)
void Room::TraverseAliveHumanList(std::function<bool (Human*)> func)
{
for (auto& pair : alive_human_hash_) {
#ifdef MYDEBUG
if (pair.second->IsOb()) {
abort();
}
#endif
if (pair.second) {
if (!func(pair.second)) {
break;
@ -1217,6 +1222,11 @@ void Room::TraverseEntityList(std::function<bool (Entity*)> func)
void Room::TraverseAlivePlayers(std::function<bool (Human*)> func)
{
for (auto& pair : alive_player_hash_) {
#ifdef MYDEBUG
if (pair.second->IsOb()) {
abort();
}
#endif
if (!func(pair.second)) {
break;
}
@ -2504,6 +2514,11 @@ void Room::AddToHumanHash(Human* hum)
void Room::AddToAliveHumanHash(Human* hum)
{
#ifdef MYDEBUG
if (hum->IsOb()) {
abort();
}
#endif
alive_human_hash_[hum->GetUniId()] = hum;
if (hum->IsPlayer()) {
alive_player_hash_[hum->GetUniId()] = hum;