Inlined get stats from Creature. These are frequently called one line methods.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-04-25 16:15:27 +02:00
parent 0e874346bb
commit 864a9d933d
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 8 additions and 16 deletions

View File

@ -60,18 +60,6 @@ bool Battling::Creature::ChangeStatBoost(Library::Statistic stat, int8_t diffAmo
return changed;
}
uint32_t Battling::Creature::GetFlatStat(Library::Statistic stat) const noexcept { return _flatStats.GetStat(stat); }
uint32_t Battling::Creature::GetBoostedStat(Library::Statistic stat) const noexcept {
return _boostedStats.GetStat(stat);
}
uint32_t Battling::Creature::GetBaseStat(Library::Statistic stat) const noexcept {
return _variant->GetStatistic(stat);
}
int8_t Battling::Creature::GetStatBoost(Library::Statistic stat) const noexcept { return _statBoost.GetStat(stat); }
void Battling::Creature::RecalculateFlatStats() {
auto statCalc = this->_library->GetStatCalculator();
this->_flatStats = statCalc->CalculateFlatStats(this);

View File

@ -142,10 +142,14 @@ namespace CreatureLib::Battling {
// region Stat APIs
bool ChangeStatBoost(Library::Statistic stat, int8_t diffAmount);
[[nodiscard]] uint32_t GetFlatStat(Library::Statistic stat) const noexcept;
[[nodiscard]] uint32_t GetBoostedStat(Library::Statistic stat) const noexcept;
[[nodiscard]] uint32_t GetBaseStat(Library::Statistic stat) const noexcept;
[[nodiscard]] int8_t GetStatBoost(Library::Statistic stat) const noexcept;
[[nodiscard]] inline uint32_t GetFlatStat(Library::Statistic stat) const { return _flatStats.GetStat(stat); }
[[nodiscard]] inline uint32_t GetBoostedStat(Library::Statistic stat) const {
return _boostedStats.GetStat(stat);
}
[[nodiscard]] inline uint32_t GetBaseStat(Library::Statistic stat) const {
return _variant->GetStatistic(stat);
}
[[nodiscard]] inline int8_t GetStatBoost(Library::Statistic stat) const { return _statBoost.GetStat(stat); }
void RecalculateFlatStats();
void RecalculateBoostedStats();
void RecalculateFlatStat(Library::Statistic);