Another rework for scripthooks, for better performance.
All checks were successful
continuous-integration/drone/push Build is passing

This new version caches pointers to the pointers to scripts, so that we can build the data once and then simply iterate over it whenever we want to run a hook.
This commit is contained in:
2019-11-10 17:08:42 +01:00
parent e1a8d80863
commit d8332f9e40
19 changed files with 118 additions and 72 deletions

View File

@@ -18,7 +18,8 @@ namespace CreatureLib::Battling{
class Creature : public ScriptSource{
GetProperty(const Library::CreatureSpecies*, Species);
GetProperty(const Library::SpeciesVariant*, Variant);
GetProperty(const Library::SpeciesVariant*, Variant)
GetProperty(uint8_t, Level);
GetProperty(uint32_t, Experience);
GetProperty(Core::StatisticSet<uint8_t >, StatExperience);
@@ -67,7 +68,7 @@ namespace CreatureLib::Battling{
[[nodiscard]] const std::vector<uint8_t>& GetTypes() const;
[[nodiscard]] bool HasType(uint8_t type) const;
void GetActiveScripts(ScriptAggregator& aggr) const override;
void GetActiveScripts(std::vector<ScriptWrapper> &scripts) override;
//region Stat APIs
@@ -85,6 +86,7 @@ namespace CreatureLib::Battling{
void RecalculateBoostedStats();
void RecalculateFlatStat(Core::Statistic);
void RecalculateBoostedStat(Core::Statistic);
//endregion