Mark several classes as final for devirtualization performance benefits.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-10-15 18:13:00 +02:00
parent f816975b63
commit fff926b617
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
20 changed files with 20 additions and 20 deletions

View File

@ -6,7 +6,7 @@
#include "PkmnEventKind.hpp" #include "PkmnEventKind.hpp"
namespace PkmnLib::Battling { namespace PkmnLib::Battling {
class StatusChangeEvent : public CreatureLib::Battling::EventData { class StatusChangeEvent final : public CreatureLib::Battling::EventData {
ArbUt::BorrowedPtr<Pokemon> _pokemon; ArbUt::BorrowedPtr<Pokemon> _pokemon;
ArbUt::StringView _statusName; ArbUt::StringView _statusName;

View File

@ -4,7 +4,7 @@
#include "PkmnEventKind.hpp" #include "PkmnEventKind.hpp"
namespace PkmnLib::Battling { namespace PkmnLib::Battling {
class WeatherChangeEvent : public CreatureLib::Battling::EventData { class WeatherChangeEvent final : public CreatureLib::Battling::EventData {
ArbUt::StringView _weatherName; ArbUt::StringView _weatherName;
public: public:

View File

@ -9,7 +9,7 @@
#include "StatCalculator.hpp" #include "StatCalculator.hpp"
namespace PkmnLib::Battling { namespace PkmnLib::Battling {
class BattleLibrary : public CreatureLib::Battling::BattleLibrary { class BattleLibrary final : public CreatureLib::Battling::BattleLibrary {
public: public:
BattleLibrary(Library::PokemonLibrary* staticLib, StatCalculator* statCalculator, DamageLibrary* damageLibrary, BattleLibrary(Library::PokemonLibrary* staticLib, StatCalculator* statCalculator, DamageLibrary* damageLibrary,
PkmnLib::Battling::ExperienceLibrary* experienceLibrary, PkmnLib::Battling::ExperienceLibrary* experienceLibrary,

View File

@ -3,7 +3,7 @@
#include <CreatureLib/Battling/Library/DamageLibrary.hpp> #include <CreatureLib/Battling/Library/DamageLibrary.hpp>
namespace PkmnLib::Battling { namespace PkmnLib::Battling {
class DamageLibrary : public CreatureLib::Battling::DamageLibrary { class DamageLibrary final : public CreatureLib::Battling::DamageLibrary {
public: public:
uint32_t GetDamage(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, uint32_t GetDamage(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
uint8_t hitIndex, uint8_t hitIndex,

View File

@ -5,7 +5,7 @@
#include <CreatureLib/Defines.hpp> #include <CreatureLib/Defines.hpp>
namespace PkmnLib::Battling { namespace PkmnLib::Battling {
class ExperienceLibrary : public CreatureLib::Battling::ExperienceLibrary { class ExperienceLibrary final : public CreatureLib::Battling::ExperienceLibrary {
public: public:
void HandleExperienceGain( void HandleExperienceGain(
CreatureLib::Battling::Creature* faintedMon, CreatureLib::Battling::Creature* faintedMon,

View File

@ -6,7 +6,7 @@
#include "../Pokemon/LearnedMove.hpp" #include "../Pokemon/LearnedMove.hpp"
namespace PkmnLib::Battling { namespace PkmnLib::Battling {
class MiscLibrary : public CreatureLib::Battling::MiscLibrary { class MiscLibrary final : public CreatureLib::Battling::MiscLibrary {
std::unique_ptr<const PkmnLib::Library::MoveData> _struggleData = std::make_unique<PkmnLib::Library::MoveData>( std::unique_ptr<const PkmnLib::Library::MoveData> _struggleData = std::make_unique<PkmnLib::Library::MoveData>(
"struggle"_cnc, 0, PkmnLib::Library::MoveCategory::Physical, 50, 255, 10, "struggle"_cnc, 0, PkmnLib::Library::MoveCategory::Physical, 50, 255, 10,
CreatureLib::Library::AttackTarget::Any, 0, CreatureLib::Library::AttackTarget::Any, 0,

View File

@ -7,7 +7,7 @@
namespace PkmnLib::Battling { namespace PkmnLib::Battling {
class Pokemon; class Pokemon;
class StatCalculator : public CreatureLib::Battling::BattleStatCalculator { class StatCalculator final : public CreatureLib::Battling::BattleStatCalculator {
protected: protected:
virtual uint32_t CalculateHealthStat(const Pokemon* pkmn) const; virtual uint32_t CalculateHealthStat(const Pokemon* pkmn) const;
virtual uint32_t CalculateOtherStat(const Pokemon* pkmn, CreatureLib::Library::Statistic stat) const; virtual uint32_t CalculateOtherStat(const Pokemon* pkmn, CreatureLib::Library::Statistic stat) const;

View File

@ -4,7 +4,7 @@
#include <CreatureLib/Battling/Models/LearnedAttack.hpp> #include <CreatureLib/Battling/Models/LearnedAttack.hpp>
#include "../../Library/Moves/MoveData.hpp" #include "../../Library/Moves/MoveData.hpp"
namespace PkmnLib::Battling { namespace PkmnLib::Battling {
class LearnedMove : public CreatureLib::Battling::LearnedAttack { class LearnedMove final : public CreatureLib::Battling::LearnedAttack {
public: public:
LearnedMove(const ArbUt::BorrowedPtr<const Library::MoveData>& move, LearnedMove(const ArbUt::BorrowedPtr<const Library::MoveData>& move,
CreatureLib::Battling::AttackLearnMethod learnMethod) CreatureLib::Battling::AttackLearnMethod learnMethod)

View File

@ -3,7 +3,7 @@
#include <CreatureLib/Library/Items/Item.hpp> #include <CreatureLib/Library/Items/Item.hpp>
namespace PkmnLib::Library { namespace PkmnLib::Library {
class Item : public CreatureLib::Library::Item { class Item final : public CreatureLib::Library::Item {
uint8_t _flingPower; uint8_t _flingPower;
public: public:

View File

@ -4,7 +4,7 @@
#include <CreatureLib/Library/ItemLibrary.hpp> #include <CreatureLib/Library/ItemLibrary.hpp>
#include "Item.hpp" #include "Item.hpp"
namespace PkmnLib::Library { namespace PkmnLib::Library {
class ItemLibrary : public CreatureLib::Library::ItemLibrary { class ItemLibrary final : public CreatureLib::Library::ItemLibrary {
public: public:
inline bool TryGet(const ArbUt::BasicStringView& name, ArbUt::BorrowedPtr<const Item>& item) const { inline bool TryGet(const ArbUt::BasicStringView& name, ArbUt::BorrowedPtr<const Item>& item) const {
auto v = item.As<const CreatureLib::Library::Item>(); auto v = item.As<const CreatureLib::Library::Item>();

View File

@ -4,7 +4,7 @@
#include <CreatureLib/Library/LibrarySettings.hpp> #include <CreatureLib/Library/LibrarySettings.hpp>
namespace PkmnLib::Library { namespace PkmnLib::Library {
class LibrarySettings : public CreatureLib::Library::LibrarySettings { class LibrarySettings final : public CreatureLib::Library::LibrarySettings {
uint16_t _shinyRate; uint16_t _shinyRate;
public: public:

View File

@ -5,7 +5,7 @@
#include "MoveCategory.hpp" #include "MoveCategory.hpp"
namespace PkmnLib::Library { namespace PkmnLib::Library {
class MoveData : public CreatureLib::Library::AttackData { class MoveData final : public CreatureLib::Library::AttackData {
private: private:
public: public:
MoveData(const ArbUt::StringView& name, uint8_t type, PkmnLib::Library::MoveCategory category, uint8_t power, MoveData(const ArbUt::StringView& name, uint8_t type, PkmnLib::Library::MoveCategory category, uint8_t power,

View File

@ -4,7 +4,7 @@
#include <CreatureLib/Library/AttackLibrary.hpp> #include <CreatureLib/Library/AttackLibrary.hpp>
#include "MoveData.hpp" #include "MoveData.hpp"
namespace PkmnLib::Library { namespace PkmnLib::Library {
class MoveLibrary : public CreatureLib::Library::AttackLibrary { class MoveLibrary final : public CreatureLib::Library::AttackLibrary {
public: public:
MoveLibrary(size_t initialCapacity = 32) : CreatureLib::Library::AttackLibrary(initialCapacity) {} MoveLibrary(size_t initialCapacity = 32) : CreatureLib::Library::AttackLibrary(initialCapacity) {}

View File

@ -9,7 +9,7 @@
#include "Species/SpeciesLibrary.hpp" #include "Species/SpeciesLibrary.hpp"
namespace PkmnLib::Library { namespace PkmnLib::Library {
class PokemonLibrary : public CreatureLib::Library::DataLibrary { class PokemonLibrary final : public CreatureLib::Library::DataLibrary {
private: private:
std::unique_ptr<const NatureLibrary> _natures; std::unique_ptr<const NatureLibrary> _natures;

View File

@ -5,7 +5,7 @@
#include "../Moves/MoveData.hpp" #include "../Moves/MoveData.hpp"
namespace PkmnLib::Library { namespace PkmnLib::Library {
class LearnableMoves : public CreatureLib::Library::LearnableAttacks { class LearnableMoves final : public CreatureLib::Library::LearnableAttacks {
ArbUt::List<ArbUt::BorrowedPtr<const MoveData>> _eggMoves; ArbUt::List<ArbUt::BorrowedPtr<const MoveData>> _eggMoves;
public: public:

View File

@ -5,7 +5,7 @@
#include "LearnableMoves.hpp" #include "LearnableMoves.hpp"
namespace PkmnLib::Library { namespace PkmnLib::Library {
class PokemonForme : public CreatureLib::Library::SpeciesVariant { class PokemonForme final : public CreatureLib::Library::SpeciesVariant {
public: public:
PokemonForme(const ArbUt::StringView& name, float height, float weight, uint32_t baseExperience, PokemonForme(const ArbUt::StringView& name, float height, float weight, uint32_t baseExperience,
const ArbUt::List<uint8_t>& types, CreatureLib::Library::StatisticSet<uint16_t> baseStats, const ArbUt::List<uint8_t>& types, CreatureLib::Library::StatisticSet<uint16_t> baseStats,

View File

@ -5,7 +5,7 @@
#include "PokemonForme.hpp" #include "PokemonForme.hpp"
namespace PkmnLib::Library { namespace PkmnLib::Library {
class PokemonSpecies : public CreatureLib::Library::CreatureSpecies { class PokemonSpecies final : public CreatureLib::Library::CreatureSpecies {
private: private:
uint8_t _baseHappiness; uint8_t _baseHappiness;
ArbUt::UniquePtrList<const EvolutionData> _evolutions; ArbUt::UniquePtrList<const EvolutionData> _evolutions;

View File

@ -5,7 +5,7 @@
#include "PokemonSpecies.hpp" #include "PokemonSpecies.hpp"
namespace PkmnLib::Library { namespace PkmnLib::Library {
class SpeciesLibrary : public CreatureLib::Library::SpeciesLibrary { class SpeciesLibrary final : public CreatureLib::Library::SpeciesLibrary {
ArbUt::Dictionary<ArbUt::BorrowedPtr<const PokemonSpecies>, ArbUt::BorrowedPtr<const PokemonSpecies>> ArbUt::Dictionary<ArbUt::BorrowedPtr<const PokemonSpecies>, ArbUt::BorrowedPtr<const PokemonSpecies>>
_preEvolutionCache; _preEvolutionCache;

View File

@ -10,7 +10,7 @@
#include "AngelScriptScript.hpp" #include "AngelScriptScript.hpp"
#include "AngelScriptTypeInfo.hpp" #include "AngelScriptTypeInfo.hpp"
class AngelScriptResolver : public CreatureLib::Battling::ScriptResolver { class AngelScriptResolver final : public CreatureLib::Battling::ScriptResolver {
private: private:
asIScriptEngine* _engine = nullptr; asIScriptEngine* _engine = nullptr;
asIScriptModule* _mainModule = nullptr; asIScriptModule* _mainModule = nullptr;

View File

@ -9,7 +9,7 @@
#include "ContextPool.hpp" #include "ContextPool.hpp"
class AngelScriptResolver; class AngelScriptResolver;
class AngelScriptScript : public PkmnLib::Battling::PkmnScript { class AngelScriptScript final : public PkmnLib::Battling::PkmnScript {
private: private:
AngelScriptResolver* _resolver = nullptr; AngelScriptResolver* _resolver = nullptr;
AngelScriptTypeInfo* _type = nullptr; AngelScriptTypeInfo* _type = nullptr;