From a3b084a924bda0657ccb7faecca259530c21eab8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 20 Sep 2023 13:13:46 +0800 Subject: [PATCH] 1 --- server/gameserver/roommgr.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 400c7cff..1c8df5d8 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -874,5 +874,24 @@ void RoomMgr::SendGetCustomBattleData(std::shared_ptr join_msg, head = join_msg->custom_room_payload().substr(0, pos - 1); body = join_msg->custom_room_payload().substr(pos); auto data = std::make_shared(); - data->ReadFromJsonString(body); + if (!data->ReadFromJsonString(body) || + !data->IsObject()) { + cb(1, "custom battle data error", nullptr); + return; + } + std::string room_uuid = data->Get("team_uuid", "").GetString(); + int start_time = data->Get("start_time", "").GetInt(); + if (room_uuid.empty()) { + cb(1, "custom battle data error", nullptr); + return; + } + auto his_room = GetHisCustomRoom(room_uuid); + if (his_room) { + cb(2, "custom battle is dissolution", nullptr); + return; + } + auto cur_room = GetCustomRoom(room_uuid); + if (cur_room) { + + } }