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

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,11 @@
#ifndef 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/String/StringView.hpp>
namespace CreatureLib::Library {
template <class T> class BaseLibrary {

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,13 @@
#ifndef CREATURELIB_EFFECTPARAMETER_HPP
#define CREATURELIB_EFFECTPARAMETER_HPP
#include <Arbutils/Enum.hpp>
#include <Arbutils/Exception.hpp>
#include <variant>
#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:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,13 @@
#ifndef CREATURELIB_STATISTICSET_HPP
#define CREATURELIB_STATISTICSET_HPP
#include <Arbutils/Exception.hpp>
#include "Exceptions/CreatureException.hpp"
#include "Statistic.hpp"
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.
/// @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
#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"
namespace CreatureLib::Library {
class TypeLibrary {
ArbUt::Dictionary<ArbUt::StringView, uint8_t> _types;
ArbUt::Dictionary<ArbUt::StringView, u8> _types;
ArbUt::List<ArbUt::List<float>> _effectiveness;
public:
TypeLibrary(size_t initialCapacity = 20)
: _types(ArbUt::Dictionary<ArbUt::StringView, uint8_t>(initialCapacity)) {}
TypeLibrary(size_t initialCapacity = 20) : _types(ArbUt::Dictionary<ArbUt::StringView, u8>(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<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,
[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);
};
}