Cleanup CMake file.

This commit is contained in:
Deukhoofd 2020-07-17 13:12:21 +02:00
parent 5032377554
commit 367ed7fcbb
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
14 changed files with 118 additions and 93 deletions

View File

@ -79,9 +79,7 @@ export bool CreatureLib_Creature_HasVolatileScript(Creature* p, const char* scri
return p->HasVolatileScript(ArbUt::StringView(scriptName)); return p->HasVolatileScript(ArbUt::StringView(scriptName));
} }
export size_t CreatureLib_Creature_GetAttacksCount(Creature* p) { return p->GetAttacks().Count(); } export size_t CreatureLib_Creature_GetAttacksCount(Creature* p) { return p->GetAttacks().Count(); }
export LearnedAttack* const* CreatureLib_Creature_GetAttack(Creature* p, size_t index) { export LearnedAttack* const* CreatureLib_Creature_GetAttacks(Creature* p) { return p->GetAttacks().RawData(); }
return p->GetAttacks().RawData();
}
BORROWED_GET_FUNC(Creature, GetDisplaySpecies, const CreatureLib::Library::CreatureSpecies*); BORROWED_GET_FUNC(Creature, GetDisplaySpecies, const CreatureLib::Library::CreatureSpecies*);
BORROWED_GET_FUNC(Creature, GetDisplayVariant, const CreatureLib::Library::SpeciesVariant*); BORROWED_GET_FUNC(Creature, GetDisplayVariant, const CreatureLib::Library::SpeciesVariant*);
export void CreatureLib_Creature_SetDisplaySpecies(Creature* p, const CreatureLib::Library::CreatureSpecies* species) { export void CreatureLib_Creature_SetDisplaySpecies(Creature* p, const CreatureLib::Library::CreatureSpecies* species) {

View File

@ -44,7 +44,7 @@ export uint8_t CreatureLib_CreatureSpecies_GetVariant(const SpeciesVariant*& out
const char* name) { const char* name) {
Try(out = p->GetVariant(ArbUt::StringView::CalculateHash(name)).GetRaw();) Try(out = p->GetVariant(ArbUt::StringView::CalculateHash(name)).GetRaw();)
} }
export uint8_t CreatureLib_CreatureSpecies_GetVariantWithHash(const SpeciesVariant* out, const CreatureSpecies* p, export uint8_t CreatureLib_CreatureSpecies_GetVariantWithHash(const SpeciesVariant*& out, const CreatureSpecies* p,
uint32_t hash) { uint32_t hash) {
Try(out = p->GetVariant(hash).GetRaw();) Try(out = p->GetVariant(hash).GetRaw();)
} }

View File

@ -1,40 +1,24 @@
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.13)
# Make warnings trigger errors.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
project(CreatureLib) project(CreatureLib)
# Enable all warnings, and make them error when occurring.
add_compile_options(-Wall -Wextra -Werror)
# We like new stuff, so set the c++ standard to c++20.
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) option(WINDOWS "Whether the build target is Windows or not." OFF)
message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.") option(SHARED "Whether we should build a shared library, instead of a static one." OFF)
string(REPLACE "." ";" VERSION_LIST "${CMAKE_C_COMPILER_VERSION}") option(TESTS "Whether the test executable should be build as well." OFF)
list(GET VERSION_LIST 0 VERSION) option(STATICC "Whether gcc and stdc++ should be linked statically to the library." OFF)
list(GET VERSION_LIST 1 MINOR)
if (NOT MINOR MATCHES 0)
SET(VERSION ${VERSION}.${MINOR})
endif ()
set(CONAN_STATIC_C False)
if (STATICC)
set(CONAN_STATIC_C True)
endif (STATICC)
if (NOT WINDOWS) include(CmakeConanSetup.cmake)
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated SetupConan()
-s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -o *:shared=True -o *:staticC=${CONAN_STATIC_C})
else ()
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows -o *:shared=True -o *:staticC=${CONAN_STATIC_C})
endif ()
endif ()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
if (WINDOWS) # Set whether we want a static or shared library.
ADD_DEFINITIONS(-D WINDOWS=1) set(LIBTYPE STATIC)
endif (WINDOWS) if (SHARED)
set(LIBTYPE SHARED)
endif (SHARED)
# Create main Library library with files in src/Library # Create main Library library with files in src/Library
file(GLOB_RECURSE LIBRARY_SRC_FILES "src/Library/*.cpp" "src/Library/*.hpp" "CInterface/Library/*.cpp" "CInterface/Core.*") file(GLOB_RECURSE LIBRARY_SRC_FILES "src/Library/*.cpp" "src/Library/*.hpp" "CInterface/Library/*.cpp" "CInterface/Core.*")
@ -44,34 +28,36 @@ add_library(CreatureLibLibrary SHARED ${LIBRARY_SRC_FILES})
file(GLOB_RECURSE BATTLING_SRC_FILES "src/Battling/*.cpp" "src/Battling/*.hpp" "CInterface/Battling/*.cpp" "CInterface/Core.*") file(GLOB_RECURSE BATTLING_SRC_FILES "src/Battling/*.cpp" "src/Battling/*.hpp" "CInterface/Battling/*.cpp" "CInterface/Core.*")
add_library(CreatureLibBattling SHARED ${BATTLING_SRC_FILES}) add_library(CreatureLibBattling SHARED ${BATTLING_SRC_FILES})
SET(_LIBRARYLINKS Arbutils) # If we are building for Windows we need to set some specific variables.
SET(_BATTLINGLINKS CreatureLibLibrary Arbutils)
SET(_TESTLINKS CreatureLibLibrary CreatureLibBattling Arbutils)
if (WINDOWS) if (WINDOWS)
message(STATUS "Using Windows build.") MESSAGE(WARNING, "Using Windows Build.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L ${CMAKE_BINARY_DIR}/bin") # Add a definition for the compiler, so we can use it in C++ as well.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -Wa,-mbig-obj -Wl,-allow-multiple-definition") ADD_DEFINITIONS(-D WINDOWS=1)
# -m64: Build a 64 bit library
add_compile_options(-m64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition")
endif (WINDOWS) endif (WINDOWS)
# Set up links to all relevant libraries.
SET(_LIBRARYLINKS Arbutils)
SET(_BATTLINGLINKS CreatureLibLibrary Arbutils)
# If we need to link the C libraries statically, do so.
if (STATICC) if (STATICC)
message(STATUS "Linking C statically.") message(STATUS "Linking C statically.")
SET(_LIBRARYLINKS ${_LIBRARYLINKS} -static-libgcc -static-libstdc++) SET(_LIBRARYLINKS ${_LIBRARYLINKS} -static-libgcc -static-libstdc++)
SET(_BATTLINGLINKS ${_BATTLINGLINKS} -static-libgcc -static-libstdc++) SET(_BATTLINGLINKS ${_BATTLINGLINKS} -static-libgcc -static-libstdc++)
if (NOT DEFINED CONAN_EXPORTED)
SET(_TESTLINKS ${_TESTLINKS} -static-libgcc -static-libstdc++)
endif ()
endif () endif ()
# And link the libraries together
target_link_libraries(CreatureLibLibrary PUBLIC ${_LIBRARYLINKS}) target_link_libraries(CreatureLibLibrary PUBLIC ${_LIBRARYLINKS})
target_link_libraries(CreatureLibBattling PUBLIC ${_BATTLINGLINKS}) target_link_libraries(CreatureLibBattling PUBLIC ${_BATTLINGLINKS})
if (NOT DEFINED CONAN_EXPORTED) if (TESTS)
# Create Test executable # Create Test executable
file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp") file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp")
add_executable(CreatureLibTests ${TEST_FILES} extern/catch.hpp) add_executable(CreatureLibTests ${TEST_FILES} extern/catch.hpp)
message(STATUS "${_TESTLINKS}") target_link_libraries(CreatureLibTests PUBLIC CreatureLibLibrary CreatureLibBattling Arbutils)
target_link_libraries(CreatureLibTests PUBLIC ${_TESTLINKS})
# Add a definition for the test library # Add a definition for the test library
target_compile_definitions(CreatureLibTests PRIVATE TESTS_BUILD) target_compile_definitions(CreatureLibTests PRIVATE TESTS_BUILD)

