This commit is contained in:
aozhiwei 2024-02-03 11:32:34 +08:00
parent 34906b3ae6
commit 42b1eb217c

View File

@ -2125,9 +2125,13 @@ void Room::AddObjectLater(RoomEntity* entity)
void Room::OnGameOver() void Room::OnGameOver()
{ {
for (auto& pair : human_hash_) { TraverseRawHumanList
pair.second->SendGameOver(); (
} [] (Human* ele_hum) -> bool
{
ele_hum->SendGameOver();
return true;
});
int param1 = 1; int param1 = 1;
xtimer.SetIntervalEx xtimer.SetIntervalEx
( (
@ -2147,9 +2151,13 @@ void Room::OnGameOver()
#endif #endif
RoomMgr::Instance()->AddOverRoom(room_uuid_); RoomMgr::Instance()->AddOverRoom(room_uuid_);
} }
for (auto& pair : human_hash_) { TraverseRawHumanList
pair.second->SendGameOver(); (
} [] (Human* ele_hum) -> bool
{
ele_hum->SendGameOver();
return true;
});
++param1; ++param1;
} }
}, },
@ -2195,12 +2203,20 @@ void Room::RandRemoveAndroid()
alive_count_chged_frameno_ = GetFrameNo(); alive_count_chged_frameno_ = GetFrameNo();
--PerfMonitor::Instance()->alive_count; --PerfMonitor::Instance()->alive_count;
} }
for (auto& pair : human_hash_) { TraverseRawHumanList
pair.second->RemovePartObjects(hum); (
} [] (Human* ele_hum) -> bool
for (auto& pair : human_hash_) { {
pair.second->RemoveObjects(hum); ele_hum->RemovePartObjects(hum);
} return true;
});
TraverseRawHumanList
(
[] (Human* ele_hum) -> bool
{
ele_hum->RemoveObjects(hum);
return true;
});
frame_event.AddExitGame(hum->GetWeakPtrRef()); frame_event.AddExitGame(hum->GetWeakPtrRef());
} }
} }