流量优化 alive_count
This commit is contained in:
parent
e55e61026b
commit
aff0fdb0c8
@ -154,7 +154,10 @@ cs::SMUpdate* FrameMaker::MakeUpdateMsg(const Human* hum)
|
||||
msg->set_gas_progress(room->gas_data.gas_progress);
|
||||
TypeConvert::ToPb(room->gas_data.pos_old, msg->mutable_gas_pos_old());
|
||||
}
|
||||
if (room->GetFrameNo() - room->AliveCountChgFrameNo() <= 4 ||
|
||||
room->GetFrameNo() - hum->join_frameno <= 2) {
|
||||
msg->set_alive_count(room->AliveCount());
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
@ -190,6 +190,7 @@ void Room::AddPlayer(Player* hum)
|
||||
accountid_hash_[hum->account_id] = hum;
|
||||
human_hash_[hum->entity_uniid] = hum;
|
||||
++alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
++App::Instance()->perf.alive_count;
|
||||
grid_service.AddHuman(hum);
|
||||
hum->FindLocation();
|
||||
@ -300,6 +301,7 @@ void Room::CreateAndroid(int robot_num)
|
||||
moveable_hash_[hum->entity_uniid] = hum;
|
||||
human_hash_[hum->entity_uniid] = hum;
|
||||
++alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
++App::Instance()->perf.alive_count;
|
||||
grid_service.AddHuman(hum);
|
||||
hum->FindLocation();
|
||||
@ -661,6 +663,7 @@ void Room::OnHumanDie(Human* hum)
|
||||
frame_event.AddExplosionEx(hum, 0, hum->pos, 1);
|
||||
}
|
||||
--alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
--App::Instance()->perf.alive_count;
|
||||
NotifyUiUpdate();
|
||||
}
|
||||
@ -1406,6 +1409,7 @@ void Room::RandRemoveAndroid()
|
||||
human_hash_.erase(hum->entity_uniid);
|
||||
removed_robot_hash_[hum->entity_uniid] = hum;
|
||||
--alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
--App::Instance()->perf.alive_count;
|
||||
for (auto& pair : human_hash_) {
|
||||
pair.second->RemovePartObjects(hum);
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
void Update(int delta_time);
|
||||
int GetPlayerNum();
|
||||
int AliveCount();
|
||||
long long AliveCountChgFrameNo() { return alive_count_chged_frameno_; }
|
||||
Player* GetPlayerByAccountId(const std::string& accountid);
|
||||
Player* GetPlayerByUniId(int uniid);
|
||||
Entity* GetEntityByUniId(int uniid);
|
||||
@ -135,6 +136,7 @@ private:
|
||||
private:
|
||||
int elapsed_time_ = 0;
|
||||
int alive_count_ = 0;
|
||||
long long alive_count_chged_frameno_ = 0;
|
||||
MetaData::AirLine* airline_ = nullptr;
|
||||
a8::XTimerAttacher xtimer_attacher;
|
||||
xtimer_list* auto_jump_timer_ = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user