22
CmakeConanSetup.cmake Normal file
View File

@ -0,0 +1,22 @@
function(SetupConan)
# If conan isn't set up yet, we need to install the dependencies.
if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
message(WARNING "The file conanbuildinfo.cmake doesn't exist, running conan install.")
# If we're linking C statically, we also want to do so for our dependencies.
set(CONAN_STATIC_C False)
if (STATICC)
set(CONAN_STATIC_C True)
endif (STATICC)
if (NOT WINDOWS)
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
-s compiler=clang -s compiler.libcxx=libstdc++11 -o *:shared=True -o *:staticC=${CONAN_STATIC_C})
else ()
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s os=Windows -o *:shared=True -o *:staticC=${CONAN_STATIC_C})
endif ()
endif ()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
endfunction()

View File

@ -33,8 +33,8 @@ class CreatureLibConan(ConanFile):
def imports(self): def imports(self):
if self.settings.os == "Windows": if self.settings.os == "Windows":
self.copy("*.dll", "bin", "bin") self.copy("*.dll", "", "bin")
self.copy("*.a", "bin", "bin") self.copy("*.a", "", "bin")
def package_info(self): def package_info(self):
self.cpp_info.libs = ["CreatureLibCore", "CreatureLibLibrary", "CreatureLibBattling"] self.cpp_info.libs = ["CreatureLibCore", "CreatureLibLibrary", "CreatureLibBattling"]

