This commit is contained in:
aozhiwei 2022-12-26 10:05:12 +08:00
parent 4eaa16deae
commit e05b178aed
3 changed files with 13 additions and 2 deletions

View File

@ -420,7 +420,7 @@ void BattleDataContext::CalcBattleStat(struct PlayerStats* stats)
auto CalcHeroPvpCeg = auto CalcHeroPvpCeg =
[] (long long ceg_uplimit, struct PlayerStats* stats) -> long long [] (long long ceg_uplimit, struct PlayerStats* stats) -> long long
{ {
const mt::FormulaPvp* meta = mt::FormulaPvp::GetById(stats->ranked_topx); const mt::FormulaPvp* meta = mt::FormulaPvp::GetByTopx(stats->ranked_topx);
if (!meta) { if (!meta) {
return 0; return 0;
} }
@ -440,7 +440,7 @@ void BattleDataContext::CalcBattleStat(struct PlayerStats* stats)
auto CalcWeaponPvpCeg = auto CalcWeaponPvpCeg =
[] (long long ceg_uplimit, struct PlayerStats* stats) -> long long [] (long long ceg_uplimit, struct PlayerStats* stats) -> long long
{ {
const mt::FormulaPvp* meta = mt::FormulaPvp::GetById(stats->ranked_topx); const mt::FormulaPvp* meta = mt::FormulaPvp::GetByTopx(stats->ranked_topx);
if (!meta) { if (!meta) {
return 0; return 0;
} }

View File

@ -7,4 +7,14 @@ IMPL_TABLE(mt::FormulaPvp)
namespace mt namespace mt
{ {
const mt::FormulaPvp* FormulaPvp::GetByTopx(float topx)
{
for (auto& itr : raw_list) {
if (topx <= itr->top()) {
return itr;
}
}
return nullptr;
}
} }

View File

@ -11,6 +11,7 @@ namespace mt
) )
public: public:
static const mt::FormulaPvp* GetByTopx(float topx);
}; };
} }