diff --git a/server/gameserver/custom_battle.cc b/server/gameserver/custom_battle.cc index f5be5a55..73d5be51 100644 --- a/server/gameserver/custom_battle.cc +++ b/server/gameserver/custom_battle.cc @@ -107,3 +107,15 @@ std::shared_ptr CustomBattle::GetTeamByTeamUuid(const std::string& t auto itr = uuid_hash_.find(team_uuid); return itr != uuid_hash_.end() ? itr->second : nullptr; } + +bool CustomBattle::AllIsJoined() +{ + bool ok = true; + for (auto& pair : member_id_hash_) { + if (!pair.second->IsJoined()) { + ok = false; + break; + } + } + return ok; +} diff --git a/server/gameserver/custom_battle.h b/server/gameserver/custom_battle.h index 3a81cc6f..6b95d927 100644 --- a/server/gameserver/custom_battle.h +++ b/server/gameserver/custom_battle.h @@ -24,6 +24,7 @@ class CustomBattle std::shared_ptr GetTeamByAccountId(const std::string& account_id); std::shared_ptr GetMemberByAccountId(const std::string& account_id); std::shared_ptr GetTeamByTeamUuid(const std::string& team_uuid); + bool AllIsJoined(); private: bool parse_ok_ = false; diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 36b55eab..78aaa936 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -42,6 +42,7 @@ #include "sandtable.h" #include "batchsync.h" #include "trigger.h" +#include "custom_battle.h" #include "mt/Param.h" #include "mt/Hero.h" @@ -331,6 +332,9 @@ void Room::AddPlayer(Player* hum, std::shared_ptr init_born_point, bo OnAddHuman(hum); frame_event.AddEnterGame(hum->GetWeakPtrRef()); GameLog::Instance()->GameStart(hum); + if (custom_battle_ && custom_battle_->AllIsJoined()) { + + } } int Room::AllocUniid() @@ -2275,24 +2279,25 @@ void Room::NotifyGameStart() long long Room::GetGasInactiveTime() { -#ifdef DEBUG - if (!f8::IsTestEnv()) { - return 12; - } -#endif + long long inactive_time = 0; if (IsPveRoom()) { - return 10; + inactive_time = 10; } else { if (IsPvpRankModeRoom()) { if (IsPvpMasterRankModeRoom()) { - return mt::Param::s().master_rank_gas_inactive_time; + inactive_time = mt::Param::s().master_rank_gas_inactive_time; } else { - return mt::Param::s().rank_gas_inactive_time; + inactive_time = mt::Param::s().rank_gas_inactive_time; } } else { - return mt::Param::s().gas_inactive_time; + inactive_time = mt::Param::s().gas_inactive_time; } } +#ifdef DEBUG + if (!f8::IsTestEnv()) { + inactive_time = 12; + } +#endif } long long Room::GetGasInactiveReaminTime() diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 2193f261..ba650674 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -423,6 +423,7 @@ private: a8::XTimerWp lock_room_timer_; long long room_switch_ = 0; + long long acc_inactive_time_ = 0; const mt::RankMatchConf* rank_match_conf_ = nullptr;