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