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