From 19803707b76e0805c63f0e510e6427fa19f5d8f8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 22 Dec 2022 17:48:01 +0800 Subject: [PATCH] 1 --- server/gameserver/mt/Map.cc | 98 ++++++++++++++++++++++++++++++++++--- server/gameserver/mt/Map.h | 8 +-- 2 files changed, 96 insertions(+), 10 deletions(-) diff --git a/server/gameserver/mt/Map.cc b/server/gameserver/mt/Map.cc index 467ea4be..08982a93 100644 --- a/server/gameserver/mt/Map.cc +++ b/server/gameserver/mt/Map.cc @@ -17,18 +17,104 @@ namespace mt { std::vector strings; a8::Split(template_list(), strings, '|'); - #if 0 for (auto& str : strings) { std::vector strings2; a8::Split(str, strings2, ':'); assert(strings2.size() == 2); rand_space += a8::XValue(strings2[1]).GetInt(); - template_list.push_back(std::make_tuple( - strings2[0], - rand_space - )); + template_list_.push_back(std::make_tuple( + strings2[0], + rand_space + )); } - #endif + } + { + std::vector strings; + a8::Split(airdrops(), strings, '|'); + for (auto& str : strings) { + airdrops_.push_back(a8::XValue(str).GetInt()); + } + } + { + std::vector strings; + a8::Split(safearea(), strings, '|'); + for (auto& str : strings) { + safearea_list.push_back(a8::XValue(str).GetInt()); + } + } + { + std::vector strings; + a8::Split(airraids(), strings, '|'); + for (auto& str : strings) { + airraids_.push_back(a8::XValue(str).GetInt()); + } + } + { + std::vector strings; + a8::Split(car_num_limit(), strings, '|'); + for (auto& str : strings) { + std::vector strings2; + a8::Split(str, strings2, ':'); + car_num_limit_[a8::XValue(strings2[0]).GetInt()] = a8::XValue(strings2[1]).GetInt(); + } + } + { + std::vector strings; + a8::Split(game_start_buff_list(), strings, ':'); + for (auto& str : strings) { + buff_list.push_back(a8::XValue(str).GetInt()); + } + } + if (!IsPveMap()) { + std::vector strings; + a8::Split(refresh_robot(), strings, '|'); + if (strings.size() != 2) { + A8_ABORT(); + } + { + std::vector strings2; + a8::Split(strings[0], strings2, '-'); + if (strings2.size() != 2) { + A8_ABORT(); + } + refresh_robot_min_num = a8::XValue(strings2[0]); + refresh_robot_max_num = a8::XValue(strings2[1]); + } + { + std::vector strings2; + a8::Split(strings[1], strings2, '-'); + if (strings2.size() != 2) { + A8_ABORT(); + } + refresh_robot_min_time = a8::XValue(strings2[0]); + refresh_robot_max_time = a8::XValue(strings2[1]); + } + if (refresh_robot_min_num >= refresh_robot_max_num) { + A8_ABORT(); + } + if (refresh_robot_min_time >= refresh_robot_max_time) { + A8_ABORT(); + } + if (refresh_robot_min_num <= 0 || refresh_robot_max_num <= 0 || + refresh_robot_min_time <= 0 || refresh_robot_max_time <= 0) { + A8_ABORT(); + } + } + first_safearea_center_ = glm::vec3(map_width() / 2.0f, + 0.0f, + map_height() / 2.0f); + if (!first_safearea_center().empty()) { + std::vector strings; + a8::Split(first_safearea_center(), strings, ':'); + if (strings.size() != 2) { + A8_ABORT(); + } + first_safearea_center_ = glm::vec3(a8::XValue(strings[0]).GetDouble(), + 0.0f, + a8::XValue(strings[1]).GetDouble()); + } + if (!IsPveMap() && player() < 10) { + A8_ABORT(); } } diff --git a/server/gameserver/mt/Map.h b/server/gameserver/mt/Map.h index d6aa3e9d..e4e01b06 100644 --- a/server/gameserver/mt/Map.h +++ b/server/gameserver/mt/Map.h @@ -12,15 +12,15 @@ namespace mt public: std::vector> template_list_; int rand_space = 0; - std::vector airdrops; - std::vector airraids; + std::vector airdrops_; + std::vector airraids_; int refresh_robot_min_num = 0; int refresh_robot_max_num = 0; int refresh_robot_min_time = 0; int refresh_robot_max_time = 0; std::vector buff_list; - glm::vec3 first_safearea_center; - std::map car_num_limit; + glm::vec3 first_safearea_center_; + std::map car_num_limit_; std::vector safearea_list; std::string RandTemplate();