1
This commit is contained in:
parent
c1110117bb
commit
cbd66ab033
@ -1609,6 +1609,7 @@ BornPoint* Room::AllocBornPoint(Human* hum)
|
||||
std::vector<BornPoint*> point_list;
|
||||
std::vector<BornPoint*> free_point_list;
|
||||
BornPoint* pre_point = nullptr;
|
||||
BornPoint* reserve_point = nullptr;
|
||||
for (auto& pair : born_point_hash_) {
|
||||
if (&pair.second != hum->born_point) {
|
||||
if (pair.second.player_num + pair.second.android_num <
|
||||
@ -1616,17 +1617,27 @@ BornPoint* Room::AllocBornPoint(Human* hum)
|
||||
point_list.push_back(&pair.second);
|
||||
free_point_list.push_back(&pair.second);;
|
||||
}
|
||||
if (!reserve_point || rand() % 100 < 10) {
|
||||
reserve_point = &pair.second;
|
||||
}
|
||||
} else {
|
||||
pre_point = &pair.second;
|
||||
}
|
||||
}
|
||||
if (pre_point) {
|
||||
DecBornPointHumanNum(pre_point, hum);
|
||||
}
|
||||
if (!free_point_list.empty()) {
|
||||
born_point = free_point_list[rand() % free_point_list.size()];
|
||||
if (pre_point) {
|
||||
DecBornPointHumanNum(pre_point, hum);
|
||||
}
|
||||
} else {
|
||||
born_point = !point_list.empty() ? point_list[rand() % point_list.size()] : nullptr;
|
||||
if (point_list.empty() && reserve_point) {
|
||||
born_point = ForceTakeBornPoint(hum, reserve_point);
|
||||
} else {
|
||||
born_point = !point_list.empty() ? point_list[rand() % point_list.size()] : nullptr;
|
||||
if (pre_point) {
|
||||
DecBornPointHumanNum(pre_point, hum);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (auto& pair : born_point_hash_) {
|
||||
@ -2719,6 +2730,29 @@ void Room::ForceSetBornPoint(Human* hum, BornPoint* born_point)
|
||||
}
|
||||
}
|
||||
|
||||
BornPoint* Room::ForceTakeBornPoint(Human* hum, BornPoint* reserve_born_point)
|
||||
{
|
||||
if (!reserve_born_point) {
|
||||
abort();
|
||||
}
|
||||
if (hum->born_point == reserve_born_point) {
|
||||
abort();
|
||||
}
|
||||
if (!hum->born_point) {
|
||||
abort();
|
||||
}
|
||||
BornPoint* pre_point = hum->born_point;
|
||||
if (pre_point) {
|
||||
DecBornPointHumanNum(pre_point, hum);
|
||||
}
|
||||
for (auto& pair : human_hash_) {
|
||||
if (pair.second->born_point == reserve_born_point) {
|
||||
ForceSetBornPoint(pair.second, pre_point);
|
||||
}
|
||||
}
|
||||
return reserve_born_point;
|
||||
}
|
||||
|
||||
void Room::NewBieRoomStart()
|
||||
{
|
||||
if (room_type_ == RT_NewBrid) {
|
||||
|
@ -196,6 +196,7 @@ private:
|
||||
void AddPlayerPostProc(Player* hum);
|
||||
void CombineTeamBornPoint();
|
||||
void ForceSetBornPoint(Human* hum, BornPoint* born_point);
|
||||
BornPoint* ForceTakeBornPoint(Human* hum, BornPoint* reserve_born_point);
|
||||
void NewBieRoomStart();
|
||||
void ZombieModeStart();
|
||||
void CreateLevel0RoomSpecThings();
|
||||
|
Loading…
x
Reference in New Issue
Block a user