From 1dc3aafd33e2824c9fabe5f9524b571a71ee8199 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 23 Oct 2020 16:51:15 +0200 Subject: [PATCH] Use vector instead of set for types. Signed-off-by: Deukhoofd --- CInterface/Battling/Creature.cpp | 2 ++ CInterface/Library/TypeLibrary.cpp | 2 +- conanfile.py | 2 +- src/Battling/Models/Creature.cpp | 6 +++--- src/Battling/Models/Creature.hpp | 4 ++-- src/Library/TypeLibrary.hpp | 3 +-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CInterface/Battling/Creature.cpp b/CInterface/Battling/Creature.cpp index e428bc0..07504b9 100644 --- a/CInterface/Battling/Creature.cpp +++ b/CInterface/Battling/Creature.cpp @@ -56,6 +56,8 @@ BORROWED_GET_FUNC(Creature, GetBattleSide, BattleSide*); SIMPLE_GET_FUNC(Creature, IsOnBattleField, bool); export const char* CreatureLib_Creature_GetNickname(Creature* p) { return p->GetNickname().data(); } export bool CreatureLib_Creature_HasType(Creature* p, uint8_t type) { return p->HasType(type); } +export size_t CreatureLib_Creature_GetTypeCount(Creature* p) { return p->GetTypes().size(); } +export const uint8_t* CreatureLib_Creature_GetTypes(Creature* p) { return p->GetTypes().data(); } SIMPLE_GET_FUNC(Creature, GetMaxHealth, uint32_t); export uint8_t CreatureLib_Creature_ChangeLevelBy(Creature* p, int8_t level) { Try(p->ChangeLevelBy(level);) } export uint8_t CreatureLib_Creature_Damage(Creature* p, uint32_t damage, DamageSource source) { diff --git a/CInterface/Library/TypeLibrary.cpp b/CInterface/Library/TypeLibrary.cpp index 646093e..ad90a3c 100644 --- a/CInterface/Library/TypeLibrary.cpp +++ b/CInterface/Library/TypeLibrary.cpp @@ -27,7 +27,7 @@ export uint8_t CreatureLib_TypeLibrary_GetSingleEffectiveness(float& out, TypeLi export uint8_t CreatureLib_TypeLibrary_GetEffectiveness(float& out, TypeLibrary* p, uint8_t attacking, uint8_t defensive[], size_t defensiveCount) { - Try(out = p->GetEffectiveness(attacking, std::unordered_set(defensive, defensive + defensiveCount));) + Try(out = p->GetEffectiveness(attacking, std::vector(defensive, defensive + defensiveCount));) } export uint8_t CreatureLib_TypeLibrary_GetTypeName(const char*& out, TypeLibrary* p, uint8_t type) { Try(out = p->GetTypeName(type).c_str();) diff --git a/conanfile.py b/conanfile.py index 23ab206..38b353e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -26,7 +26,7 @@ class CreatureLibConan(ConanFile): self.output.info("Linking C libraries statically") cmake.definitions["STATICC"] = "ON" self.output.info("Using level size of: %s" % self.options.level_size) - cmake.definitions["LEVEL_SIZE"] = self.options.level_size; + cmake.definitions["LEVEL_SIZE"] = self.options.level_size cmake.configure() cmake.build() diff --git a/src/Battling/Models/Creature.cpp b/src/Battling/Models/Creature.cpp index f9ff6f2..6245b22 100644 --- a/src/Battling/Models/Creature.cpp +++ b/src/Battling/Models/Creature.cpp @@ -23,7 +23,7 @@ namespace CreatureLib::Battling { _activeTalent = std::unique_ptr