View File

@ -29,7 +29,8 @@ public:
} }
}; };
void TurnOrdering::OrderChoices(std::vector<std::shared_ptr<BaseTurnChoice>>& vec, ArbUt::Random& rand) { void TurnOrdering::OrderChoices(std::vector<std::shared_ptr<BaseTurnChoice>>& vec,
[[maybe_unused]] ArbUt::Random& rand) {
for (auto item : vec) { for (auto item : vec) {
if (item->GetKind() == TurnChoiceKind::Attack) { if (item->GetKind() == TurnChoiceKind::Attack) {
auto attackChoice = static_cast<AttackTurnChoice*>(item.get()); auto attackChoice = static_cast<AttackTurnChoice*>(item.get());

View File

@ -18,7 +18,7 @@ uint32_t DamageLibrary::GetDamage(ExecutingAttack* attack, Creature* target, uin
} }
uint8_t DamageLibrary::GetBasePower(ExecutingAttack* attack, Creature* target, uint8_t hitIndex, uint8_t DamageLibrary::GetBasePower(ExecutingAttack* attack, Creature* target, uint8_t hitIndex,
const ExecutingAttack::HitData& hitData) const { [[maybe_unused]] const ExecutingAttack::HitData& hitData) const {
AssertNotNull(attack) AssertNotNull(attack)
AssertNotNull(target) AssertNotNull(target)
auto bp = attack->GetAttack()->GetAttack()->GetBasePower(); auto bp = attack->GetAttack()->GetAttack()->GetBasePower();

View File

@ -3,8 +3,9 @@
#include "../Models/Battle.hpp" #include "../Models/Battle.hpp"
#include "../TurnChoices/AttackTurnChoice.hpp" #include "../TurnChoices/AttackTurnChoice.hpp"
bool CreatureLib::Battling::MiscLibrary::IsCritical(CreatureLib::Battling::ExecutingAttack* attack, bool CreatureLib::Battling::MiscLibrary::IsCritical([[maybe_unused]] CreatureLib::Battling::ExecutingAttack* attack,
CreatureLib::Battling::Creature* target, uint8_t hit) const { CreatureLib::Battling::Creature* target,
[[maybe_unused]] uint8_t hit) const {
AssertNotNull(target) AssertNotNull(target)
auto rand = target->GetBattle()->GetRandom(); auto rand = target->GetBattle()->GetRandom();
return rand->Get(10) <= 0; return rand->Get(10) <= 0;
@ -31,9 +32,9 @@ static CreatureLib::Battling::LearnedAttack* GetReplacementAttack() {
return _replacementAttack; return _replacementAttack;
} }
bool CreatureLib::Battling::MiscLibrary::CanFlee(FleeTurnChoice* switchChoice) const { return true; } bool CreatureLib::Battling::MiscLibrary::CanFlee([[maybe_unused]] FleeTurnChoice* switchChoice) const { return true; }
CreatureLib::Battling::BaseTurnChoice* CreatureLib::Battling::BaseTurnChoice*
CreatureLib::Battling::MiscLibrary::ReplacementAttack(Creature* user, CreatureIndex target) const { CreatureLib::Battling::MiscLibrary::ReplacementAttack(Creature* user, [[maybe_unused]] CreatureIndex target) const {
AssertNotNull(user) AssertNotNull(user)
auto sideTarget = 0; auto sideTarget = 0;
if (user->GetBattleSide()->GetSideIndex() == 0) if (user->GetBattleSide()->GetSideIndex() == 0)

View File

@ -87,7 +87,7 @@ namespace CreatureLib::Battling {
return false; return false;
} }
inline const uint8_t GetTargetCount() const noexcept { return _targetCount; } inline uint8_t GetTargetCount() const noexcept { return _targetCount; }
inline const ArbUt::BorrowedPtr<Creature>* GetTargets() const noexcept { return _targets; } inline const ArbUt::BorrowedPtr<Creature>* GetTargets() const noexcept { return _targets; }
inline uint8_t GetNumberOfHits() const noexcept { return _numberHits; } inline uint8_t GetNumberOfHits() const noexcept { return _numberHits; }

View File

@ -21,45 +21,59 @@ namespace CreatureLib::Battling {
virtual const ArbUt::StringView& GetName() const noexcept = 0; virtual const ArbUt::StringView& GetName() const noexcept = 0;
virtual void OnInitialize(const ArbUt::List<CreatureLib::Library::EffectParameter*>& parameters){}; virtual void
virtual void OnBeforeTurn(const BaseTurnChoice* choice){}; OnInitialize([[maybe_unused]] const ArbUt::List<CreatureLib::Library::EffectParameter*>& parameters){};
virtual void OnBeforeTurn([[maybe_unused]] const BaseTurnChoice* choice){};
virtual void ChangePriority(AttackTurnChoice* choice, int8_t* priority){}; virtual void ChangePriority([[maybe_unused]] AttackTurnChoice* choice, [[maybe_unused]] int8_t* priority){};
virtual void ChangeAttack(AttackTurnChoice* choice, ArbUt::StringView* outAttack){}; virtual void ChangeAttack([[maybe_unused]] AttackTurnChoice* choice,
virtual void PreventAttack(ExecutingAttack* attack, bool* outResult){}; [[maybe_unused]] ArbUt::StringView* outAttack){};
virtual void FailAttack(ExecutingAttack* attack, bool* outFailed){}; virtual void PreventAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] bool* outResult){};
virtual void StopBeforeAttack(ExecutingAttack* attack, bool* outResult){}; virtual void FailAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] bool* outFailed){};
virtual void OnBeforeAttack(ExecutingAttack* attack){}; virtual void StopBeforeAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] bool* outResult){};
virtual void OnBeforeAttack([[maybe_unused]] ExecutingAttack* attack){};
virtual void FailIncomingAttack(ExecutingAttack* attack, Creature* target, bool* outResult){}; virtual void FailIncomingAttack([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
virtual void IsInvulnerable(ExecutingAttack* attack, Creature* target, bool* outResult){}; [[maybe_unused]] bool* outResult){};
virtual void OnAttackMiss(ExecutingAttack* attack, Creature* target){}; virtual void IsInvulnerable([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
virtual void ChangeAttackType(ExecutingAttack* attack, Creature* target, uint8_t hitNumber, uint8_t* outType){}; [[maybe_unused]] bool* outResult){};
virtual void ChangeEffectiveness(ExecutingAttack* attack, Creature* target, uint8_t hitNumber, virtual void OnAttackMiss([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target){};
float* effectiveness){}; virtual void ChangeAttackType([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
[[maybe_unused]] uint8_t hitNumber, [[maybe_unused]] uint8_t* outType){};
virtual void ChangeEffectiveness([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
[[maybe_unused]] uint8_t hitNumber, [[maybe_unused]] float* effectiveness){};
virtual void OverrideBasePower(ExecutingAttack* attack, Creature* target, uint8_t hitIndex, virtual void OverrideBasePower([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
uint8_t* basePower){}; [[maybe_unused]] uint8_t hitIndex, [[maybe_unused]] uint8_t* basePower){};
virtual void ChangeDamageStatsUser(ExecutingAttack* attack, Creature* target, uint8_t hitIndex, virtual void ChangeDamageStatsUser([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
Creature** statsUser){}; [[maybe_unused]] uint8_t hitIndex, [[maybe_unused]] Creature** statsUser){};
virtual void BypassDefensiveStat(ExecutingAttack* attack, Creature* target, uint8_t hitIndex, bool* bypass){}; virtual void BypassDefensiveStat([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
virtual void BypassOffensiveStat(ExecutingAttack* attack, Creature* target, uint8_t hitIndex, bool* bypass){}; [[maybe_unused]] uint8_t hitIndex, [[maybe_unused]] bool* bypass){};
virtual void ModifyStatModifier(ExecutingAttack* attack, Creature* target, uint8_t hitIndex, float* modifier){}; virtual void BypassOffensiveStat([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
virtual void ModifyDamageModifier(ExecutingAttack* attack, Creature* target, uint8_t hitIndex, [[maybe_unused]] uint8_t hitIndex, [[maybe_unused]] bool* bypass){};
float* modifier){}; virtual void ModifyStatModifier([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
virtual void OverrideDamage(ExecutingAttack* attack, Creature* target, uint8_t hitIndex, uint32_t* damage){}; [[maybe_unused]] uint8_t hitIndex, [[maybe_unused]] float* modifier){};
virtual void ModifyDamageModifier([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
[[maybe_unused]] uint8_t hitIndex, [[maybe_unused]] float* modifier){};
virtual void OverrideDamage([[maybe_unused]] ExecutingAttack* attack, [[maybe_unused]] Creature* target,
[[maybe_unused]] uint8_t hitIndex, [[maybe_unused]] uint32_t* damage){};
virtual void PreventSecondaryEffects(const ExecutingAttack* attack, Creature* target, uint8_t hitNumber, virtual void PreventSecondaryEffects([[maybe_unused]] const ExecutingAttack* attack,
bool* outResult){}; [[maybe_unused]] Creature* target, [[maybe_unused]] uint8_t hitNumber,
virtual void OnSecondaryEffect(const ExecutingAttack* attack, Creature* target, uint8_t hitNumber){}; [[maybe_unused]] bool* outResult){};
virtual void OnSecondaryEffect([[maybe_unused]] const ExecutingAttack* attack,
[[maybe_unused]] Creature* target, [[maybe_unused]] uint8_t hitNumber){};
virtual void OnAfterHits(const ExecutingAttack* attack, Creature* target){}; virtual void OnAfterHits([[maybe_unused]] const ExecutingAttack* attack, [[maybe_unused]] Creature* target){};
virtual void PreventSelfSwitch(const SwitchTurnChoice* choice, bool* outResult){}; virtual void PreventSelfSwitch([[maybe_unused]] const SwitchTurnChoice* choice,
[[maybe_unused]] bool* outResult){};
virtual void ModifyEffectChance(const ExecutingAttack* attack, Creature* target, float* chance){}; virtual void ModifyEffectChance([[maybe_unused]] const ExecutingAttack* attack,
virtual void ModifyIncomingEffectChance(const ExecutingAttack* attack, Creature* target, float* chance){}; [[maybe_unused]] Creature* target, [[maybe_unused]] float* chance){};
virtual void ModifyIncomingEffectChance([[maybe_unused]] const ExecutingAttack* attack,
[[maybe_unused]] Creature* target, [[maybe_unused]] float* chance){};
}; };
} }

View File

@ -13,8 +13,11 @@ namespace CreatureLib::Battling {
public: public:
virtual ~ScriptResolver() = default; virtual ~ScriptResolver() = default;
virtual void Initialize(BattleLibrary* library){}; virtual void Initialize([[maybe_unused]] BattleLibrary* library){};
virtual Script* LoadScript(ScriptCategory category, const ArbUt::StringView& scriptName) { return nullptr; }; virtual Script* LoadScript([[maybe_unused]] ScriptCategory category,
[[maybe_unused]] const ArbUt::StringView& scriptName) {
return nullptr;
};
}; };
} }

View File

@ -30,7 +30,7 @@ namespace CreatureLib::Library {
virtual ~AttackData() = default; virtual ~AttackData() = default;
inline const ArbUt::StringView& GetName() const noexcept { return _name; } inline const ArbUt::StringView& GetName() const noexcept { return _name; }
inline const uint8_t GetType() const noexcept { return _type; } inline uint8_t GetType() const noexcept { return _type; }
inline AttackCategory GetCategory() const noexcept { return _category; } inline AttackCategory GetCategory() const noexcept { return _category; }
inline uint8_t GetBasePower() const noexcept { return _basePower; } inline uint8_t GetBasePower() const noexcept { return _basePower; }
inline uint8_t GetAccuracy() const noexcept { return _accuracy; } inline uint8_t GetAccuracy() const noexcept { return _accuracy; }

View File

@ -48,8 +48,8 @@ namespace CreatureLib::Library {
[[nodiscard]] inline uint16_t GetStatistic(Library::Statistic stat) const { [[nodiscard]] inline uint16_t GetStatistic(Library::Statistic stat) const {
return _baseStatistics.GetStat(stat); return _baseStatistics.GetStat(stat);
} }
[[nodiscard]] inline const size_t GetTalentCount() const noexcept { return _talents.Count(); } [[nodiscard]] inline size_t GetTalentCount() const noexcept { return _talents.Count(); }
[[nodiscard]] inline const size_t GetSecretTalentCount() const noexcept { return _secretTalents.Count(); } [[nodiscard]] inline size_t GetSecretTalentCount() const noexcept { return _secretTalents.Count(); }
[[nodiscard]] const ArbUt::StringView& GetTalent(const TalentIndex& index) const { [[nodiscard]] const ArbUt::StringView& GetTalent(const TalentIndex& index) const {
if (index.IsSecret() && _secretTalents.Count() > 0) { if (index.IsSecret() && _secretTalents.Count() > 0) {
auto i = index.GetIndex(); auto i = index.GetIndex();

View File

@ -24,7 +24,7 @@ namespace CreatureLib::Library {
inline const ArbUt::StringView& GetName() const noexcept { return _name; } inline const ArbUt::StringView& GetName() const noexcept { return _name; }
inline ItemCategory GetCategory() const noexcept { return _category; } inline ItemCategory GetCategory() const noexcept { return _category; }
inline BattleItemCategory GetBattleCategory() const noexcept { return _battleCategory; } inline BattleItemCategory GetBattleCategory() const noexcept { return _battleCategory; }
inline const int32_t GetPrice() const noexcept { return _price; } inline int32_t GetPrice() const noexcept { return _price; }
bool HasFlag(const ArbUt::BasicStringView& flag) const noexcept { return this->_flags.contains(flag); } bool HasFlag(const ArbUt::BasicStringView& flag) const noexcept { return this->_flags.contains(flag); }
bool HasFlag(uint32_t flag) const noexcept { return this->_flags.contains(flag); } bool HasFlag(uint32_t flag) const noexcept { return this->_flags.contains(flag); }