From 40966b52cbb2048918c3c1e6c812a8554f1c1220 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Fri, 6 Sep 2024 09:50:19 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E6=8A=80=E9=A6=86=E6=88=BF=E9=97=B4?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worldsrv/action_game.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/worldsrv/action_game.go b/worldsrv/action_game.go index 61e09b8..de81b77 100644 --- a/worldsrv/action_game.go +++ b/worldsrv/action_game.go @@ -1206,18 +1206,32 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{ send() return nil } + + f := func(param []int32) []int32 { + if len(param) == 0 { + return nil + } + if param[0] == 0 { + return param[1:] + } + if param[0] > 0 && int(param[0]) < len(param) { + return []int32{param[param[0]]} + } + return nil + } + // 场次 - if !slices.Contains(cfg.GetGameFreeId(), msg.GetGameFreeId()) { + if !slices.Contains(f(cfg.GetGameFreeId()), msg.GetGameFreeId()) { send() return nil } // 局数 - if !slices.Contains(cfg.GetRound(), msg.GetRound()) { + if !slices.Contains(f(cfg.GetRound()), msg.GetRound()) { send() return nil } // 玩家数量 - if !slices.Contains(cfg.GetPlayerNum(), msg.GetPlayerNum()) { + if !slices.Contains(f(cfg.GetPlayerNum()), msg.GetPlayerNum()) { send() return nil }