1
This commit is contained in:
parent
5fb3fd0acb
commit
97fb7cd9d4
@ -234,7 +234,7 @@ void Room::UnInit()
|
||||
room_agent_ = nullptr;
|
||||
team_hash_.clear();
|
||||
frame_event_data = nullptr;
|
||||
PerfMonitor::Instance()->alive_count -= alive_count_;
|
||||
PerfMonitor::Instance()->alive_count -= AliveCount();
|
||||
ob_->UnInit();
|
||||
ob_ = nullptr;
|
||||
}
|
||||
@ -418,9 +418,7 @@ void Room::AddPlayer(Player* hum, std::shared_ptr<BornPoint> init_born_point, bo
|
||||
}
|
||||
hum->PushJoinRoomMsg();
|
||||
if (!hum->IsOb()) {
|
||||
++alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
++PerfMonitor::Instance()->alive_count;
|
||||
IncAliveCount();
|
||||
}
|
||||
grid_service->AddCreature(hum);
|
||||
hum->FindLocation();
|
||||
@ -520,9 +518,7 @@ void Room::CreateAndroid(int robot_num, std::shared_ptr<Team> team)
|
||||
MatchTeam(hum);
|
||||
}
|
||||
if (!hum->IsOb()) {
|
||||
++alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
++PerfMonitor::Instance()->alive_count;
|
||||
IncAliveCount();
|
||||
}
|
||||
refreshed_robot_set_.insert(robot_meta->id());
|
||||
if (!CanAddToScene(hum)) {
|
||||
@ -932,9 +928,7 @@ void Room::InternalRemoveObjectLater(Entity* entity, a8::Attacher& xtimer_attach
|
||||
void Room::OnHumanDie(Human* hum)
|
||||
{
|
||||
if (!hum->IsOb()) {
|
||||
--alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
--PerfMonitor::Instance()->alive_count;
|
||||
DecAliveCount();
|
||||
RemoveFromAliveHumanHash(hum);
|
||||
NotifyUiUpdate();
|
||||
}
|
||||
@ -1342,7 +1336,7 @@ void Room::UpdateGas()
|
||||
}
|
||||
} else {
|
||||
if (!IsGameOver() &&
|
||||
alive_count_ <= GetMaxTeamNum() &&
|
||||
AliveCount() <= GetMaxTeamNum() &&
|
||||
GetAliveTeamNum() <= 1) {
|
||||
game_over_ = true;
|
||||
game_over_frameno_ = GetFrameNo();
|
||||
@ -2199,9 +2193,7 @@ void Room::RandRemoveAndroid()
|
||||
RemoveFromAliveHumanHash(hum);
|
||||
AddToRemovedRobotHash(hum);
|
||||
if (!hum->IsOb()) {
|
||||
--alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
--PerfMonitor::Instance()->alive_count;
|
||||
DecAliveCount();
|
||||
}
|
||||
TraverseRawHumanList
|
||||
(
|
||||
@ -3614,3 +3606,17 @@ std::shared_ptr<RoomOb> Room::GetRoomOb()
|
||||
{
|
||||
return ob_;
|
||||
}
|
||||
|
||||
void Room::IncAliveCount()
|
||||
{
|
||||
++alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
++PerfMonitor::Instance()->alive_count;
|
||||
}
|
||||
|
||||
void Room::DecAliveCount()
|
||||
{
|
||||
--alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
--PerfMonitor::Instance()->alive_count;
|
||||
}
|
||||
|
@ -352,6 +352,8 @@ private:
|
||||
|
||||
bool IsAllRealDead();
|
||||
void AutoJump();
|
||||
void IncAliveCount();
|
||||
void DecAliveCount();
|
||||
|
||||
private:
|
||||
bool destorying_ = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user