From fff926b617044fee0219a1c686c867e1ed3eb5e2 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Thu, 15 Oct 2020 18:13:00 +0200 Subject: [PATCH] Mark several classes as final for devirtualization performance benefits. --- src/Battling/EventHooks/StatusChangeEvent.hpp | 2 +- src/Battling/EventHooks/WeatherChangeEvent.hpp | 2 +- src/Battling/Library/BattleLibrary.hpp | 2 +- src/Battling/Library/DamageLibrary.hpp | 2 +- src/Battling/Library/ExperienceLibrary.hpp | 2 +- src/Battling/Library/MiscLibrary.hpp | 2 +- src/Battling/Library/StatCalculator.hpp | 2 +- src/Battling/Pokemon/LearnedMove.hpp | 2 +- src/Library/Items/Item.hpp | 2 +- src/Library/Items/ItemLibrary.hpp | 2 +- src/Library/LibrarySettings.hpp | 2 +- src/Library/Moves/MoveData.hpp | 2 +- src/Library/Moves/MoveLibrary.hpp | 2 +- src/Library/PokemonLibrary.hpp | 2 +- src/Library/Species/LearnableMoves.hpp | 2 +- src/Library/Species/PokemonForme.hpp | 2 +- src/Library/Species/PokemonSpecies.hpp | 2 +- src/Library/Species/SpeciesLibrary.hpp | 2 +- src/ScriptResolving/AngelScript/AngelScriptResolver.hpp | 2 +- src/ScriptResolving/AngelScript/AngelScriptScript.hpp | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Battling/EventHooks/StatusChangeEvent.hpp b/src/Battling/EventHooks/StatusChangeEvent.hpp index dd2a4c7..ebf41d8 100644 --- a/src/Battling/EventHooks/StatusChangeEvent.hpp +++ b/src/Battling/EventHooks/StatusChangeEvent.hpp @@ -6,7 +6,7 @@ #include "PkmnEventKind.hpp" namespace PkmnLib::Battling { - class StatusChangeEvent : public CreatureLib::Battling::EventData { + class StatusChangeEvent final : public CreatureLib::Battling::EventData { ArbUt::BorrowedPtr _pokemon; ArbUt::StringView _statusName; diff --git a/src/Battling/EventHooks/WeatherChangeEvent.hpp b/src/Battling/EventHooks/WeatherChangeEvent.hpp index f766d5b..388e195 100644 --- a/src/Battling/EventHooks/WeatherChangeEvent.hpp +++ b/src/Battling/EventHooks/WeatherChangeEvent.hpp @@ -4,7 +4,7 @@ #include "PkmnEventKind.hpp" namespace PkmnLib::Battling { - class WeatherChangeEvent : public CreatureLib::Battling::EventData { + class WeatherChangeEvent final : public CreatureLib::Battling::EventData { ArbUt::StringView _weatherName; public: diff --git a/src/Battling/Library/BattleLibrary.hpp b/src/Battling/Library/BattleLibrary.hpp index 58b8b7d..b31d484 100644 --- a/src/Battling/Library/BattleLibrary.hpp +++ b/src/Battling/Library/BattleLibrary.hpp @@ -9,7 +9,7 @@ #include "StatCalculator.hpp" namespace PkmnLib::Battling { - class BattleLibrary : public CreatureLib::Battling::BattleLibrary { + class BattleLibrary final : public CreatureLib::Battling::BattleLibrary { public: BattleLibrary(Library::PokemonLibrary* staticLib, StatCalculator* statCalculator, DamageLibrary* damageLibrary, PkmnLib::Battling::ExperienceLibrary* experienceLibrary, diff --git a/src/Battling/Library/DamageLibrary.hpp b/src/Battling/Library/DamageLibrary.hpp index ddd14a0..6eff51b 100644 --- a/src/Battling/Library/DamageLibrary.hpp +++ b/src/Battling/Library/DamageLibrary.hpp @@ -3,7 +3,7 @@ #include namespace PkmnLib::Battling { - class DamageLibrary : public CreatureLib::Battling::DamageLibrary { + class DamageLibrary final : public CreatureLib::Battling::DamageLibrary { public: uint32_t GetDamage(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, uint8_t hitIndex, diff --git a/src/Battling/Library/ExperienceLibrary.hpp b/src/Battling/Library/ExperienceLibrary.hpp index 8225e75..5edfd0b 100644 --- a/src/Battling/Library/ExperienceLibrary.hpp +++ b/src/Battling/Library/ExperienceLibrary.hpp @@ -5,7 +5,7 @@ #include namespace PkmnLib::Battling { - class ExperienceLibrary : public CreatureLib::Battling::ExperienceLibrary { + class ExperienceLibrary final : public CreatureLib::Battling::ExperienceLibrary { public: void HandleExperienceGain( CreatureLib::Battling::Creature* faintedMon, diff --git a/src/Battling/Library/MiscLibrary.hpp b/src/Battling/Library/MiscLibrary.hpp index b365254..f27852f 100644 --- a/src/Battling/Library/MiscLibrary.hpp +++ b/src/Battling/Library/MiscLibrary.hpp @@ -6,7 +6,7 @@ #include "../Pokemon/LearnedMove.hpp" namespace PkmnLib::Battling { - class MiscLibrary : public CreatureLib::Battling::MiscLibrary { + class MiscLibrary final : public CreatureLib::Battling::MiscLibrary { std::unique_ptr _struggleData = std::make_unique( "struggle"_cnc, 0, PkmnLib::Library::MoveCategory::Physical, 50, 255, 10, CreatureLib::Library::AttackTarget::Any, 0, diff --git a/src/Battling/Library/StatCalculator.hpp b/src/Battling/Library/StatCalculator.hpp index b901234..5bc8584 100644 --- a/src/Battling/Library/StatCalculator.hpp +++ b/src/Battling/Library/StatCalculator.hpp @@ -7,7 +7,7 @@ namespace PkmnLib::Battling { class Pokemon; - class StatCalculator : public CreatureLib::Battling::BattleStatCalculator { + class StatCalculator final : public CreatureLib::Battling::BattleStatCalculator { protected: virtual uint32_t CalculateHealthStat(const Pokemon* pkmn) const; virtual uint32_t CalculateOtherStat(const Pokemon* pkmn, CreatureLib::Library::Statistic stat) const; diff --git a/src/Battling/Pokemon/LearnedMove.hpp b/src/Battling/Pokemon/LearnedMove.hpp index dca7dd9..53eb4a8 100644 --- a/src/Battling/Pokemon/LearnedMove.hpp +++ b/src/Battling/Pokemon/LearnedMove.hpp @@ -4,7 +4,7 @@ #include #include "../../Library/Moves/MoveData.hpp" namespace PkmnLib::Battling { - class LearnedMove : public CreatureLib::Battling::LearnedAttack { + class LearnedMove final : public CreatureLib::Battling::LearnedAttack { public: LearnedMove(const ArbUt::BorrowedPtr& move, CreatureLib::Battling::AttackLearnMethod learnMethod) diff --git a/src/Library/Items/Item.hpp b/src/Library/Items/Item.hpp index 65effa4..3522bc4 100644 --- a/src/Library/Items/Item.hpp +++ b/src/Library/Items/Item.hpp @@ -3,7 +3,7 @@ #include namespace PkmnLib::Library { - class Item : public CreatureLib::Library::Item { + class Item final : public CreatureLib::Library::Item { uint8_t _flingPower; public: diff --git a/src/Library/Items/ItemLibrary.hpp b/src/Library/Items/ItemLibrary.hpp index 829a150..acb8a49 100644 --- a/src/Library/Items/ItemLibrary.hpp +++ b/src/Library/Items/ItemLibrary.hpp @@ -4,7 +4,7 @@ #include #include "Item.hpp" namespace PkmnLib::Library { - class ItemLibrary : public CreatureLib::Library::ItemLibrary { + class ItemLibrary final : public CreatureLib::Library::ItemLibrary { public: inline bool TryGet(const ArbUt::BasicStringView& name, ArbUt::BorrowedPtr& item) const { auto v = item.As(); diff --git a/src/Library/LibrarySettings.hpp b/src/Library/LibrarySettings.hpp index 631c35c..f726c81 100644 --- a/src/Library/LibrarySettings.hpp +++ b/src/Library/LibrarySettings.hpp @@ -4,7 +4,7 @@ #include namespace PkmnLib::Library { - class LibrarySettings : public CreatureLib::Library::LibrarySettings { + class LibrarySettings final : public CreatureLib::Library::LibrarySettings { uint16_t _shinyRate; public: diff --git a/src/Library/Moves/MoveData.hpp b/src/Library/Moves/MoveData.hpp index 90f66c0..8101cde 100644 --- a/src/Library/Moves/MoveData.hpp +++ b/src/Library/Moves/MoveData.hpp @@ -5,7 +5,7 @@ #include "MoveCategory.hpp" namespace PkmnLib::Library { - class MoveData : public CreatureLib::Library::AttackData { + class MoveData final : public CreatureLib::Library::AttackData { private: public: MoveData(const ArbUt::StringView& name, uint8_t type, PkmnLib::Library::MoveCategory category, uint8_t power, diff --git a/src/Library/Moves/MoveLibrary.hpp b/src/Library/Moves/MoveLibrary.hpp index 26a0546..eff4d03 100644 --- a/src/Library/Moves/MoveLibrary.hpp +++ b/src/Library/Moves/MoveLibrary.hpp @@ -4,7 +4,7 @@ #include #include "MoveData.hpp" namespace PkmnLib::Library { - class MoveLibrary : public CreatureLib::Library::AttackLibrary { + class MoveLibrary final : public CreatureLib::Library::AttackLibrary { public: MoveLibrary(size_t initialCapacity = 32) : CreatureLib::Library::AttackLibrary(initialCapacity) {} diff --git a/src/Library/PokemonLibrary.hpp b/src/Library/PokemonLibrary.hpp index 976c489..474e6d2 100644 --- a/src/Library/PokemonLibrary.hpp +++ b/src/Library/PokemonLibrary.hpp @@ -9,7 +9,7 @@ #include "Species/SpeciesLibrary.hpp" namespace PkmnLib::Library { - class PokemonLibrary : public CreatureLib::Library::DataLibrary { + class PokemonLibrary final : public CreatureLib::Library::DataLibrary { private: std::unique_ptr _natures; diff --git a/src/Library/Species/LearnableMoves.hpp b/src/Library/Species/LearnableMoves.hpp index 3d8d392..c90e690 100644 --- a/src/Library/Species/LearnableMoves.hpp +++ b/src/Library/Species/LearnableMoves.hpp @@ -5,7 +5,7 @@ #include "../Moves/MoveData.hpp" namespace PkmnLib::Library { - class LearnableMoves : public CreatureLib::Library::LearnableAttacks { + class LearnableMoves final : public CreatureLib::Library::LearnableAttacks { ArbUt::List> _eggMoves; public: diff --git a/src/Library/Species/PokemonForme.hpp b/src/Library/Species/PokemonForme.hpp index 8f9b58a..1dd9139 100644 --- a/src/Library/Species/PokemonForme.hpp +++ b/src/Library/Species/PokemonForme.hpp @@ -5,7 +5,7 @@ #include "LearnableMoves.hpp" namespace PkmnLib::Library { - class PokemonForme : public CreatureLib::Library::SpeciesVariant { + class PokemonForme final : public CreatureLib::Library::SpeciesVariant { public: PokemonForme(const ArbUt::StringView& name, float height, float weight, uint32_t baseExperience, const ArbUt::List& types, CreatureLib::Library::StatisticSet baseStats, diff --git a/src/Library/Species/PokemonSpecies.hpp b/src/Library/Species/PokemonSpecies.hpp index 6025a6f..fd3bc25 100644 --- a/src/Library/Species/PokemonSpecies.hpp +++ b/src/Library/Species/PokemonSpecies.hpp @@ -5,7 +5,7 @@ #include "PokemonForme.hpp" namespace PkmnLib::Library { - class PokemonSpecies : public CreatureLib::Library::CreatureSpecies { + class PokemonSpecies final : public CreatureLib::Library::CreatureSpecies { private: uint8_t _baseHappiness; ArbUt::UniquePtrList _evolutions; diff --git a/src/Library/Species/SpeciesLibrary.hpp b/src/Library/Species/SpeciesLibrary.hpp index 8f25d5b..4d3df8f 100644 --- a/src/Library/Species/SpeciesLibrary.hpp +++ b/src/Library/Species/SpeciesLibrary.hpp @@ -5,7 +5,7 @@ #include "PokemonSpecies.hpp" namespace PkmnLib::Library { - class SpeciesLibrary : public CreatureLib::Library::SpeciesLibrary { + class SpeciesLibrary final : public CreatureLib::Library::SpeciesLibrary { ArbUt::Dictionary, ArbUt::BorrowedPtr> _preEvolutionCache; diff --git a/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp b/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp index bb30901..cc6f1ea 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp @@ -10,7 +10,7 @@ #include "AngelScriptScript.hpp" #include "AngelScriptTypeInfo.hpp" -class AngelScriptResolver : public CreatureLib::Battling::ScriptResolver { +class AngelScriptResolver final : public CreatureLib::Battling::ScriptResolver { private: asIScriptEngine* _engine = nullptr; asIScriptModule* _mainModule = nullptr; diff --git a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp index b5e2374..0481111 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptScript.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptScript.hpp @@ -9,7 +9,7 @@ #include "ContextPool.hpp" class AngelScriptResolver; -class AngelScriptScript : public PkmnLib::Battling::PkmnScript { +class AngelScriptScript final : public PkmnLib::Battling::PkmnScript { private: AngelScriptResolver* _resolver = nullptr; AngelScriptTypeInfo* _type = nullptr;