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