diff --git a/server/gameserver/custom_battle.h b/server/gameserver/custom_battle.h index 777648a1..2dd00de7 100644 --- a/server/gameserver/custom_battle.h +++ b/server/gameserver/custom_battle.h @@ -1,8 +1,7 @@ #pragma once -const int CUSTOM_ROOM_PVP = 0; -const int CUSTOM_ROOM_MOBA = 1; -const int CUSTOM_ROOM_NORMAL = 2; +const int CUSTOM_ROOM_CUSTOM = 0; +const int CUSTOM_ROOM_NORMAL = 1; class Room; class CustomTeam; @@ -36,13 +35,16 @@ class CustomBattle void TraverseTeamList(std::function)> cb); void TraverseObList(std::function)> cb); void SetCustomRoomType(int custom_room_type) { custom_room_type_ = custom_room_type; } - bool IsPvp() { return custom_room_type_ == CUSTOM_ROOM_PVP; } - bool IsMoba() { return custom_room_type_ == CUSTOM_ROOM_MOBA; } + bool IsNormalMode() { return custom_room_type_ == CUSTOM_ROOM_NORMAL; } + bool IsCustomMode() { return custom_room_type_ == CUSTOM_ROOM_CUSTOM; } + bool IsPvp() { return !is_moba_; } + bool IsMoba() { return is_moba_; } private: bool parse_ok_ = false; Room *room_ = nullptr; - int custom_room_type_ = CUSTOM_ROOM_PVP; + int custom_room_type_ = CUSTOM_ROOM_CUSTOM; + bool is_moba_ = false; std::string room_id_; std::string room_uuid_; int zone_id_ = 0; diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index ef6b9ef0..4b9342c6 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -1084,11 +1084,11 @@ void RoomMgr::SendGetCustomBattleData(std::shared_ptr join_msg, { std::string url; JsonDataMgr::Instance()->GetApiUrl(url); - if (custom_room_type == CUSTOM_ROOM_MOBA) { + if (custom_room_type == CUSTOM_ROOM_CUSTOM) { if (url.find('?') != std::string::npos) { - url += "&c=Battle&a=getMobaBattleData"; + url += "&c=Battle&a=getCustomBattleDataNew"; } else { - url += "?&c=Battle&a=getMobaBattleData"; + url += "?&c=Battle&a=getCustomBattleDataNew"; } } else if (custom_room_type == CUSTOM_ROOM_NORMAL) { if (url.find('?') != std::string::npos) { @@ -1096,13 +1096,8 @@ void RoomMgr::SendGetCustomBattleData(std::shared_ptr join_msg, } else { url += "?&c=Battle&a=getNormalBattleData"; } - } else { - if (url.find('?') != std::string::npos) { - url += "&c=Battle&a=getCustomBattleData"; - } else { - url += "?&c=Battle&a=getCustomBattleData"; - } + A8_ABORT(); } auto url_params = a8::MutableXObject::CreateObject(); url_params->SetVal("account_id", join_msg->account_id()); @@ -1183,14 +1178,14 @@ void RoomMgr::DispatchSpecRoom(f8::MsgHdr* hdr, const cs::CMJoin& msg) a8::Split(head, strings, ':'); if (strings.size() > 1) { if (strings.at(1) == "custom_room") { - _CMJoinCustomBattle(hdr, msg, CUSTOM_ROOM_PVP); + _CMJoinCustomBattle(hdr, msg, CUSTOM_ROOM_CUSTOM); } else if (strings.at(1) == "normal_room") { _CMJoinCustomBattle(hdr, msg, CUSTOM_ROOM_NORMAL); - } else if (strings.at(1) == "moba_room") { - _CMJoinCustomBattle(hdr, msg, CUSTOM_ROOM_MOBA); + } else { + A8_ABORT(); } } else { - _CMJoinCustomBattle(hdr, msg, CUSTOM_ROOM_PVP); + A8_ABORT(); } }