This commit is contained in:
aozhiwei 2022-12-22 17:48:01 +08:00
parent d0fed1b0a5
commit 19803707b7
2 changed files with 96 additions and 10 deletions

View File

@ -17,18 +17,104 @@ namespace mt
{
std::vector<std::string> strings;
a8::Split(template_list(), strings, '|');
#if 0
for (auto& str : strings) {
std::vector<std::string> 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<std::string> strings;
a8::Split(airdrops(), strings, '|');
for (auto& str : strings) {
airdrops_.push_back(a8::XValue(str).GetInt());
}
}
{
std::vector<std::string> strings;
a8::Split(safearea(), strings, '|');
for (auto& str : strings) {
safearea_list.push_back(a8::XValue(str).GetInt());
}
}
{
std::vector<std::string> strings;
a8::Split(airraids(), strings, '|');
for (auto& str : strings) {
airraids_.push_back(a8::XValue(str).GetInt());
}
}
{
std::vector<std::string> strings;
a8::Split(car_num_limit(), strings, '|');
for (auto& str : strings) {
std::vector<std::string> strings2;
a8::Split(str, strings2, ':');
car_num_limit_[a8::XValue(strings2[0]).GetInt()] = a8::XValue(strings2[1]).GetInt();
}
}
{
std::vector<std::string> strings;
a8::Split(game_start_buff_list(), strings, ':');
for (auto& str : strings) {
buff_list.push_back(a8::XValue(str).GetInt());
}
}
if (!IsPveMap()) {
std::vector<std::string> strings;
a8::Split(refresh_robot(), strings, '|');
if (strings.size() != 2) {
A8_ABORT();
}
{
std::vector<std::string> 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<std::string> 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<std::string> 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();
}
}

View File

@ -12,15 +12,15 @@ namespace mt
public:
std::vector<std::tuple<std::string, int>> template_list_;
int rand_space = 0;
std::vector<int> airdrops;
std::vector<int> airraids;
std::vector<int> airdrops_;
std::vector<int> 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<int> buff_list;
glm::vec3 first_safearea_center;
std::map<int, int> car_num_limit;
glm::vec3 first_safearea_center_;
std::map<int, int> car_num_limit_;
std::vector<int> safearea_list;
std::string RandTemplate();