From d044953e9ca0c014628f6dddf1116b5044ce6b93 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 25 Jun 2023 14:53:40 +0800 Subject: [PATCH] 1 --- server/gameserver/mt/Param.cc | 1 + server/gameserver/mt/Param.h | 2 ++ server/gameserver/room.cc | 17 +++++++++++++---- server/gameserver/room.h | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/server/gameserver/mt/Param.cc b/server/gameserver/mt/Param.cc index 92ce6d2f..b03ee00f 100644 --- a/server/gameserver/mt/Param.cc +++ b/server/gameserver/mt/Param.cc @@ -45,6 +45,7 @@ namespace mt s_.match_lock_time++; #endif s_.pre_client_shot = GetIntParam("pre_client_shot", 0); + s_.match_mode_wait_time = GetIntParam("match_mode_wait_time", 10); #if 1 { std::string point = GetStringParam("newbie_room_born_point", "3471.3662:6.8399:5268.6240"); diff --git a/server/gameserver/mt/Param.h b/server/gameserver/mt/Param.h index 3a7111a3..e4d5659e 100644 --- a/server/gameserver/mt/Param.h +++ b/server/gameserver/mt/Param.h @@ -114,6 +114,8 @@ namespace mt int newbie_room_battle_times = 0; int mid_room_max_rank = 0; + + int match_mode_wait_time = 0; }; static void StaticPostInit(); static const S& s() { return s_; }; diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index d6e2d7a5..543438a2 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -1008,6 +1008,9 @@ bool Room::CanJoin(const std::string& accountid, const cs::CMJoin& msg) { if (lock_room_) { + if (IsPvpRankModeRoom()) { + + } return false; } if (IsNewBieRoom()) { @@ -1075,9 +1078,6 @@ bool Room::CanJoin(const std::string& accountid, break; } } - } - if (IsPvpRankModeRoom()) { - } return GetPlayerNum() < (int)GetRoomMaxPlayerNum(); } @@ -1325,7 +1325,10 @@ void Room::UpdateGasInactivePvp() bool over = GetFrameNo() - gas_data_.gas_start_frameno >= GetGasInactiveTime() * SERVER_FRAME_RATE; if (IsPvpRankModeRoom()) { - + if (lock_room_) { + over = GetFrameNo() - lock_room_frameno_ >= + mt::Param::s().match_mode_wait_time * SERVER_FRAME_RATE; + } } if (over) { long long begin_tick = a8::XGetTickCount(); @@ -3455,3 +3458,9 @@ void Room::GMFastForward() }, &xtimer_attacher_); } + +void Room::LockRoom() +{ + lock_room_ = true; + lock_room_frameno_ = GetFrameNo(); +} diff --git a/server/gameserver/room.h b/server/gameserver/room.h index d2650451..26dc36d3 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -249,7 +249,7 @@ public: bool SupportSandTable(); std::shared_ptr GetSandTable() { return sand_table_; } bool IsSandTableRoom(); - void LockRoom() { lock_room_ = true; } + void LockRoom(); void CombineTeam(); void FillTeam(); bool HasRoomSwitch(int tag); @@ -405,6 +405,7 @@ private: Team* victory_team_ = nullptr; bool force_over_ = false; bool lock_room_ = false; + long long lock_room_frameno_ = 0; long long room_switch_ = 0;