Performance improvement for collecting scripts, by reserving size in ScriptSource.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -53,6 +53,7 @@ namespace CreatureLib::Battling {
|
||||
const CreatureIndex& GetTarget() const noexcept { return _target; }
|
||||
|
||||
Script* GetAttackScript() const noexcept { return _attackScript; }
|
||||
size_t ScriptCount() const override { return 1 + GetUser()->ScriptCount(); }
|
||||
|
||||
protected:
|
||||
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace CreatureLib::Battling {
|
||||
FleeTurnChoice(Creature* user) : BaseTurnChoice(user) {}
|
||||
|
||||
TurnChoiceKind GetKind() const noexcept override { return TurnChoiceKind ::Flee; }
|
||||
size_t ScriptCount() const override { return GetUser()->ScriptCount(); }
|
||||
|
||||
protected:
|
||||
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace CreatureLib::Battling {
|
||||
PassTurnChoice(Creature* c) : BaseTurnChoice(c) {}
|
||||
|
||||
TurnChoiceKind GetKind() const noexcept override { return TurnChoiceKind ::Pass; }
|
||||
size_t ScriptCount() const override { return GetUser()->ScriptCount(); }
|
||||
|
||||
protected:
|
||||
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace CreatureLib::Battling {
|
||||
TurnChoiceKind GetKind() const noexcept final { return TurnChoiceKind::Switch; }
|
||||
|
||||
inline Creature* GetNewCreature() const noexcept { return _newCreature; }
|
||||
size_t ScriptCount() const override { return GetUser()->ScriptCount(); }
|
||||
|
||||
protected:
|
||||
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {
|
||||
|
||||
Reference in New Issue
Block a user