1
This commit is contained in:
parent
688c6c728c
commit
edee47ac45
@ -399,10 +399,11 @@ void Room::AddPlayer(Player* hum, std::shared_ptr<BornPoint> init_born_point, bo
|
||||
MatchTeam(hum);
|
||||
}
|
||||
hum->PushJoinRoomMsg();
|
||||
++alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
++PerfMonitor::Instance()->alive_count;
|
||||
|
||||
if (!hum->IsOb()) {
|
||||
++alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
++PerfMonitor::Instance()->alive_count;
|
||||
}
|
||||
grid_service->AddCreature(hum);
|
||||
hum->FindLocation();
|
||||
hum->RefreshView();
|
||||
@ -500,9 +501,11 @@ void Room::CreateAndroid(int robot_num, std::shared_ptr<Team> team)
|
||||
} else {
|
||||
MatchTeam(hum);
|
||||
}
|
||||
++alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
++PerfMonitor::Instance()->alive_count;
|
||||
if (!hum->IsOb()) {
|
||||
++alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
++PerfMonitor::Instance()->alive_count;
|
||||
}
|
||||
refreshed_robot_set_.insert(robot_meta->id());
|
||||
if (!CanAddToScene(hum)) {
|
||||
a8::SetBitFlag(hum->status, CS_Disable);
|
||||
@ -910,7 +913,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;
|
||||
@ -1022,6 +1025,15 @@ void Room::TraverseTeams(std::function<bool (Team*)> cb)
|
||||
}
|
||||
}
|
||||
|
||||
void Room::TraverseRawTeams(std::function<bool (Team*)> cb)
|
||||
{
|
||||
for (auto& pair : team_hash_) {
|
||||
if (!cb(pair.second.get())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Room::GetTeamNum()
|
||||
{
|
||||
return team_hash_.size();
|
||||
@ -1172,20 +1184,40 @@ std::shared_ptr<Team> Room::NewViewTeam()
|
||||
return team;
|
||||
}
|
||||
|
||||
void Room::TraversePlayerList(std::function<void (Player*)> func)
|
||||
void Room::TraversePlayerList(std::function<void (Player*)> cb)
|
||||
{
|
||||
for (auto& pair : accountid_hash_) {
|
||||
if (pair.second) {
|
||||
func(pair.second);
|
||||
if (pair.second && !pair.second->IsOb()) {
|
||||
cb(pair.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Room::TraverseHumanList(std::function<bool (Human*)> func)
|
||||
void Room::TraverseRawPlayerList(std::function<void (Player*)> cb)
|
||||
{
|
||||
for (auto& pair : accountid_hash_) {
|
||||
if (pair.second) {
|
||||
cb(pair.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Room::TraverseHumanList(std::function<bool (Human*)> cb)
|
||||
{
|
||||
for (auto& pair : human_hash_) {
|
||||
if (pair.second && !pair.second->IsOb()) {
|
||||
if (!func(pair.second)) {
|
||||
if (!cb(pair.second)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Room::TraverseRawHumanList(std::function<bool (Human*)> cb)
|
||||
{
|
||||
for (auto& pair : human_hash_) {
|
||||
if (pair.second) {
|
||||
if (!cb(pair.second)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2125,9 +2157,11 @@ void Room::RandRemoveAndroid()
|
||||
RemoveFromHuamnHash(hum);
|
||||
RemoveFromAliveHumanHash(hum);
|
||||
AddToRemovedRobotHash(hum);
|
||||
--alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
--PerfMonitor::Instance()->alive_count;
|
||||
if (!hum->IsOb()) {
|
||||
--alive_count_;
|
||||
alive_count_chged_frameno_ = GetFrameNo();
|
||||
--PerfMonitor::Instance()->alive_count;
|
||||
}
|
||||
for (auto& pair : human_hash_) {
|
||||
pair.second->RemovePartObjects(hum);
|
||||
}
|
||||
@ -2903,6 +2937,27 @@ void Room::OnBattleStart()
|
||||
e.Get()->OnBattleStart(this);
|
||||
}
|
||||
}
|
||||
TraverseHumanList
|
||||
(
|
||||
[this] (Human* ele_hum) -> bool
|
||||
{
|
||||
++battle_human_count_;
|
||||
return true;
|
||||
});
|
||||
TraversePlayerList
|
||||
(
|
||||
[this] (Player* ele_hum) -> bool
|
||||
{
|
||||
++battle_player_count_;
|
||||
return true;
|
||||
});
|
||||
TraverseTeams
|
||||
(
|
||||
[this] (Team* ele_team) -> bool
|
||||
{
|
||||
++battle_team_count_;
|
||||
return true;
|
||||
});
|
||||
battle_starting_ = false;
|
||||
}
|
||||
|
||||
|
@ -148,8 +148,10 @@ public:
|
||||
|
||||
void FillSMJoinedNotify(Human* self_hum, cs::SMJoinedNotify& msg);
|
||||
|
||||
void TraversePlayerList(std::function<void (Player*)> func);
|
||||
void TraverseHumanList(std::function<bool (Human*)> func);
|
||||
void TraversePlayerList(std::function<void (Player*)> cb);
|
||||
void TraverseRawPlayerList(std::function<void (Player*)> cb);
|
||||
void TraverseHumanList(std::function<bool (Human*)> cb);
|
||||
void TraverseRawHumanList(std::function<bool (Human*)> cb);
|
||||
void TraverseAliveHumanList(std::function<bool (Human*)> func);
|
||||
void TraverseEntityList(std::function<bool (Entity*)> func);
|
||||
void TraverseAlivePlayers(std::function<bool (Human*)> func);
|
||||
@ -201,6 +203,7 @@ public:
|
||||
int GetAliveTeamNum();
|
||||
Team* GetAliveTeam();
|
||||
void TraverseTeams(std::function<bool (Team*)> cb);
|
||||
void TraverseRawTeams(std::function<bool (Team*)> cb);
|
||||
bool CanJoin(const std::string& accountid,
|
||||
RoomType_e self_roomm_type,
|
||||
RoomMode_e self_room_mode,
|
||||
@ -370,7 +373,9 @@ private:
|
||||
int elapsed_time_ = 0;
|
||||
int alive_count_ = 0;
|
||||
long long alive_count_chged_frameno_ = 0;
|
||||
int human_alive_count_ = 0;
|
||||
int battle_human_count_ = 0;
|
||||
int battle_player_count_ = 0;
|
||||
int battle_team_count_ = 0;
|
||||
const mt::AirLine* airline_ = nullptr;
|
||||
int level0room_born_point_uniid_ = 0;
|
||||
int level1room_born_point_uniid_ = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user