优化机器人死亡逻辑
This commit is contained in:
parent
da85e02681
commit
635491bb45
@ -2137,8 +2137,26 @@ void Room::ProcDieAndroid(int die_time, int die_num)
|
|||||||
{
|
{
|
||||||
Android* hum = (Android*)pair.second;
|
Android* hum = (Android*)pair.second;
|
||||||
alive_humans.push_back(hum);
|
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 dead_num = 0;
|
||||||
int try_count = 0;
|
int try_count = 0;
|
||||||
std::vector<Android*> alive_humans_copy = alive_humans;
|
std::vector<Android*> alive_humans_copy = alive_humans;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user