diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 6fd9fb08..8075111d 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -2471,47 +2471,6 @@ bool Room::HasPlayerInRound(const glm::vec3& pos, float rad) void Room::CheckPartObjects(Human* testa, Human* testb) { - #if 0 - for (auto& pair1 : human_hash_) { - Human* a = pair1.second; - for (auto& pair2 : human_hash_) { - Human* b = pair2.second; - if (testa && testb) { - if ((a == testa && b == testb) || - (a == testb && b == testa)) { - } - } - if (a->InPartObjects(b)) { - if (!b->InPartObjects(a)) { - A8_ABORT(); - } - } - } - } - - for (auto& pair1 : human_hash_) { - Human* huma = pair1.second; - huma->TraverseAllLayerHumanList - ( - [&huma, testa, testb] (Human* humb, bool& stop) - { - if (testa && testb) { - if ((huma == testa && humb == testb) || - (huma == testb && humb == testa)) { - } - } - if (a8::HasBitFlag(huma->status, CS_Disable) || - a8::HasBitFlag(humb->status, CS_Disable) || - huma->GetPartObjectsCount() <= 0 - ) { - return; - } - if (!huma->InPartObjects(humb)) { - A8_ABORT(); - } - }); - } - #endif } bool Room::RuningInTimer() @@ -2631,11 +2590,15 @@ std::shared_ptr Room::ForceTakeBornPoint(Human* hum, std::shared_ptr< if (pre_point) { DecBornPointHumanNum(pre_point, hum); } - for (auto& pair : human_hash_) { - if (pair.second->GetBornPoint() == reserve_born_point) { - ForceSetBornPoint(pair.second, pre_point); - } - } + TraverseHumanList + ( + [this, reserve_born_point, pre_point] (Human* ele_hum) -> bool + { + if (ele_hum->GetBornPoint() == reserve_born_point) { + ForceSetBornPoint(ele_hum, pre_point); + } + return true; + }); return reserve_born_point; }