流量优化 alive_count
This commit is contained in:
parent
7afa5385ce
commit
b45c3ed44f
@ -186,7 +186,10 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
|||||||
msg->set_gas_progress(room->GetGasData().gas_progress);
|
msg->set_gas_progress(room->GetGasData().gas_progress);
|
||||||
TypeConvert::ToPb(room->GetGasData().pos_old, msg->mutable_gas_pos_old());
|
TypeConvert::ToPb(room->GetGasData().pos_old, msg->mutable_gas_pos_old());
|
||||||
}
|
}
|
||||||
msg->set_alive_count(room->AliveCount());
|
if (room->GetFrameNo() - room->AliveCountChgFrameNo() <= 4 ||
|
||||||
|
room->GetFrameNo() - hum->join_frameno <= 2) {
|
||||||
|
msg->set_alive_count(room->AliveCount());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
@ -190,6 +190,7 @@ void Room::AddPlayer(Player* hum)
|
|||||||
MatchTeam(hum);
|
MatchTeam(hum);
|
||||||
hum->PushJoinRoomMsg();
|
hum->PushJoinRoomMsg();
|
||||||
++alive_count_;
|
++alive_count_;
|
||||||
|
alive_count_chged_frameno_ = GetFrameNo();
|
||||||
++PerfMonitor::Instance()->alive_count;
|
++PerfMonitor::Instance()->alive_count;
|
||||||
|
|
||||||
grid_service->AddHuman(hum);
|
grid_service->AddHuman(hum);
|
||||||
@ -287,6 +288,7 @@ void Room::CreateAndroid(int robot_num)
|
|||||||
AddToHumanHash(hum);
|
AddToHumanHash(hum);
|
||||||
MatchTeam(hum);
|
MatchTeam(hum);
|
||||||
++alive_count_;
|
++alive_count_;
|
||||||
|
alive_count_chged_frameno_ = GetFrameNo();
|
||||||
++PerfMonitor::Instance()->alive_count;
|
++PerfMonitor::Instance()->alive_count;
|
||||||
refreshed_robot_set_.insert(robot_meta->i->id());
|
refreshed_robot_set_.insert(robot_meta->i->id());
|
||||||
|
|
||||||
@ -539,6 +541,7 @@ void Room::RemoveObjectLater(RoomEntity* entity)
|
|||||||
void Room::OnHumanDie(Human* hum)
|
void Room::OnHumanDie(Human* hum)
|
||||||
{
|
{
|
||||||
--alive_count_;
|
--alive_count_;
|
||||||
|
alive_count_chged_frameno_ = GetFrameNo();
|
||||||
--PerfMonitor::Instance()->alive_count;
|
--PerfMonitor::Instance()->alive_count;
|
||||||
RemoveFromAliveHumanHash(hum);
|
RemoveFromAliveHumanHash(hum);
|
||||||
NotifyUiUpdate();
|
NotifyUiUpdate();
|
||||||
@ -1390,6 +1393,7 @@ void Room::RandRemoveAndroid()
|
|||||||
RemoveFromAliveHumanHash(hum);
|
RemoveFromAliveHumanHash(hum);
|
||||||
AddToRemovedRobotHash(hum);
|
AddToRemovedRobotHash(hum);
|
||||||
--alive_count_;
|
--alive_count_;
|
||||||
|
alive_count_chged_frameno_ = GetFrameNo();
|
||||||
--PerfMonitor::Instance()->alive_count;
|
--PerfMonitor::Instance()->alive_count;
|
||||||
for (auto& pair : human_hash_) {
|
for (auto& pair : human_hash_) {
|
||||||
pair.second->RemovePartObjects(hum);
|
pair.second->RemovePartObjects(hum);
|
||||||
|
@ -62,6 +62,7 @@ public:
|
|||||||
|
|
||||||
int GetPlayerNum();
|
int GetPlayerNum();
|
||||||
int AliveCount();
|
int AliveCount();
|
||||||
|
long long AliveCountChgFrameNo() { return alive_count_chged_frameno_; };
|
||||||
inline int RealAliveCount() { return alive_human_hash_.size(); }
|
inline int RealAliveCount() { return alive_human_hash_.size(); }
|
||||||
Player* GetPlayerByAccountId(const std::string& accountid);
|
Player* GetPlayerByAccountId(const std::string& accountid);
|
||||||
Player* GetPlayerByUniId(int uniid);
|
Player* GetPlayerByUniId(int uniid);
|
||||||
@ -223,6 +224,7 @@ private:
|
|||||||
long long game_over_frameno_ = 0;
|
long long game_over_frameno_ = 0;
|
||||||
int elapsed_time_ = 0;
|
int elapsed_time_ = 0;
|
||||||
int alive_count_ = 0;
|
int alive_count_ = 0;
|
||||||
|
long long alive_count_chged_frameno_ = 0;
|
||||||
MetaData::AirLine* airline_ = nullptr;
|
MetaData::AirLine* airline_ = nullptr;
|
||||||
a8::XTimerAttacher xtimer_attacher_;
|
a8::XTimerAttacher xtimer_attacher_;
|
||||||
size_t airdrop_times_ = 0;
|
size_t airdrop_times_ = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user