From 635491bb4575db2bcbb2df0c2c0e7395d7b41b55 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 28 May 2020 19:30:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9C=BA=E5=99=A8=E4=BA=BA?= =?UTF-8?q?=E6=AD=BB=E4=BA=A1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/room.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 4283ac0..a562977 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -2137,8 +2137,26 @@ void Room::ProcDieAndroid(int die_time, int die_num) { Android* hum = (Android*)pair.second; alive_humans.push_back(hum); + if (alive_humans.size() > 10) { + break; + } } } + { + Human* first_alive_player = nullptr; + for (auto& pair : accountid_hash_) { + if (!pair.second->real_dead) { + first_alive_player = pair.second; + break; + } + } + std::sort(alive_humans.begin(), alive_humans.end(), + [first_alive_player] (Human* a, Human* b ) + { + return first_alive_player->GetPos().ManhattanDistance(a->GetPos()) > + first_alive_player->GetPos().ManhattanDistance(b->GetPos()); + }); + } int dead_num = 0; int try_count = 0; std::vector alive_humans_copy = alive_humans;