This commit is contained in:
aozhiwei 2023-09-23 09:57:57 +08:00
parent e650fbe947
commit b2ac5a91a7
2 changed files with 17 additions and 1 deletions

View File

@ -333,7 +333,20 @@ namespace mt
abort();
}
for (auto conf : s_.rank_mode_confs) {
if (conf->min_elo >= elo && conf->max_elo) {
if (conf->min_elo >= elo) {
return conf.get();
}
}
return s_.rank_mode_confs.at(s_.rank_mode_confs.size() - 1).get();
}
const RankMatchConf* Param::GetRankModeConfByHeroLv(int hero_lv)
{
if (s_.rank_mode_confs.empty()) {
abort();
}
for (auto conf : s_.rank_mode_confs) {
if (conf->min_level >= hero_lv) {
return conf.get();
}
}

View File

@ -8,6 +8,8 @@ namespace mt
struct RankMatchConf
{
RoomType_e room_type = RoomType_Rank1;
int min_level = 0;
int max_level = 0;
int min_elo = 0;
int max_elo = 0;
int hero_min_lv = 0;
@ -147,6 +149,7 @@ namespace mt
static std::string GetStringParam(const std::string& param_name, const char* def_val = "");
static int GetStarNum(int rank);
static const RankMatchConf* GetRankModeConfByElo(int elo);
static const RankMatchConf* GetRankModeConfByHeroLv(int hero_lv);
static const RankMatchConf* GetRankModeConfByRoomType(int room_type);
static int RandHeroLv(int room_type);
private: