Adds precompiled header.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-09-29 17:51:11 +02:00
parent fda3c8f86d
commit 2ce766f589
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
39 changed files with 20 additions and 68 deletions

View File

@ -84,6 +84,7 @@ endif ()
file(GLOB_RECURSE CORE_SRC_FILES ${FILE_SOURCE})
add_library(pkmnLib ${LIBTYPE} ${CORE_SRC_FILES})
target_precompile_headers(pkmnLib PUBLIC src/Precompiled.hxx)
SET(_LINKS CreatureLib Arbutils)
SET(_TESTLINKS pkmnLib CreatureLib Arbutils)

View File

@ -1,6 +1,5 @@
#ifndef PKMNLIB_PKMNEVENTKIND_HPP
#define PKMNLIB_PKMNEVENTKIND_HPP
#include <Arbutils/Enum.hpp>
#include <CreatureLib/Battling/EventHooks/EventDataKind.hpp>
ENUM_WITH_START_VALUE(PkmnEventDataKind, uint8_t, 128, WeatherChange, StatusChange)

View File

@ -1,7 +1,6 @@
#ifndef PKMNLIB_STATUSCHANGEEVENT_HPP
#define PKMNLIB_STATUSCHANGEEVENT_HPP
#include <Arbutils/String/StringView.hpp>
#include <CreatureLib/Battling/EventHooks/Events/EventData.hpp>
#include "../Pokemon/Pokemon.hpp"
#include "PkmnEventKind.hpp"

View File

@ -1,6 +1,5 @@
#ifndef PKMNLIB_WEATHERCHANGEEVENT_HPP
#define PKMNLIB_WEATHERCHANGEEVENT_HPP
#include <Arbutils/StringView.hpp>
#include <CreatureLib/Battling/EventHooks/Events/EventData.hpp>
#include "PkmnEventKind.hpp"

View File

@ -2,7 +2,6 @@
#define PKMNLIB_BATTLELIBRARY_HPP
#include <CreatureLib/Battling/Library/BattleLibrary.hpp>
#include <memory>
#include "../../Library/PokemonLibrary.hpp"
#include "DamageLibrary.hpp"
#include "ExperienceLibrary.hpp"

View File

