解决中手房问题
This commit is contained in:
parent
39a3188f61
commit
3692dcdde4
@ -287,7 +287,7 @@ void Room::CreateAndroid(int robot_num)
|
||||
++App::Instance()->perf.alive_count;
|
||||
refreshed_robot_set_.insert(robot_meta->i->id());
|
||||
|
||||
if (room_type_ == RT_NewBrid) {
|
||||
if (!CanAddToScene(hum)) {
|
||||
a8::SetBitFlag(hum->status, HS_Disable);
|
||||
} else {
|
||||
AddToAliveHumanHash(hum);
|
||||
@ -1258,10 +1258,20 @@ void Room::OnGameOver()
|
||||
void Room::RandRemoveAndroid()
|
||||
{
|
||||
Human* hum = nullptr;
|
||||
for (auto& pair : human_hash_) {
|
||||
if (pair.second->IsAndroid()) {
|
||||
hum = pair.second;
|
||||
break;
|
||||
if (room_type_ == RT_MidBrid) {
|
||||
for (auto& pair : alive_human_hash_) {
|
||||
if (pair.second->IsAndroid()) {
|
||||
hum = pair.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hum) {
|
||||
for (auto& pair : human_hash_) {
|
||||
if (pair.second->IsAndroid()) {
|
||||
hum = pair.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hum) {
|
||||
@ -2212,6 +2222,16 @@ void Room::AddPlayerPostProc(Player* hum)
|
||||
hum->AddBuff(buff_meta, 1);
|
||||
}
|
||||
}
|
||||
if (room_type_ == RT_MidBrid) {
|
||||
Player* first_player = GetOneAlivePlayer();
|
||||
if (first_player && first_player->born_point) {
|
||||
if (hum->born_point) {
|
||||
DecBornPointHumanNum(hum->born_point, hum);
|
||||
}
|
||||
hum->born_point = first_player->born_point;
|
||||
IncBornPointHumanNum(hum->born_point, hum);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (human_hash_.size() > ROOM_MAX_PLAYER_NUM) {
|
||||
RandRemoveAndroid();
|
||||
@ -2489,3 +2509,20 @@ void Room::CreateLevel0RoomSpecThings()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Room::CanAddToScene(Human* hum)
|
||||
{
|
||||
if (room_type_ == RT_NewBrid) {
|
||||
return false;
|
||||
} else if (room_type_ == RT_MidBrid) {
|
||||
Player* player = GetOneAlivePlayer();
|
||||
if (player) {
|
||||
if (std::fabs(hum->GetPos().x - player->GetPos().x) <= 1024 &&
|
||||
std::fabs(hum->GetPos().y - player->GetPos().y) <= 1024) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -188,6 +188,7 @@ private:
|
||||
void ForceSetBornPoint(Human* hum, BornPoint* born_point);
|
||||
void NewBieRoomStart();
|
||||
void CreateLevel0RoomSpecThings();
|
||||
bool CanAddToScene(Human* hum);
|
||||
|
||||
#ifdef DEBUG
|
||||
void InitDebugInfo();
|
||||
|
Loading…
x
Reference in New Issue
Block a user