Fixes project being completely dirty every build requiring constant full rebuilds and slowing down tooling.
continuous-integration/drone/push Build is passing Details

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
Deukhoofd 2021-10-30 14:24:38 +02:00
parent d55b40f3d0
commit e1d8348b2f
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
33 changed files with 69 additions and 53 deletions

View File

@ -60,7 +60,6 @@ endif ()
file(GLOB_RECURSE LIBRARY_SRC_FILES file(GLOB_RECURSE LIBRARY_SRC_FILES
"src/*.cpp" "src/*.hpp" "CInterface/*.cpp" "CInterface/*.hpp") "src/*.cpp" "src/*.hpp" "CInterface/*.cpp" "CInterface/*.hpp")
add_library(CreatureLib ${LIBTYPE} ${LIBRARY_SRC_FILES}) add_library(CreatureLib ${LIBTYPE} ${LIBRARY_SRC_FILES})
target_precompile_headers(CreatureLib PUBLIC src/Precompiled.hxx)
# If interprocedural optimization is available, apply it # If interprocedural optimization is available, apply it
check_ipo_supported(RESULT IPO_SUPPORTED) check_ipo_supported(RESULT IPO_SUPPORTED)

View File

@ -40,6 +40,8 @@ function(include_arbutils)
execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include) execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include)
execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/src/arbutils/src execute_process(COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/Arbutils/src/arbutils/src
${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include/Arbutils) ${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) include_directories(${CMAKE_CURRENT_BINARY_DIR}/Arbutils/include)

View File

@ -1,6 +1,8 @@
#ifndef CREATURELIB_EVENTDATAKIND_HPP #ifndef CREATURELIB_EVENTDATAKIND_HPP
#define CREATURELIB_EVENTDATAKIND_HPP #define CREATURELIB_EVENTDATAKIND_HPP
#include <Arbutils/Enum.hpp>
namespace CreatureLib::Battling { namespace CreatureLib::Battling {
ENUM(EventDataKind, uint8_t, Damage, Heal, Faint, Switch, TurnStart, TurnEnd, ExperienceGain, Miss, DisplayText, ENUM(EventDataKind, uint8_t, Damage, Heal, Faint, Switch, TurnStart, TurnEnd, ExperienceGain, Miss, DisplayText,
ChangeSpecies, ChangeVariant, AttackUse, ChangeStatBoost, Fail, Swap, StatusChange) ChangeSpecies, ChangeVariant, AttackUse, ChangeStatBoost, Fail, Swap, StatusChange)

View File

@ -1,12 +1,14 @@
#ifndef CREATURELIB_EVENTHOOK_HPP #ifndef CREATURELIB_EVENTHOOK_HPP
#define CREATURELIB_EVENTHOOK_HPP #define CREATURELIB_EVENTHOOK_HPP
#include <Arbutils/Exception.hpp>
#include <functional> #include <functional>
#include <thread> #include <thread>
#include "../../Library/Exceptions/CreatureException.hpp" #include "../../Library/Exceptions/CreatureException.hpp"
#include "Events/EventData.hpp" #include "Events/EventData.hpp"
template <class T> concept EventDataType = std::is_base_of<CreatureLib::Battling::EventData, T>::value; template <class T>
concept EventDataType = std::is_base_of<CreatureLib::Battling::EventData, T>::value;
namespace CreatureLib::Battling { namespace CreatureLib::Battling {
/// The Event Hook class allows users to write consumers for the battle events, for example to write User Interfaces /// The Event Hook class allows users to write consumers for the battle events, for example to write User Interfaces

View File

@ -1,6 +1,9 @@
#ifndef CREATURELIB_EXPERIENCELIBRARY_HPP #ifndef CREATURELIB_EXPERIENCELIBRARY_HPP
#define CREATURELIB_EXPERIENCELIBRARY_HPP #define CREATURELIB_EXPERIENCELIBRARY_HPP
#include <Arbutils/Memory/Memory.hpp>
#include <unordered_set>
namespace CreatureLib::Battling { namespace CreatureLib::Battling {
class Creature; class Creature;

View File

@ -1,14 +1,15 @@
#ifndef CREATURELIB_CREATUREINDEX_HPP #ifndef CREATURELIB_CREATUREINDEX_HPP
#define CREATURELIB_CREATUREINDEX_HPP #define CREATURELIB_CREATUREINDEX_HPP
#include "../../Defines.hpp"
namespace CreatureLib::Battling { namespace CreatureLib::Battling {
class CreatureIndex { class CreatureIndex {
uint8_t _side; u8 _side;
uint8_t _creature; u8 _creature;
public: public:
CreatureIndex() noexcept : _side(0), _creature(0) {} 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; } uint8_t GetSideIndex() const noexcept { return _side; }

View File

@ -1,6 +1,7 @@
#ifndef CREATURELIB_LEARNEDATTACK_HPP #ifndef CREATURELIB_LEARNEDATTACK_HPP
#define CREATURELIB_LEARNEDATTACK_HPP #define CREATURELIB_LEARNEDATTACK_HPP
#include <Arbutils/Memory/Memory.hpp>
#include "../../Library/Attacks/AttackData.hpp" #include "../../Library/Attacks/AttackData.hpp"
#include "AttackLearnMethod.hpp" #include "AttackLearnMethod.hpp"

View File

@ -1,6 +1,9 @@
#ifndef CREATURELIB_SCRIPT_HPP #ifndef CREATURELIB_SCRIPT_HPP
#define CREATURELIB_SCRIPT_HPP #define CREATURELIB_SCRIPT_HPP
#include <Arbutils/Collections/List.hpp>
#include <Arbutils/Memory/Memory.hpp>
#include <Arbutils/Misc.hpp>
#include "../../Library/EffectParameter.hpp" #include "../../Library/EffectParameter.hpp"
namespace CreatureLib::Battling { namespace CreatureLib::Battling {

View File

@ -1,6 +1,7 @@
#ifndef ITEMUSESCRIPT_HPP #ifndef ITEMUSESCRIPT_HPP
#define ITEMUSESCRIPT_HPP #define ITEMUSESCRIPT_HPP
#include <Arbutils/Collections/List.hpp>
#include "../../Library/EffectParameter.hpp" #include "../../Library/EffectParameter.hpp"
namespace CreatureLib::Battling { namespace CreatureLib::Battling {
class Creature; class Creature;

View File

@ -1,6 +1,7 @@
#ifndef CREATURELIB_SCRIPTRESOLVER_HPP #ifndef CREATURELIB_SCRIPTRESOLVER_HPP
#define CREATURELIB_SCRIPTRESOLVER_HPP #define CREATURELIB_SCRIPTRESOLVER_HPP
#include <unordered_set>
#include "../../Library/Items/Item.hpp" #include "../../Library/Items/Item.hpp"
#include "BattleScript.hpp" #include "BattleScript.hpp"
#include "ItemUseScript.hpp" #include "ItemUseScript.hpp"

View File

@ -1,6 +1,7 @@
#ifndef CREATURELIB_SCRIPTSET_HPP #ifndef CREATURELIB_SCRIPTSET_HPP
#define CREATURELIB_SCRIPTSET_HPP #define CREATURELIB_SCRIPTSET_HPP
#include <Arbutils/Collections/Dictionary.hpp>
#include <any> #include <any>
#include "BattleScript.hpp" #include "BattleScript.hpp"

View File

@ -1,5 +1,6 @@
#ifndef CREATURELIB_DEFINES_HPP #ifndef CREATURELIB_DEFINES_HPP
#define CREATURELIB_DEFINES_HPP #define CREATURELIB_DEFINES_HPP
#include <cstdint>
#if LEVEL_U8 #if LEVEL_U8
using level_int_t = uint8_t; using level_int_t = uint8_t;

View File

@ -1,5 +1,6 @@
#ifndef CREATURELIB_ATTACKCATEGORY_HPP #ifndef CREATURELIB_ATTACKCATEGORY_HPP
#define CREATURELIB_ATTACKCATEGORY_HPP #define CREATURELIB_ATTACKCATEGORY_HPP
#include <Arbutils/Enum.hpp>
namespace CreatureLib::Library { namespace CreatureLib::Library {
ENUM(AttackCategory, uint8_t, Physical, Magical, Status) ENUM(AttackCategory, uint8_t, Physical, Magical, Status)

View File

@ -1,6 +1,7 @@
#ifndef CREATURELIB_ATTACKDATA_HPP #ifndef CREATURELIB_ATTACKDATA_HPP
#define CREATURELIB_ATTACKDATA_HPP #define CREATURELIB_ATTACKDATA_HPP
#include <unordered_set>
#include "AttackCategory.hpp" #include "AttackCategory.hpp"
#include "AttackTarget.hpp" #include "AttackTarget.hpp"
#include "SecondaryEffect.hpp" #include "SecondaryEffect.hpp"

View File

@ -1,6 +1,8 @@
#ifndef CREATURELIB_ATTACKTARGET_HPP #ifndef CREATURELIB_ATTACKTARGET_HPP
#define CREATURELIB_ATTACKTARGET_HPP #define CREATURELIB_ATTACKTARGET_HPP
#include <Arbutils/Enum.hpp>
namespace CreatureLib::Library { namespace CreatureLib::Library {
ENUM(AttackTarget, uint8_t, Adjacent, AdjacentAlly, AdjacentAllySelf, AdjacentOpponent, ENUM(AttackTarget, uint8_t, Adjacent, AdjacentAlly, AdjacentAllySelf, AdjacentOpponent,

View File

@ -1,6 +1,7 @@
#ifndef CREATURELIB_SECONDARYEFFECT_HPP #ifndef CREATURELIB_SECONDARYEFFECT_HPP
#define CREATURELIB_SECONDARYEFFECT_HPP #define CREATURELIB_SECONDARYEFFECT_HPP
#include <Arbutils/Collections/List.hpp>
#include <any> #include <any>
#include "../EffectParameter.hpp" #include "../EffectParameter.hpp"

View File

@ -1,7 +1,11 @@
#ifndef CREATURELIB_BASELIBRARY_HPP #ifndef CREATURELIB_BASELIBRARY_HPP
#define CREATURELIB_BASELIBRARY_HPP #define CREATURELIB_BASELIBRARY_HPP
#include <Arbutils/Collections/Dictionary.hpp>
#include <Arbutils/Collections/List.hpp>
#include <Arbutils/Memory/Memory.hpp>
#include <Arbutils/Random.hpp> #include <Arbutils/Random.hpp>
#include <Arbutils/String/StringView.hpp>
namespace CreatureLib::Library { namespace CreatureLib::Library {
template <class T> class BaseLibrary { template <class T> class BaseLibrary {

View File

@ -1,6 +1,7 @@
#ifndef CREATURELIB_CLAMPEDSTATISTICSET_HPP #ifndef CREATURELIB_CLAMPEDSTATISTICSET_HPP
#define CREATURELIB_CLAMPEDSTATISTICSET_HPP #define CREATURELIB_CLAMPEDSTATISTICSET_HPP
#include <Arbutils/Exception.hpp>
#include "Exceptions/CreatureException.hpp" #include "Exceptions/CreatureException.hpp"
#include "Statistic.hpp" #include "Statistic.hpp"

View File

@ -1,4 +1,5 @@
#include "CreatureSpecies.hpp" #include "CreatureSpecies.hpp"
#include <Arbutils/Collections/Dictionary.hpp>
using namespace CreatureLib::Library; using namespace CreatureLib::Library;

View File

@ -1,4 +1,5 @@
#include "LearnableAttacks.hpp" #include "LearnableAttacks.hpp"
#include <Arbutils/Collections/Dictionary.hpp>
namespace CreatureLib::Library { namespace CreatureLib::Library {
struct LearnableAttacks::impl { struct LearnableAttacks::impl {

View File

@ -1,7 +1,9 @@
#ifndef CREATURELIB_LEARNABLEATTACKS_HPP #ifndef CREATURELIB_LEARNABLEATTACKS_HPP
#define CREATURELIB_LEARNABLEATTACKS_HPP #define CREATURELIB_LEARNABLEATTACKS_HPP
#include <Arbutils/Memory/Memory.hpp>
#include <Arbutils/Random.hpp> #include <Arbutils/Random.hpp>
#include <optional>
#include "../Attacks/AttackData.hpp" #include "../Attacks/AttackData.hpp"
namespace CreatureLib::Library { namespace CreatureLib::Library {

View File

@ -1,10 +1,13 @@
#ifndef CREATURELIB_EFFECTPARAMETER_HPP #ifndef CREATURELIB_EFFECTPARAMETER_HPP
#define CREATURELIB_EFFECTPARAMETER_HPP #define CREATURELIB_EFFECTPARAMETER_HPP
#include <Arbutils/Enum.hpp>
#include <Arbutils/Exception.hpp>
#include <variant> #include <variant>
#include "../Defines.hpp"
#include "Exceptions/CreatureException.hpp" #include "Exceptions/CreatureException.hpp"
namespace CreatureLib::Library { namespace CreatureLib::Library {
ENUM(EffectParameterType, uint8_t, None, Bool, Int, Float, String); ENUM(EffectParameterType, u8, None, Bool, Int, Float, String);
class EffectParameter { class EffectParameter {
private: private:

View File

@ -1,5 +1,6 @@
#ifndef CREATURELIB_GENDER_HPP #ifndef CREATURELIB_GENDER_HPP
#define CREATURELIB_GENDER_HPP #define CREATURELIB_GENDER_HPP
#include <Arbutils/Enum.hpp>
namespace CreatureLib::Library { namespace CreatureLib::Library {
/*! /*!

View File

@ -1,8 +1,10 @@
#ifndef CREATURELIB_EXTERNGROWTHRATE_HPP #ifndef CREATURELIB_EXTERNGROWTHRATE_HPP
#define CREATURELIB_EXTERNGROWTHRATE_HPP #define CREATURELIB_EXTERNGROWTHRATE_HPP
#include <Arbutils/Ensure.hpp>
#include "../../Defines.hpp" #include "../../Defines.hpp"
#include "GrowthRate.hpp" #include "GrowthRate.hpp"
namespace CreatureLib::Library { namespace CreatureLib::Library {
class ExternGrowthRate : public GrowthRate { class ExternGrowthRate : public GrowthRate {
level_int_t (*_calcLevel)(uint32_t experience); level_int_t (*_calcLevel)(uint32_t experience);

View File

@ -1,4 +1,5 @@
#include "GrowthRateLibrary.hpp" #include "GrowthRateLibrary.hpp"
#include <Arbutils/Exception.hpp>
#include "../Exceptions/CreatureException.hpp" #include "../Exceptions/CreatureException.hpp"
uint8_t CreatureLib::Library::GrowthRateLibrary::CalculateLevel(const ArbUt::BasicStringView& growthRate, uint8_t CreatureLib::Library::GrowthRateLibrary::CalculateLevel(const ArbUt::BasicStringView& growthRate,

View File

@ -1,6 +1,8 @@
#ifndef CREATURELIB_GROWTHRATELIBRARY_HPP #ifndef CREATURELIB_GROWTHRATELIBRARY_HPP
#define CREATURELIB_GROWTHRATELIBRARY_HPP #define CREATURELIB_GROWTHRATELIBRARY_HPP
#include <Arbutils/String/StringView.hpp>
#include <unordered_map>
#include "GrowthRate.hpp" #include "GrowthRate.hpp"
namespace CreatureLib::Library { namespace CreatureLib::Library {

View File

@ -1,6 +1,7 @@
#ifndef CREATURELIB_LOOKUPGROWTHRATE_HPP #ifndef CREATURELIB_LOOKUPGROWTHRATE_HPP
#define CREATURELIB_LOOKUPGROWTHRATE_HPP #define CREATURELIB_LOOKUPGROWTHRATE_HPP
#include <Arbutils/Collections/List.hpp>
#include "GrowthRate.hpp" #include "GrowthRate.hpp"
namespace CreatureLib::Library { namespace CreatureLib::Library {

View File

@ -1,6 +1,9 @@
#ifndef CREATURELIB_ITEM_HPP #ifndef CREATURELIB_ITEM_HPP
#define CREATURELIB_ITEM_HPP #define CREATURELIB_ITEM_HPP
#include <Arbutils/Memory/Memory.hpp>
#include <Arbutils/Misc.hpp>
#include <unordered_set>
#include "../Attacks/SecondaryEffect.hpp" #include "../Attacks/SecondaryEffect.hpp"
#include "BattleItemCategory.hpp" #include "BattleItemCategory.hpp"
#include "ItemCategory.hpp" #include "ItemCategory.hpp"

View File

@ -1,6 +1,9 @@
#ifndef CREATURELIB_LIBRARYSETTINGS_HPP #ifndef CREATURELIB_LIBRARYSETTINGS_HPP
#define CREATURELIB_LIBRARYSETTINGS_HPP #define CREATURELIB_LIBRARYSETTINGS_HPP
#include <memory>
#include "../Defines.hpp"
namespace CreatureLib::Library { namespace CreatureLib::Library {
/// @brief Hold the different runtime settings for a given library. /// @brief Hold the different runtime settings for a given library.
class LibrarySettings { class LibrarySettings {

View File

@ -1,5 +1,6 @@
#ifndef CREATURELIB_STATISTIC_HPP #ifndef CREATURELIB_STATISTIC_HPP
#define CREATURELIB_STATISTIC_HPP #define CREATURELIB_STATISTIC_HPP
#include <Arbutils/Enum.hpp>
namespace CreatureLib::Library { namespace CreatureLib::Library {
ENUM(Statistic, uint8_t, Health, PhysicalAttack, PhysicalDefense, MagicalAttack, MagicalDefense, Speed) ENUM(Statistic, uint8_t, Health, PhysicalAttack, PhysicalDefense, MagicalAttack, MagicalDefense, Speed)

View File

@ -1,10 +1,13 @@
#ifndef CREATURELIB_STATISTICSET_HPP #ifndef CREATURELIB_STATISTICSET_HPP
#define CREATURELIB_STATISTICSET_HPP #define CREATURELIB_STATISTICSET_HPP
#include <Arbutils/Exception.hpp>
#include "Exceptions/CreatureException.hpp" #include "Exceptions/CreatureException.hpp"
#include "Statistic.hpp" #include "Statistic.hpp"
namespace CreatureLib::Library { namespace CreatureLib::Library {
template <typename T> concept StatisticSetType = std::is_integral<T>::value; template <typename T>
concept StatisticSetType = std::is_integral<T>::value;
/// @brief A class to hold all the different stats a creature can have. /// @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. /// @tparam T An integer type that defines the kind the different fields in the set can have.

View File

@ -1,19 +1,23 @@
#ifndef CREATURELIB_TYPELIBRARY_HPP #ifndef CREATURELIB_TYPELIBRARY_HPP
#define CREATURELIB_TYPELIBRARY_HPP #define CREATURELIB_TYPELIBRARY_HPP
#include <Arbutils/Collections/Dictionary.hpp>
#include <Arbutils/Collections/List.hpp>
#include <Arbutils/String/StringView.hpp>
#include <numeric>
#include "../Defines.hpp"
#include "Exceptions/CreatureException.hpp" #include "Exceptions/CreatureException.hpp"
namespace CreatureLib::Library { namespace CreatureLib::Library {
class TypeLibrary { class TypeLibrary {
ArbUt::Dictionary<ArbUt::StringView, uint8_t> _types; ArbUt::Dictionary<ArbUt::StringView, u8> _types;
ArbUt::List<ArbUt::List<float>> _effectiveness; ArbUt::List<ArbUt::List<float>> _effectiveness;
public: public:
TypeLibrary(size_t initialCapacity = 20) TypeLibrary(size_t initialCapacity = 20) : _types(ArbUt::Dictionary<ArbUt::StringView, u8>(initialCapacity)) {}
: _types(ArbUt::Dictionary<ArbUt::StringView, uint8_t>(initialCapacity)) {}
inline uint8_t GetTypeId(const ArbUt::StringView& key) const { return _types.Get(key); } 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 { try {
return _effectiveness[attacking][defensive]; return _effectiveness[attacking][defensive];
} catch (const std::exception& e) { } catch (const std::exception& e) {
@ -21,16 +25,16 @@ namespace CreatureLib::Library {
<< (uint32_t)defensive); << (uint32_t)defensive);
} }
} }
[[nodiscard]] inline float GetEffectiveness(uint8_t attacking, const std::vector<uint8_t>& defensive) const { [[nodiscard]] inline float GetEffectiveness(uint8_t attacking, const std::vector<u8>& defensive) const {
return std::accumulate(defensive.begin(), defensive.end(), (float)1, return std::accumulate(defensive.begin(), defensive.end(), (float)1,
[this, attacking](float init, uint8_t defense) { [this, attacking](float init, uint8_t defense) {
return init * GetSingleEffectiveness(attacking, 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); 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);
}; };
} }

View File

@ -1,39 +0,0 @@
#ifndef CREATURELIB_PRECOMPILED_HXX
#define CREATURELIB_PRECOMPILED_HXX
// std
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <exception>
#include <memory>
#include <numeric>
#include <optional>
#include <sstream>
#include <stdexcept>
#include <string>
#include <string_view>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <variant>
#include <vector>
// Arbutils
#include <Arbutils/Collections/Dictionary.hpp>
#include <Arbutils/Collections/List.hpp>
#include <Arbutils/Ensure.hpp>
#include <Arbutils/Enum.hpp>
#include <Arbutils/Exception.hpp>
#include <Arbutils/Memory/Memory.hpp>
#include <Arbutils/Misc.hpp>
#include <Arbutils/Precompiled.hxx>
#include <Arbutils/StringView.hpp>
// CreatureLib
#include "Defines.hpp"
#endif // CREATURELIB_PRECOMPILED_HXX