From e544573967330e060d77e901a24922153bf202c4 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 3 Jun 2023 21:53:24 +0800 Subject: [PATCH] 1 --- server/gameserver/incubator.cc | 2 +- server/gameserver/room.cc | 90 ---------------------------------- server/gameserver/room.h | 4 -- 3 files changed, 1 insertion(+), 95 deletions(-) diff --git a/server/gameserver/incubator.cc b/server/gameserver/incubator.cc index 22985eb6..9159d480 100644 --- a/server/gameserver/incubator.cc +++ b/server/gameserver/incubator.cc @@ -228,7 +228,7 @@ void Incubator::AutoAllocAndroid() case GasWaiting: case GasMoving: { - if (!hold_humans_.empty()){ + if (!hold_humans_.empty() && room->AliveCount() > 6) { Human* hum = hold_humans_[0]; if (room->GetGasData().GetGasMode() == GasWaiting && hold_humans_.size() > 1 && diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 85de1d1b..0a590d70 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -2272,29 +2272,6 @@ bool Room::HasPlayerInRound(const glm::vec3& pos, float rad) return false; } -void Room::ProcDisableHuman() -{ - #if 1 - for (auto& pair : human_hash_) { - if (pair.second->IsAndroid() && - pair.second->team_uuid.empty() && - !a8::HasBitFlag(pair.second->status, CS_Disable)) { - DisableHuman(pair.second); - } - } - #else - if (room_type_ == RT_NewBrid || room_type_ == RT_MidBrid) { - for (auto& pair : human_hash_) { - if (pair.second->IsAndroid() && - pair.second->team_uuid.empty() && - !a8::HasBitFlag(pair.second->status, CS_Disable)) { - DisableHuman(pair.second); - } - } - } - #endif -} - void Room::CheckPartObjects(Human* testa, Human* testb) { #if 0 @@ -2340,73 +2317,6 @@ void Room::CheckPartObjects(Human* testa, Human* testb) #endif } -void Room::GetAliveHumans(std::vector& alive_humans, size_t num, Human* exclude_hum) -{ - alive_humans.reserve(num); - { - if (GetFrameNo() % 8 < 5) { - for (auto itr = human_hash_.begin(); itr != human_hash_.end(); ++itr) { - if (itr->second == exclude_hum) { - continue; - } - CheckAliveHuman(itr->second, alive_humans); - if (alive_humans.size() > num) { - break; - } - } - } else { - for (auto itr = human_hash_.rbegin(); itr != human_hash_.rend(); ++itr) { - if (itr->second == exclude_hum) { - continue; - } - CheckAliveHuman(itr->second, alive_humans); - if (alive_humans.size() > num) { - break; - } - } - } - } -} - -void Room::GetCanAutoDieHumans(std::vector& alive_humans, size_t num, Human* exclude_hum) -{ - alive_humans.reserve(num); - { - if (GetFrameNo() % 8 < 5) { - for (auto itr = human_hash_.begin(); itr != human_hash_.end(); ++itr) { - if (itr->second == exclude_hum) { - continue; - } - CheckAliveHuman(itr->second, alive_humans); - if (alive_humans.size() > num) { - break; - } - } - } else { - for (auto itr = human_hash_.rbegin(); itr != human_hash_.rend(); ++itr) { - if (itr->second == exclude_hum) { - continue; - } - CheckAliveHuman(itr->second, alive_humans); - if (alive_humans.size() > num) { - break; - } - } - } - } -} - -void Room::CheckAliveHuman(Human* hum, std::vector& alive_humans) -{ - if (hum->IsAndroid() && - !hum->real_dead && - hum->team_uuid.empty() && - a8::HasBitFlag(hum->status, CS_Disable) && - !HasPlayerInRound(hum->GetPos().ToGlmVec3(), VIEW_RANGE)) { - alive_humans.push_back(hum); - } -} - bool Room::RuningInTimer() { return xtimer.IsRunning(); diff --git a/server/gameserver/room.h b/server/gameserver/room.h index e41b5e64..cc7cbca3 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -289,10 +289,6 @@ private: void EnableHuman(Human* hum); void DisableHuman(Human* hum); bool HasPlayerInRound(const glm::vec3& pos, float rad); - void ProcDisableHuman(); - void GetAliveHumans(std::vector& alive_humans, size_t num, Human* exclude_hum); - void GetCanAutoDieHumans(std::vector& alive_humans, size_t num, Human* exclude_hum); - void CheckAliveHuman(Human* hum, std::vector& alive_humans); void AddToEntityHash(Entity* entity); void AddToHumanHash(Human* hum);