1
This commit is contained in:
parent
edee47ac45
commit
39dde6b509
@ -303,21 +303,39 @@ bool Room::IsPveRoom()
|
||||
|
||||
int Room::GetPlayerNum()
|
||||
{
|
||||
return accountid_hash_.size();
|
||||
int num = 0;
|
||||
if (BattleStarted()) {
|
||||
num = battle_player_count_;
|
||||
} else {
|
||||
TraversePlayerList
|
||||
(
|
||||
[&num] (Player* hum) -> bool
|
||||
{
|
||||
if (!hum->IsOb()) {
|
||||
++num;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
int Room::GetHumanNum()
|
||||
{
|
||||
int num = 0;
|
||||
TraverseHumanList
|
||||
(
|
||||
[&num] (Human* hum) -> bool
|
||||
{
|
||||
if (!hum->IsOb()) {
|
||||
++num;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (BattleStarted()) {
|
||||
num = battle_human_count_;
|
||||
} else {
|
||||
TraverseHumanList
|
||||
(
|
||||
[&num] (Human* hum) -> bool
|
||||
{
|
||||
if (!hum->IsOb()) {
|
||||
++num;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
@ -1036,7 +1054,21 @@ void Room::TraverseRawTeams(std::function<bool (Team*)> cb)
|
||||
|
||||
int Room::GetTeamNum()
|
||||
{
|
||||
return team_hash_.size();
|
||||
int num = 0;
|
||||
if (BattleStarted()) {
|
||||
num = battle_team_count_;
|
||||
} else {
|
||||
TraverseTeams
|
||||
(
|
||||
[&num] (Team* team) -> bool
|
||||
{
|
||||
if (!team->IsViewTeam()) {
|
||||
++num;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
bool Room::CanJoin(const std::string& accountid,
|
||||
@ -2926,6 +2958,7 @@ void Room::ClearPostBattleAutoFreeList()
|
||||
|
||||
void Room::OnBattleStart()
|
||||
{
|
||||
battle_start_frameno_ = GetFrameNo();
|
||||
battle_starting_ = true;
|
||||
std::vector<EntityWeakPtr> entitys;
|
||||
entitys.reserve(uniid_hash_.size());
|
||||
|
Loading…
x
Reference in New Issue
Block a user