From e1d8348b2f5aec056d4c2ad928ee288957ee8567 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 30 Oct 2021 14:24:38 +0200 Subject: [PATCH] Fixes project being completely dirty every build requiring constant full rebuilds and slowing down tooling. Signed-off-by: Deukhoofd --- CMakeLists.txt | 1 - CMakeLists.txt.in | 2 + src/Battling/EventHooks/EventDataKind.hpp | 2 + src/Battling/EventHooks/EventHook.hpp | 4 +- src/Battling/Library/ExperienceLibrary.hpp | 3 ++ src/Battling/Models/CreatureIndex.hpp | 7 ++-- src/Battling/Models/LearnedAttack.hpp | 1 + src/Battling/ScriptHandling/BattleScript.hpp | 3 ++ src/Battling/ScriptHandling/ItemUseScript.hpp | 1 + .../ScriptHandling/ScriptResolver.hpp | 1 + src/Battling/ScriptHandling/ScriptSet.hpp | 1 + src/Defines.hpp | 1 + src/Library/Attacks/AttackCategory.hpp | 1 + src/Library/Attacks/AttackData.hpp | 1 + src/Library/Attacks/AttackTarget.hpp | 2 + src/Library/Attacks/SecondaryEffect.hpp | 1 + src/Library/BaseLibrary.hpp | 4 ++ src/Library/ClampedStatisticSet.hpp | 1 + src/Library/CreatureData/CreatureSpecies.cpp | 1 + src/Library/CreatureData/LearnableAttacks.cpp | 1 + src/Library/CreatureData/LearnableAttacks.hpp | 2 + src/Library/EffectParameter.hpp | 5 ++- src/Library/Gender.hpp | 1 + src/Library/GrowthRates/ExternGrowthRate.hpp | 2 + src/Library/GrowthRates/GrowthRateLibrary.cpp | 1 + src/Library/GrowthRates/GrowthRateLibrary.hpp | 2 + src/Library/GrowthRates/LookupGrowthRate.hpp | 1 + src/Library/Items/Item.hpp | 3 ++ src/Library/LibrarySettings.hpp | 3 ++ src/Library/Statistic.hpp | 1 + src/Library/StatisticSet.hpp | 5 ++- src/Library/TypeLibrary.hpp | 18 +++++---- src/Precompiled.hxx | 39 ------------------- 33 files changed, 69 insertions(+), 53 deletions(-) delete mode 100644 src/Precompiled.hxx diff --git a/CMakeLists.txt b/CMakeLists.txt index f5e3abb..07fe87c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,6 @@ endif () file(GLOB_RECURSE LIBRARY_SRC_FILES "src/*.cpp" "src/*.hpp" "CInterface/*.cpp" "CInterface/*.hpp") add_library(CreatureLib ${LIBTYPE} ${LIBRARY_SRC_FILES}) -target_precompile_headers(CreatureLib PUBLIC src/Precompiled.hxx) # If interprocedural optimization is available, apply it check_ipo_supported(RESULT IPO_SUPPORTED) diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in index b401f61..f17b5c3 100644 --- a/CMakeLists.txt.in +++ b/CMakeLists.txt.in @@ -40,6 +40,8 @@ function(include_arbutils) execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include) execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/src/arbutils/src ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include/Arbutils) + execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/src/arbutils/extern + ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include/extern) include_directories(${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include) diff --git a/src/Battling/EventHooks/EventDataKind.hpp b/src/Battling/EventHooks/EventDataKind.hpp index 3390ba8..db1e56f 100644 --- a/src/Battling/EventHooks/EventDataKind.hpp +++ b/src/Battling/EventHooks/EventDataKind.hpp @@ -1,6 +1,8 @@ #ifndef CREATURELIB_EVENTDATAKIND_HPP #define CREATURELIB_EVENTDATAKIND_HPP +#include + namespace CreatureLib::Battling { ENUM(EventDataKind, uint8_t, Damage, Heal, Faint, Switch, TurnStart, TurnEnd, ExperienceGain, Miss, DisplayText, ChangeSpecies, ChangeVariant, AttackUse, ChangeStatBoost, Fail, Swap, StatusChange) diff --git a/src/Battling/EventHooks/EventHook.hpp b/src/Battling/EventHooks/EventHook.hpp index 64a2163..31b47ae 100644 --- a/src/Battling/EventHooks/EventHook.hpp +++ b/src/Battling/EventHooks/EventHook.hpp @@ -1,12 +1,14 @@ #ifndef CREATURELIB_EVENTHOOK_HPP #define CREATURELIB_EVENTHOOK_HPP +#include #include #include #include "../../Library/Exceptions/CreatureException.hpp" #include "Events/EventData.hpp" -template concept EventDataType = std::is_base_of::value; +template +concept EventDataType = std::is_base_of::value; namespace CreatureLib::Battling { /// The Event Hook class allows users to write consumers for the battle events, for example to write User Interfaces diff --git a/src/Battling/Library/ExperienceLibrary.hpp b/src/Battling/Library/ExperienceLibrary.hpp index 072f30d..4c68da6 100644 --- a/src/Battling/Library/ExperienceLibrary.hpp +++ b/src/Battling/Library/ExperienceLibrary.hpp @@ -1,6 +1,9 @@ #ifndef CREATURELIB_EXPERIENCELIBRARY_HPP #define CREATURELIB_EXPERIENCELIBRARY_HPP +#include +#include + namespace CreatureLib::Battling { class Creature; diff --git a/src/Battling/Models/CreatureIndex.hpp b/src/Battling/Models/CreatureIndex.hpp index fcdb394..1c21f47 100644 --- a/src/Battling/Models/CreatureIndex.hpp +++ b/src/Battling/Models/CreatureIndex.hpp @@ -1,14 +1,15 @@ #ifndef CREATURELIB_CREATUREINDEX_HPP #define CREATURELIB_CREATUREINDEX_HPP +#include "../../Defines.hpp" namespace CreatureLib::Battling { class CreatureIndex { - uint8_t _side; - uint8_t _creature; + u8 _side; + u8 _creature; public: CreatureIndex() noexcept : _side(0), _creature(0) {} - CreatureIndex(uint8_t side, uint8_t creature) noexcept : _side(side), _creature(creature) {} + CreatureIndex(uint8_t side, u8 creature) noexcept : _side(side), _creature(creature) {} uint8_t GetSideIndex() const noexcept { return _side; } diff --git a/src/Battling/Models/LearnedAttack.hpp b/src/Battling/Models/LearnedAttack.hpp index fd6abf1..51fac7d 100644 --- a/src/Battling/Models/LearnedAttack.hpp +++ b/src/Battling/Models/LearnedAttack.hpp @@ -1,6 +1,7 @@ #ifndef CREATURELIB_LEARNEDATTACK_HPP #define CREATURELIB_LEARNEDATTACK_HPP +#include #include "../../Library/Attacks/AttackData.hpp" #include "AttackLearnMethod.hpp" diff --git a/src/Battling/ScriptHandling/BattleScript.hpp b/src/Battling/ScriptHandling/BattleScript.hpp index 1d99ae3..17c9c93 100644 --- a/src/Battling/ScriptHandling/BattleScript.hpp +++ b/src/Battling/ScriptHandling/BattleScript.hpp @@ -1,6 +1,9 @@ #ifndef CREATURELIB_SCRIPT_HPP #define CREATURELIB_SCRIPT_HPP +#include +#include +#include #include "../../Library/EffectParameter.hpp" namespace CreatureLib::Battling { diff --git a/src/Battling/ScriptHandling/ItemUseScript.hpp b/src/Battling/ScriptHandling/ItemUseScript.hpp index 0afd919..f992fc1 100644 --- a/src/Battling/ScriptHandling/ItemUseScript.hpp +++ b/src/Battling/ScriptHandling/ItemUseScript.hpp @@ -1,6 +1,7 @@ #ifndef ITEMUSESCRIPT_HPP #define ITEMUSESCRIPT_HPP +#include #include "../../Library/EffectParameter.hpp" namespace CreatureLib::Battling { class Creature; diff --git a/src/Battling/ScriptHandling/ScriptResolver.hpp b/src/Battling/ScriptHandling/ScriptResolver.hpp index 3a68e37..7c83514 100644 --- a/src/Battling/ScriptHandling/ScriptResolver.hpp +++ b/src/Battling/ScriptHandling/ScriptResolver.hpp @@ -1,6 +1,7 @@ #ifndef CREATURELIB_SCRIPTRESOLVER_HPP #define CREATURELIB_SCRIPTRESOLVER_HPP +#include #include "../../Library/Items/Item.hpp" #include "BattleScript.hpp" #include "ItemUseScript.hpp" diff --git a/src/Battling/ScriptHandling/ScriptSet.hpp b/src/Battling/ScriptHandling/ScriptSet.hpp index 9fa2c9e..c6873cb 100644 --- a/src/Battling/ScriptHandling/ScriptSet.hpp +++ b/src/Battling/ScriptHandling/ScriptSet.hpp @@ -1,6 +1,7 @@ #ifndef CREATURELIB_SCRIPTSET_HPP #define CREATURELIB_SCRIPTSET_HPP +#include #include #include "BattleScript.hpp" diff --git a/src/Defines.hpp b/src/Defines.hpp index fcc390f..d4ae49f 100644 --- a/src/Defines.hpp +++ b/src/Defines.hpp @@ -1,5 +1,6 @@ #ifndef CREATURELIB_DEFINES_HPP #define CREATURELIB_DEFINES_HPP +#include #if LEVEL_U8 using level_int_t = uint8_t; diff --git a/src/Library/Attacks/AttackCategory.hpp b/src/Library/Attacks/AttackCategory.hpp index 9ccf7b9..0c17f99 100644 --- a/src/Library/Attacks/AttackCategory.hpp +++ b/src/Library/Attacks/AttackCategory.hpp @@ -1,5 +1,6 @@ #ifndef CREATURELIB_ATTACKCATEGORY_HPP #define CREATURELIB_ATTACKCATEGORY_HPP +#include namespace CreatureLib::Library { ENUM(AttackCategory, uint8_t, Physical, Magical, Status) diff --git a/src/Library/Attacks/AttackData.hpp b/src/Library/Attacks/AttackData.hpp index ebde896..d2eeb8c 100644 --- a/src/Library/Attacks/AttackData.hpp +++ b/src/Library/Attacks/AttackData.hpp @@ -1,6 +1,7 @@ #ifndef CREATURELIB_ATTACKDATA_HPP #define CREATURELIB_ATTACKDATA_HPP +#include #include "AttackCategory.hpp" #include "AttackTarget.hpp" #include "SecondaryEffect.hpp" diff --git a/src/Library/Attacks/AttackTarget.hpp b/src/Library/Attacks/AttackTarget.hpp index 4bb2fb1..ad467cf 100644 --- a/src/Library/Attacks/AttackTarget.hpp +++ b/src/Library/Attacks/AttackTarget.hpp @@ -1,6 +1,8 @@ #ifndef CREATURELIB_ATTACKTARGET_HPP #define CREATURELIB_ATTACKTARGET_HPP +#include + namespace CreatureLib::Library { ENUM(AttackTarget, uint8_t, Adjacent, AdjacentAlly, AdjacentAllySelf, AdjacentOpponent, diff --git a/src/Library/Attacks/SecondaryEffect.hpp b/src/Library/Attacks/SecondaryEffect.hpp index 48e8a07..971f8c1 100644 --- a/src/Library/Attacks/SecondaryEffect.hpp +++ b/src/Library/Attacks/SecondaryEffect.hpp @@ -1,6 +1,7 @@ #ifndef CREATURELIB_SECONDARYEFFECT_HPP #define CREATURELIB_SECONDARYEFFECT_HPP +#include #include #include "../EffectParameter.hpp" diff --git a/src/Library/BaseLibrary.hpp b/src/Library/BaseLibrary.hpp index 68c24ff..346689a 100644 --- a/src/Library/BaseLibrary.hpp +++ b/src/Library/BaseLibrary.hpp @@ -1,7 +1,11 @@ #ifndef CREATURELIB_BASELIBRARY_HPP #define CREATURELIB_BASELIBRARY_HPP +#include +#include +#include #include +#include namespace CreatureLib::Library { template class BaseLibrary { diff --git a/src/Library/ClampedStatisticSet.hpp b/src/Library/ClampedStatisticSet.hpp index d231919..0448c11 100644 --- a/src/Library/ClampedStatisticSet.hpp +++ b/src/Library/ClampedStatisticSet.hpp @@ -1,6 +1,7 @@ #ifndef CREATURELIB_CLAMPEDSTATISTICSET_HPP #define CREATURELIB_CLAMPEDSTATISTICSET_HPP +#include #include "Exceptions/CreatureException.hpp" #include "Statistic.hpp" diff --git a/src/Library/CreatureData/CreatureSpecies.cpp b/src/Library/CreatureData/CreatureSpecies.cpp index 90a0442..7341227 100644 --- a/src/Library/CreatureData/CreatureSpecies.cpp +++ b/src/Library/CreatureData/CreatureSpecies.cpp @@ -1,4 +1,5 @@ #include "CreatureSpecies.hpp" +#include using namespace CreatureLib::Library; diff --git a/src/Library/CreatureData/LearnableAttacks.cpp b/src/Library/CreatureData/LearnableAttacks.cpp index ce7db8c..2872c06 100644 --- a/src/Library/CreatureData/LearnableAttacks.cpp +++ b/src/Library/CreatureData/LearnableAttacks.cpp @@ -1,4 +1,5 @@ #include "LearnableAttacks.hpp" +#include namespace CreatureLib::Library { struct LearnableAttacks::impl { diff --git a/src/Library/CreatureData/LearnableAttacks.hpp b/src/Library/CreatureData/LearnableAttacks.hpp index 39e2db5..18be92e 100644 --- a/src/Library/CreatureData/LearnableAttacks.hpp +++ b/src/Library/CreatureData/LearnableAttacks.hpp @@ -1,7 +1,9 @@ #ifndef CREATURELIB_LEARNABLEATTACKS_HPP #define CREATURELIB_LEARNABLEATTACKS_HPP +#include #include +#include #include "../Attacks/AttackData.hpp" namespace CreatureLib::Library { diff --git a/src/Library/EffectParameter.hpp b/src/Library/EffectParameter.hpp index 7b65d8f..471e795 100644 --- a/src/Library/EffectParameter.hpp +++ b/src/Library/EffectParameter.hpp @@ -1,10 +1,13 @@ #ifndef CREATURELIB_EFFECTPARAMETER_HPP #define CREATURELIB_EFFECTPARAMETER_HPP +#include +#include #include +#include "../Defines.hpp" #include "Exceptions/CreatureException.hpp" namespace CreatureLib::Library { - ENUM(EffectParameterType, uint8_t, None, Bool, Int, Float, String); + ENUM(EffectParameterType, u8, None, Bool, Int, Float, String); class EffectParameter { private: diff --git a/src/Library/Gender.hpp b/src/Library/Gender.hpp index d622b8d..328a9ca 100644 --- a/src/Library/Gender.hpp +++ b/src/Library/Gender.hpp @@ -1,5 +1,6 @@ #ifndef CREATURELIB_GENDER_HPP #define CREATURELIB_GENDER_HPP +#include namespace CreatureLib::Library { /*! diff --git a/src/Library/GrowthRates/ExternGrowthRate.hpp b/src/Library/GrowthRates/ExternGrowthRate.hpp index 632d1ac..02ebbb0 100644 --- a/src/Library/GrowthRates/ExternGrowthRate.hpp +++ b/src/Library/GrowthRates/ExternGrowthRate.hpp @@ -1,8 +1,10 @@ #ifndef CREATURELIB_EXTERNGROWTHRATE_HPP #define CREATURELIB_EXTERNGROWTHRATE_HPP +#include #include "../../Defines.hpp" #include "GrowthRate.hpp" + namespace CreatureLib::Library { class ExternGrowthRate : public GrowthRate { level_int_t (*_calcLevel)(uint32_t experience); diff --git a/src/Library/GrowthRates/GrowthRateLibrary.cpp b/src/Library/GrowthRates/GrowthRateLibrary.cpp index df6fadc..8955d03 100644 --- a/src/Library/GrowthRates/GrowthRateLibrary.cpp +++ b/src/Library/GrowthRates/GrowthRateLibrary.cpp @@ -1,4 +1,5 @@ #include "GrowthRateLibrary.hpp" +#include #include "../Exceptions/CreatureException.hpp" uint8_t CreatureLib::Library::GrowthRateLibrary::CalculateLevel(const ArbUt::BasicStringView& growthRate, diff --git a/src/Library/GrowthRates/GrowthRateLibrary.hpp b/src/Library/GrowthRates/GrowthRateLibrary.hpp index 8e58380..79bf068 100644 --- a/src/Library/GrowthRates/GrowthRateLibrary.hpp +++ b/src/Library/GrowthRates/GrowthRateLibrary.hpp @@ -1,6 +1,8 @@ #ifndef CREATURELIB_GROWTHRATELIBRARY_HPP #define CREATURELIB_GROWTHRATELIBRARY_HPP +#include +#include #include "GrowthRate.hpp" namespace CreatureLib::Library { diff --git a/src/Library/GrowthRates/LookupGrowthRate.hpp b/src/Library/GrowthRates/LookupGrowthRate.hpp index e4974f1..c93d211 100644 --- a/src/Library/GrowthRates/LookupGrowthRate.hpp +++ b/src/Library/GrowthRates/LookupGrowthRate.hpp @@ -1,6 +1,7 @@ #ifndef CREATURELIB_LOOKUPGROWTHRATE_HPP #define CREATURELIB_LOOKUPGROWTHRATE_HPP +#include #include "GrowthRate.hpp" namespace CreatureLib::Library { diff --git a/src/Library/Items/Item.hpp b/src/Library/Items/Item.hpp index e95ccfd..aa5c029 100644 --- a/src/Library/Items/Item.hpp +++ b/src/Library/Items/Item.hpp @@ -1,6 +1,9 @@ #ifndef CREATURELIB_ITEM_HPP #define CREATURELIB_ITEM_HPP +#include +#include +#include #include "../Attacks/SecondaryEffect.hpp" #include "BattleItemCategory.hpp" #include "ItemCategory.hpp" diff --git a/src/Library/LibrarySettings.hpp b/src/Library/LibrarySettings.hpp index b887a5b..545e5dc 100644 --- a/src/Library/LibrarySettings.hpp +++ b/src/Library/LibrarySettings.hpp @@ -1,6 +1,9 @@ #ifndef CREATURELIB_LIBRARYSETTINGS_HPP #define CREATURELIB_LIBRARYSETTINGS_HPP +#include +#include "../Defines.hpp" + namespace CreatureLib::Library { /// @brief Hold the different runtime settings for a given library. class LibrarySettings { diff --git a/src/Library/Statistic.hpp b/src/Library/Statistic.hpp index 323311a..e17d427 100644 --- a/src/Library/Statistic.hpp +++ b/src/Library/Statistic.hpp @@ -1,5 +1,6 @@ #ifndef CREATURELIB_STATISTIC_HPP #define CREATURELIB_STATISTIC_HPP +#include namespace CreatureLib::Library { ENUM(Statistic, uint8_t, Health, PhysicalAttack, PhysicalDefense, MagicalAttack, MagicalDefense, Speed) diff --git a/src/Library/StatisticSet.hpp b/src/Library/StatisticSet.hpp index f6b6a72..1c42aa2 100644 --- a/src/Library/StatisticSet.hpp +++ b/src/Library/StatisticSet.hpp @@ -1,10 +1,13 @@ #ifndef CREATURELIB_STATISTICSET_HPP #define CREATURELIB_STATISTICSET_HPP + +#include #include "Exceptions/CreatureException.hpp" #include "Statistic.hpp" namespace CreatureLib::Library { - template concept StatisticSetType = std::is_integral::value; + template + concept StatisticSetType = std::is_integral::value; /// @brief A class to hold all the different stats a creature can have. /// @tparam T An integer type that defines the kind the different fields in the set can have. diff --git a/src/Library/TypeLibrary.hpp b/src/Library/TypeLibrary.hpp index 7ef85bd..edd832c 100644 --- a/src/Library/TypeLibrary.hpp +++ b/src/Library/TypeLibrary.hpp @@ -1,19 +1,23 @@ #ifndef CREATURELIB_TYPELIBRARY_HPP #define CREATURELIB_TYPELIBRARY_HPP +#include +#include +#include +#include +#include "../Defines.hpp" #include "Exceptions/CreatureException.hpp" namespace CreatureLib::Library { class TypeLibrary { - ArbUt::Dictionary _types; + ArbUt::Dictionary _types; ArbUt::List> _effectiveness; public: - TypeLibrary(size_t initialCapacity = 20) - : _types(ArbUt::Dictionary(initialCapacity)) {} + TypeLibrary(size_t initialCapacity = 20) : _types(ArbUt::Dictionary(initialCapacity)) {} inline uint8_t GetTypeId(const ArbUt::StringView& key) const { return _types.Get(key); } - [[nodiscard]] inline float GetSingleEffectiveness(uint8_t attacking, uint8_t defensive) const { + [[nodiscard]] inline float GetSingleEffectiveness(u8 attacking, u8 defensive) const { try { return _effectiveness[attacking][defensive]; } catch (const std::exception& e) { @@ -21,16 +25,16 @@ namespace CreatureLib::Library { << (uint32_t)defensive); } } - [[nodiscard]] inline float GetEffectiveness(uint8_t attacking, const std::vector& defensive) const { + [[nodiscard]] inline float GetEffectiveness(uint8_t attacking, const std::vector& defensive) const { return std::accumulate(defensive.begin(), defensive.end(), (float)1, [this, attacking](float init, uint8_t defense) { return init * GetSingleEffectiveness(attacking, defense); }); } - const ArbUt::StringView& GetTypeName(uint8_t type) const; + const ArbUt::StringView& GetTypeName(u8 type) const; uint8_t RegisterType(const ArbUt::StringView& typeName); - void SetEffectiveness(uint8_t attacking, uint8_t defensive, float effectiveness); + void SetEffectiveness(uint8_t attacking, u8 defensive, float effectiveness); }; } diff --git a/src/Precompiled.hxx b/src/Precompiled.hxx deleted file mode 100644 index 1e34b8a..0000000 --- a/src/Precompiled.hxx +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef CREATURELIB_PRECOMPILED_HXX -#define CREATURELIB_PRECOMPILED_HXX - -// std -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Arbutils -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// CreatureLib -#include "Defines.hpp" - -#endif // CREATURELIB_PRECOMPILED_HXX