@ -1,7 +1,6 @@
#ifndef PKMNLIB_PKMNDAMAGESOURCE_HPP
#define PKMNLIB_PKMNDAMAGESOURCE_HPP
#include <Arbutils/Enum.hpp>
#include <CreatureLib/Battling/Models/DamageSource.hpp>
ENUM_WITH_START_VALUE(PkmnDamageSource, uint8_t, ((uint8_t)CreatureLib::Battling::DamageSourceHelper::Highest()) + 1,

View File

@ -1,6 +1,5 @@
#ifndef PKMNLIB_PKMNSCRIPTCATEGORY_HPP
#define PKMNLIB_PKMNSCRIPTCATEGORY_HPP
#include <Arbutils/Enum.hpp>
#include <CreatureLib/Battling/ScriptHandling/ScriptCategory.hpp>
ENUM_WITH_START_VALUE(PkmnScriptCategory, uint8_t, 128, Weather, Status)

View File

@ -1,7 +1,6 @@
#ifndef PKMNLIB_CREATEPOKEMON_HPP
#define PKMNLIB_CREATEPOKEMON_HPP
#include <utility>
#include "Pokemon.hpp"
namespace PkmnLib::Battling {
class CreatePokemon {

View File

@ -2,7 +2,6 @@
#define PKMNLIB_POKEMON_HPP
#include <CreatureLib/Battling/Models/Creature.hpp>
#include <utility>
#include "../../Library/Statistic.hpp"
#include "../Library/BattleLibrary.hpp"
#include "LearnedMove.hpp"

View File

@ -2,7 +2,6 @@
#define PKMNLIB_POKEMONPARTY_HPP
#include <CreatureLib/Battling/Models/CreatureParty.hpp>
#include <utility>
#include "Pokemon.hpp"
namespace PkmnLib::Battling {
class PokemonParty : public CreatureLib::Battling::CreatureParty {

View File

@ -1,13 +1,8 @@
#ifndef PKMNLIB_EVOLUTIONDATA_HPP
#define PKMNLIB_EVOLUTIONDATA_HPP
#include <Arbutils/Collections/List.hpp>
#include <Arbutils/Memory/BorrowedPtr.hpp>
#include <Arbutils/Memory/UniquePtrList.hpp>
#include <CreatureLib/Library/EffectParameter.hpp>
#include <CreatureLib/Library/Gender.hpp>
#include <string>
#include <utility>
#include "../TimeOfDay.hpp"
#include "EvolutionMethod.hpp"

View File

@ -1,7 +1,6 @@
#ifndef PKMNLIB_EVOLUTIONMETHOD_HPP
#define PKMNLIB_EVOLUTIONMETHOD_HPP
#include <cstdint>
namespace PkmnLib::Library {
ENUM(EvolutionMethod, uint8_t, Level, HighFriendship, KnownMove, LocationBased, TimeBased, HoldsItem,
IsGenderAndLevel, EvolutionItemUse, EvolutionItemUseWithGender, Trade, TradeWithHeldItem,

View File

@ -1,8 +1,6 @@
#ifndef PKMNLIB_MOVECATEGORY_HPP
#define PKMNLIB_MOVECATEGORY_HPP
#include <cstdint>
namespace PkmnLib::Library {
enum class MoveCategory : uint8_t { Physical, Special, Status };
}

View File

@ -1,5 +1,4 @@
#include "MoveData.hpp"
#include <utility>
PkmnLib::Library::MoveData::MoveData(const ArbUt::StringView& name, uint8_t type,
PkmnLib::Library::MoveCategory category, uint8_t power, uint8_t accuracy,
uint8_t baseUsage, CreatureLib::Library::AttackTarget target, int8_t priority,

View File

@ -1,14 +1,8 @@
#ifndef PKMNLIB_NATURELIBRARY_HPP
#define PKMNLIB_NATURELIBRARY_HPP
#include <Arbutils/Collections/Dictionary.hpp>
#include <Arbutils/Collections/List.hpp>
#include <Arbutils/Memory/BorrowedPtr.hpp>
#include <Arbutils/Random.hpp>
#include <Arbutils/StringView.hpp>
#include <CreatureLib/Library/Exceptions/CreatureException.hpp>
#include <unordered_map>
#include <vector>
#include "Nature.hpp"
namespace PkmnLib::Library {

View File

@ -1,8 +1,6 @@
#ifndef PKMNLIB_LEARNABLEMOVES_HPP
#define PKMNLIB_LEARNABLEMOVES_HPP
#include <Arbutils/Collections/List.hpp>
#include <Arbutils/Memory/BorrowedPtr.hpp>
#include <CreatureLib/Library/CreatureData/LearnableAttacks.hpp>
#include "../Moves/MoveData.hpp"

View File

@ -1,5 +1,4 @@
#include "PokemonForme.hpp"
#include <utility>
PkmnLib::Library::PokemonForme::PokemonForme(const ArbUt::StringView& name, float height, float weight,
uint32_t baseExperience, const ArbUt::List<uint8_t>& types,
CreatureLib::Library::StatisticSet<uint16_t> baseStats,

View File

@ -2,7 +2,6 @@
#define PKMNLIB_POKEMONFORME_HPP
#include <CreatureLib/Library/CreatureData/SpeciesVariant.hpp>
#include <cstdint>
#include "LearnableMoves.hpp"
namespace PkmnLib::Library {

View File

@ -1,6 +1,5 @@
#ifndef PKMNLIB_POKEMONSPECIES_HPP
#define PKMNLIB_POKEMONSPECIES_HPP
#include <Arbutils/Memory/UniquePtrList.hpp>
#include <CreatureLib/Battling/Models/Creature.hpp>
#include "../Evolutions/EvolutionData.hpp"
#include "PokemonForme.hpp"

View File

@ -1,9 +1,6 @@
#ifndef PKMNLIB_TIMEOFDAY_HPP
#define PKMNLIB_TIMEOFDAY_HPP
#include <Arbutils/Enum.hpp>
#include <cstdint>
namespace PkmnLib::Library {
ENUM(TimeOfDay, uint8_t, Night, Morning, Afternoon, Evening)
}

6
src/Precompiled.hxx Normal file
View File

@ -0,0 +1,6 @@
#ifndef PKMNLIB_PRECOMPILED_HXX
#define PKMNLIB_PRECOMPILED_HXX
#include <CreatureLib/Precompiled.hxx>
#endif // PKMNLIB_PRECOMPILED_HXX

View File

@ -1,6 +1,5 @@
#include "AngelScriptResolver.hpp"
#include <CreatureLib/Battling/Models/Creature.hpp>
#include <cassert>
#include <regex>
#include "../../../extern/angelscript_addons/scripthandle/scripthandle.h"
#include "../../../extern/angelscript_addons/scripthelper/scripthelper.h"
@ -74,12 +73,11 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg,
// Register Script Array type
RegisterScriptArray(_engine, true);
RegisterScriptHandle(_engine);
r = _engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(Print), asCALL_CDECL);
if (r < 0)
throw ArbUt::Exception("Registering print function failed.");
}
r = _engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(Print), asCALL_CDECL);
if (r < 0)
throw ArbUt::Exception("Registering print function failed.");
_builder.StartNewModule(_engine, "pkmn");
_mainModule = _builder.GetModule();

View File

@ -7,7 +7,6 @@
#define ANGELSCRIPT_DLL_LIBRARY_IMPORT
#include <angelscript.h>
#include <iostream>
#include "AngelScriptScript.hpp"
#include "AngelScriptTypeInfo.hpp"

View File

@ -3,7 +3,6 @@
#include <CreatureLib/Battling/ScriptHandling/Script.hpp>
#define ANGELSCRIPT_DLL_LIBRARY_IMPORT
#include <angelscript.h>
#include <cstdint>
#include "../../../extern/angelscript_addons/scriptarray/scriptarray.h"
#include "../../Battling/PkmnScript.hpp"
#include "AngelScriptTypeInfo.hpp"

View File

@ -2,13 +2,8 @@
#define PKMNLIB_ANGELSCRIPTTYPEINFO_HPP
#define ANGELSCRIPT_DLL_LIBRARY_IMPORT
#include <Arbutils/Collections/Dictionary.hpp>
#include <Arbutils/StringView.hpp>
#include <CreatureLib/Library/Exceptions/CreatureException.hpp>
#include <angelscript.h>
#include <cstring>
#include <unordered_map>
#include <utility>
class AngelScriptTypeInfo {
private:

View File

@ -2,7 +2,6 @@
#define PKMNLIB_CONTEXTPOOL_HPP
#include <angelscript.h>
#include <vector>
class ContextPool {
std::vector<asIScriptContext*> _pool;

View File

@ -1,5 +1,4 @@
#include "BasicScriptClass.hpp"
#include <cassert>
void BasicScriptClass::Register(asIScriptEngine* engine) {
// As far as I am aware at the moment you can't create an abstract class with virtual members through the
@ -46,5 +45,5 @@ shared abstract class PkmnScript {
void DoesShareExperience(Pokemon@ faintedMon, Pokemon@ winningMon, bool& shareExperience){};
}
)");
assert(r >= 0);
Assert(r >= 0);
}

View File

@ -1,6 +1,5 @@
#include "RegisterBattleClass.hpp"
#include <CreatureLib/Battling/Models/Battle.hpp>
#include <cstdint>
#include "../../../../Battling/Battle/Battle.hpp"
#include "../HelperFile.hpp"

View File

@ -1,5 +1,4 @@
#include "RegisterBattleLibrary.hpp"
#include <cassert>
#include "../../../../Battling/Library/BattleLibrary.hpp"
void RegisterBattleLibrary::Register(asIScriptEngine* engine) {

View File

@ -1,5 +1,4 @@
#include "RegisterExecutingAttack.hpp"
#include <Arbutils/Assert.hpp>
#include <CreatureLib/Battling/Models/ExecutingAttack.hpp>
#include "../HelperFile.hpp"

View File

@ -1,5 +1,4 @@
#include "RegisterPokemonClass.hpp"
#include <Arbutils/Assert.hpp>
#include <CreatureLib/Battling/Models/LearnedAttack.hpp>
#include "../../../../../extern/angelscript_addons/scriptarray/scriptarray.h"
#include "../../../../Battling/PkmnDamageSource.hpp"

View File

@ -1,5 +1,4 @@
#include "ConstString.hpp"
#include <Arbutils/StringView.hpp>
static void ConstructConstString(void* self) { new (self) ArbUt::StringView(); }
static void ConstructConstStringFromStd(void* self, const std::string& s) {

View File

@ -1,7 +1,6 @@
#ifndef PKMNLIB_CONSTSTRING_HPP
#define PKMNLIB_CONSTSTRING_HPP
#include <Arbutils/Assert.hpp>
#include <angelscript.h>
class ConstStringRegister {

View File

@ -1,5 +1,4 @@
#include "RegisterEffectParameter.hpp"
#include <Arbutils/Assert.hpp>
#include <CreatureLib/Library/EffectParameter.hpp>
static CreatureLib::Library::EffectParameter* Ref_Factory() { return new CreatureLib::Library::EffectParameter(); }

View File

@ -1,7 +1,6 @@
#include "RegisterGrowthRateTypes.hpp"
#include <CreatureLib/Library/GrowthRates/GrowthRate.hpp>
#include <CreatureLib/Library/GrowthRates/GrowthRateLibrary.hpp>
#include <cassert>
void RegisterGrowthRateTypes::Register(asIScriptEngine* engine) {
RegisterGrowthRateType(engine);
@ -9,13 +8,13 @@ void RegisterGrowthRateTypes::Register(asIScriptEngine* engine) {
}
void RegisterGrowthRateTypes::RegisterGrowthRateType(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("GrowthRate", 0, asOBJ_REF | asOBJ_NOCOUNT);
assert(r >= 0);
Assert(r >= 0);
r = engine->RegisterObjectMethod("GrowthRate", "uint8 CalculateLevel(uint experience) const",
asMETHOD(CreatureLib::Library::GrowthRate, CalculateLevel), asCALL_THISCALL);
assert(r >= 0);
Assert(r >= 0);
r = engine->RegisterObjectMethod("GrowthRate", "uint CalculateExperience(uint8 level) const",
asMETHOD(CreatureLib::Library::GrowthRate, CalculateExperience), asCALL_THISCALL);
assert(r >= 0);
Assert(r >= 0);
}
static uint8_t CalculateLevel(const CreatureLib::Library::GrowthRateLibrary* obj, const ArbUt::StringView& str,
@ -29,13 +28,13 @@ static uint32_t CalculateExperience(const CreatureLib::Library::GrowthRateLibrar
void RegisterGrowthRateTypes::RegisterGrowthRateLibrary(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("GrowthRateLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
assert(r >= 0);
Assert(r >= 0);
r = engine->RegisterObjectMethod("GrowthRateLibrary",
"uint8 CalculateLevel(const constString &in growthRate, uint experience) const",
asFUNCTION(CalculateLevel), asCALL_CDECL_OBJLAST);
assert(r >= 0);
Assert(r >= 0);
r = engine->RegisterObjectMethod(
"GrowthRateLibrary", "uint CalculateExperience(const constString &in growthRate, uint8 experience) const",
asFUNCTION(CalculateExperience), asCALL_CDECL_OBJLAST);
assert(r >= 0);
Assert(r >= 0);
}

View File

@ -1,5 +1,4 @@
#include "RegisterItemTypes.hpp"
#include <cassert>
#include "../../../../Library/Items/Item.hpp"
#include "../../../../Library/Items/ItemLibrary.hpp"

View File

@ -1,5 +1,4 @@
#include "RegisterSpeciesTypes.hpp"
#include <cassert>
#include "../../../../Library/Species/PokemonSpecies.hpp"
#include "../../../../Library/Species/SpeciesLibrary.hpp"
#include "../../../../Library/Statistic.hpp"

View File

@ -1,5 +1,4 @@
#include "RegisterStaticLibraryTypes.hpp"
#include <cassert>
#include "../../../../Library/PokemonLibrary.hpp"
#include "../HelperFile.hpp"

View File

@ -1,6 +1,5 @@
#include "RegisterTypeLibrary.hpp"
#include <CreatureLib/Library/TypeLibrary.hpp>
#include <cassert>
void RegisterTypeLibrary::Register(asIScriptEngine* engine) { RegisterTypeLibraryType(engine); }
@ -10,13 +9,13 @@ static bool GetTypeId(const CreatureLib::Library::TypeLibrary* obj, const ArbUt:
void RegisterTypeLibrary::RegisterTypeLibraryType(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("TypeLibrary", 0, asOBJ_REF | asOBJ_NOCOUNT);
assert(r >= 0);
Assert(r >= 0);
r = engine->RegisterObjectMethod("TypeLibrary", "uint8 GetTypeId(const constString &in name) const",
asFUNCTION(GetTypeId), asCALL_CDECL_OBJLAST);
assert(r >= 0);
Assert(r >= 0);
r = engine->RegisterObjectMethod(
"TypeLibrary", "float GetSingleEffectiveness(uint8 attacking, uint8 defensive) const",
asMETHOD(CreatureLib::Library::TypeLibrary, GetSingleEffectiveness), asCALL_THISCALL);
assert(r >= 0);
Assert(r >= 0);
// TODO: Register get full effectiveness method.
}