From 51325943ab7a8ccb0494b257cc2241d44baacf1d Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Wed, 12 Aug 2020 18:54:01 +0200 Subject: [PATCH] Support swapping attacks. Signed-off-by: Deukhoofd --- CInterface/Battling/Creature.cpp | 3 ++- src/Battling/Models/Creature.hpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CInterface/Battling/Creature.cpp b/CInterface/Battling/Creature.cpp index 4004cb2..232ea28 100644 --- a/CInterface/Battling/Creature.cpp +++ b/CInterface/Battling/Creature.cpp @@ -117,4 +117,5 @@ SIMPLE_GET_FUNC(Creature, GetAvailableAttackSlot, uint8_t); export uint8_t CreatureLib_Creature_AddAttack(Creature* p, LearnedAttack* attack) { Try(p->AddAttack(attack);) } export uint8_t CreatureLib_Creature_ReplaceAttack(Creature* p, size_t index, LearnedAttack* attack) { Try(p->ReplaceAttack(index, attack);) -} \ No newline at end of file +} +export uint8_t CreatureLib_Creature_SwapAttack(Creature* p, size_t a, size_t b) { Try(p->SwapAttacks(a, b);) } \ No newline at end of file diff --git a/src/Battling/Models/Creature.hpp b/src/Battling/Models/Creature.hpp index d21b768..cb639d8 100644 --- a/src/Battling/Models/Creature.hpp +++ b/src/Battling/Models/Creature.hpp @@ -164,6 +164,7 @@ namespace CreatureLib::Battling { uint8_t GetAvailableAttackSlot() const noexcept; void AddAttack(LearnedAttack* attack); void ReplaceAttack(size_t index, LearnedAttack* attack); + void SwapAttacks(size_t a, size_t b) { _attacks.Swap(a, b); } // region Stat APIs