修复出生点问题
This commit is contained in:
parent
2c1e68bb4f
commit
ca511bd151
@ -1612,15 +1612,16 @@ void Room::NotifyWxVoip()
|
||||
|
||||
BornPoint* Room::AllocBornPoint(Human* hum)
|
||||
{
|
||||
BornPoint* born_point = nullptr;
|
||||
if (hum->born_point) {
|
||||
std::vector<BornPoint*> point_list;
|
||||
std::vector<BornPoint*> free_point_list;
|
||||
BornPoint* pre_point = nullptr;
|
||||
for (auto& pair : born_point_hash_) {
|
||||
if (&pair.second != hum->born_point) {
|
||||
point_list.push_back(&pair.second);
|
||||
if (pair.second.player_num + pair.second.android_num <
|
||||
pair.second.thing_tpl->i->param1()) {
|
||||
point_list.push_back(&pair.second);
|
||||
free_point_list.push_back(&pair.second);;
|
||||
}
|
||||
} else {
|
||||
@ -1628,19 +1629,35 @@ BornPoint* Room::AllocBornPoint(Human* hum)
|
||||
}
|
||||
}
|
||||
if (pre_point) {
|
||||
--pre_point->player_num;
|
||||
switch (hum->entity_subtype) {
|
||||
case EST_Player:
|
||||
{
|
||||
--pre_point->player_num;
|
||||
}
|
||||
break;
|
||||
case EST_Android:
|
||||
{
|
||||
--pre_point->android_num;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!free_point_list.empty()) {
|
||||
return free_point_list[rand() % free_point_list.size()];
|
||||
born_point = free_point_list[rand() % free_point_list.size()];
|
||||
} else {
|
||||
return !point_list.empty() ? point_list[rand() % point_list.size()] : nullptr;
|
||||
born_point = !point_list.empty() ? point_list[rand() % point_list.size()] : nullptr;
|
||||
}
|
||||
}
|
||||
BornPoint* born_point = nullptr;
|
||||
for (auto& pair : born_point_hash_) {
|
||||
if (pair.second.player_num + pair.second.android_num < pair.second.thing_tpl->i->param1()) {
|
||||
born_point = &pair.second;
|
||||
break;
|
||||
} else {
|
||||
for (auto& pair : born_point_hash_) {
|
||||
if (pair.second.player_num + pair.second.android_num < pair.second.thing_tpl->i->param1()) {
|
||||
born_point = &pair.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (born_point) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user