diff --git a/CInterface/AngelScript/AngelScriptResolver.cpp b/CInterface/AngelScript/AngelScriptResolver.cpp index 105dfc0..caa94e6 100644 --- a/CInterface/AngelScript/AngelScriptResolver.cpp +++ b/CInterface/AngelScript/AngelScriptResolver.cpp @@ -1,56 +1,56 @@ #include "../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp" #include "../Core.hpp" -export AngelScriptResolver* PkmnLib_AngelScriptResolver_Construct() { return new AngelScriptResolver(); } -export uint8_t PkmnLib_AngelScriptResolver_Destruct(AngelScriptResolver* p) { Try(delete p;) } +export_func AngelScriptResolver* PkmnLib_AngelScriptResolver_Construct() { return new AngelScriptResolver(); } +export_func uint8_t PkmnLib_AngelScriptResolver_Destruct(AngelScriptResolver* p) { Try(delete p;) } -export uint8_t PkmnLib_AngelScriptResolver_Initialize(AngelScriptResolver* p, +export_func uint8_t PkmnLib_AngelScriptResolver_Initialize(AngelScriptResolver* p, CreatureLib::Battling::BattleLibrary* lib) { Try(p->Initialize(lib);) } -export uint8_t PkmnLib_AngelScriptResolver_CreateScript(AngelScriptResolver* p, const char* name, const char* script) { +export_func uint8_t PkmnLib_AngelScriptResolver_CreateScript(AngelScriptResolver* p, const char* name, const char* script) { Try(p->CreateScript(name, script);) } -export uint8_t PkmnLib_AngelScriptResolver_FinalizeModule(AngelScriptResolver* p) { Try(p->FinalizeModule();) } -export uint8_t PkmnLib_AngelScriptResolver_LoadScript(CreatureLib::Battling::BattleScript*& out, AngelScriptResolver* p, +export_func uint8_t PkmnLib_AngelScriptResolver_FinalizeModule(AngelScriptResolver* p) { Try(p->FinalizeModule();) } +export_func uint8_t PkmnLib_AngelScriptResolver_LoadScript(CreatureLib::Battling::BattleScript*& out, AngelScriptResolver* p, void* owner, ScriptCategory category, const char* scriptName) { Try(out = p->LoadScript(owner, category, ArbUt::StringView(scriptName));) } -export uint8_t PkmnLib_AngelScriptResolver_LoadEvolutionScript(PkmnLib::Battling::EvolutionScript const*& out, +export_func uint8_t PkmnLib_AngelScriptResolver_LoadEvolutionScript(PkmnLib::Battling::EvolutionScript const*& out, AngelScriptResolver* p, const char* scriptName) { Try( auto s = p->LoadEvolutionScript(ArbUt::StringView(scriptName)); if (!s.HasValue()) { out = nullptr; } else { out = s.GetValue(); }) } -export uint8_t PkmnLib_AngelScriptResolver_WriteByteCodeToFile(AngelScriptResolver* p, const char* file, +export_func uint8_t PkmnLib_AngelScriptResolver_WriteByteCodeToFile(AngelScriptResolver* p, const char* file, bool stripDebugInfo) { Try(p->WriteByteCodeToFile(file, stripDebugInfo);) } -export uint8_t PkmnLib_AngelScriptResolver_LoadByteCodeFromFile(AngelScriptResolver* p, const char* file) { +export_func uint8_t PkmnLib_AngelScriptResolver_LoadByteCodeFromFile(AngelScriptResolver* p, const char* file) { Try(p->LoadByteCodeFromFile(file);) } -export uint8_t PkmnLib_AngelScriptResolver_WriteByteCodeToMemory(AngelScriptResolver* p, bool stripDebugInfo, +export_func uint8_t PkmnLib_AngelScriptResolver_WriteByteCodeToMemory(AngelScriptResolver* p, bool stripDebugInfo, size_t& size, uint8_t*& out) { Try(out = p->WriteByteCodeToMemory(size, stripDebugInfo);) } -export uint8_t PkmnLib_AngelScriptResolver_LoadByteCodeFromMemory(AngelScriptResolver* p, uint8_t* memory, +export_func uint8_t PkmnLib_AngelScriptResolver_LoadByteCodeFromMemory(AngelScriptResolver* p, uint8_t* memory, size_t size) { Try(p->LoadByteCodeFromMemory(memory, size);) } -export uint8_t PkmnLib_AngelScriptResolver_RegisterType(AngelScriptResolver* p, const char* typeName) { +export_func uint8_t PkmnLib_AngelScriptResolver_RegisterType(AngelScriptResolver* p, const char* typeName) { Try(p->RegisterType(typeName);) } -export uint8_t PkmnLib_AngelScriptResolver_RegisterTypeMethod(AngelScriptResolver* p, const char* typeName, +export_func uint8_t PkmnLib_AngelScriptResolver_RegisterTypeMethod(AngelScriptResolver* p, const char* typeName, const char* decl, void*(func)(void*)) { Try(p->RegisterTypeMethod(typeName, decl, func);) } -export uint8_t PkmnLib_AngelScriptResolver_RegisterGlobalMethod(AngelScriptResolver* p, const char* decl, +export_func uint8_t PkmnLib_AngelScriptResolver_RegisterGlobalMethod(AngelScriptResolver* p, const char* decl, void*(func)(void*)) { Try(p->RegisterGlobalMethod(decl, func);) } -export void PkmnLib_AngelScriptResolver_DefineWord(AngelScriptResolver* p, const char* word) { p->DefineWord(word); } +export_func void PkmnLib_AngelScriptResolver_DefineWord(AngelScriptResolver* p, const char* word) { p->DefineWord(word); } #ifdef ANGELSCRIPT_DEBUGGER export void PkmnLib_AngelScriptResolver_AddDebugger(AngelScriptResolver* p, u16 port) { diff --git a/CInterface/AngelScript/AngelscriptScript.cpp b/CInterface/AngelScript/AngelscriptScript.cpp index c40112c..10ac666 100644 --- a/CInterface/AngelScript/AngelscriptScript.cpp +++ b/CInterface/AngelScript/AngelscriptScript.cpp @@ -1,4 +1,4 @@ #include "../../src/ScriptResolving/AngelScript/AngelScriptScript.hpp" #include "../Core.hpp" -export uint8_t PkmnLib_AngelscriptScript_Destruct(AngelScriptScript* p) { Try(delete p;) } \ No newline at end of file +export_func uint8_t PkmnLib_AngelscriptScript_Destruct(AngelScriptScript* p) { Try(delete p;) } \ No newline at end of file diff --git a/CInterface/Battling/Battle.cpp b/CInterface/Battling/Battle.cpp index 5cff2c3..501aafb 100644 --- a/CInterface/Battling/Battle.cpp +++ b/CInterface/Battling/Battle.cpp @@ -2,7 +2,7 @@ #include "../Core.hpp" using namespace PkmnLib::Battling; -export uint8_t PkmnLib_Battle_Construct(Battle*& out, const BattleLibrary* library, +export_func uint8_t PkmnLib_Battle_Construct(Battle*& out, const BattleLibrary* library, CreatureLib::Battling::BattleParty* const* parties, size_t partiesCount, bool canFlee, uint8_t numberOfSides, uint8_t creaturesPerSide, uint_fast32_t randomSeed) { @@ -10,7 +10,7 @@ export uint8_t PkmnLib_Battle_Construct(Battle*& out, const BattleLibrary* libra Try(out = new Battle(library, partiesList, canFlee, numberOfSides, creaturesPerSide, randomSeed)); } -export void PkmnLib_Battle_Destruct(Battle* p) { p->~Battle(); } -export uint8_t PkmnLib_Battle_SetWeather(Battle* p, const char* name) { Try(p->SetWeather(ArbUt::StringView(name))); }; -export uint8_t PkmnLib_Battle_ClearWeather(Battle* p) { Try(p->ClearWeather()); }; -export const char* PkmnLib_Battle_GetWeatherName(Battle* p) { return p->GetWeatherName().c_str(); } \ No newline at end of file +export_func void PkmnLib_Battle_Destruct(Battle* p) { p->~Battle(); } +export_func uint8_t PkmnLib_Battle_SetWeather(Battle* p, const char* name) { Try(p->SetWeather(ArbUt::StringView(name))); }; +export_func uint8_t PkmnLib_Battle_ClearWeather(Battle* p) { Try(p->ClearWeather()); }; +export_func const char* PkmnLib_Battle_GetWeatherName(Battle* p) { return p->GetWeatherName().c_str(); } \ No newline at end of file diff --git a/CInterface/Battling/BattleLibrary.cpp b/CInterface/Battling/BattleLibrary.cpp index f3744fd..df4620c 100644 --- a/CInterface/Battling/BattleLibrary.cpp +++ b/CInterface/Battling/BattleLibrary.cpp @@ -2,7 +2,7 @@ #include "../Core.hpp" using namespace PkmnLib::Battling; -export uint8_t PkmnLib_BattleLibrary_Construct(BattleLibrary*& out, PkmnLib::Library::PokemonLibrary* staticLib, +export_func uint8_t PkmnLib_BattleLibrary_Construct(BattleLibrary*& out, PkmnLib::Library::PokemonLibrary* staticLib, StatCalculator* statCalculator, DamageLibrary* damageLibrary, ExperienceLibrary* experienceLibrary, PkmnLib::Battling::ScriptResolver* scriptResolver, @@ -11,7 +11,7 @@ export uint8_t PkmnLib_BattleLibrary_Construct(BattleLibrary*& out, PkmnLib::Lib miscLibrary, captureLibrary)); } -export void PkmnLib_BattleLibrary_Destruct(BattleLibrary* p) { delete p; } +export_func void PkmnLib_BattleLibrary_Destruct(BattleLibrary* p) { delete p; } -export uint8_t PkmnLib_CaptureLibrary_Construct(CaptureLibrary*& out) { Try(out = new CaptureLibrary()); } -export void PkmnLib_CaptureLibrary_Destruct(CaptureLibrary* p) { delete p; } +export_func uint8_t PkmnLib_CaptureLibrary_Construct(CaptureLibrary*& out) { Try(out = new CaptureLibrary()); } +export_func void PkmnLib_CaptureLibrary_Destruct(CaptureLibrary* p) { delete p; } diff --git a/CInterface/Battling/DamageLibrary.cpp b/CInterface/Battling/DamageLibrary.cpp index f1c0a75..7b06fbc 100644 --- a/CInterface/Battling/DamageLibrary.cpp +++ b/CInterface/Battling/DamageLibrary.cpp @@ -2,6 +2,6 @@ #include "../Core.hpp" using namespace PkmnLib::Battling; -export DamageLibrary* PkmnLib_DamageLibrary_Construct() { return new DamageLibrary(); } +export_func DamageLibrary* PkmnLib_DamageLibrary_Construct() { return new DamageLibrary(); } -export void PkmnLib_DamageLibrary_Destruct(DamageLibrary* p) { delete p; } +export_func void PkmnLib_DamageLibrary_Destruct(DamageLibrary* p) { delete p; } diff --git a/CInterface/Battling/EventHooks.cpp b/CInterface/Battling/EventHooks.cpp index c3239ca..b4cc8b5 100644 --- a/CInterface/Battling/EventHooks.cpp +++ b/CInterface/Battling/EventHooks.cpp @@ -3,16 +3,16 @@ #include "../Core.hpp" using namespace PkmnLib::Battling; -export void PkmnLib_WeatherChangeEvent_Destruct(WeatherChangeEvent* p) { delete p; } -export const char* PkmnLib_WeatherChangeEvent_GetWeatherName(WeatherChangeEvent* p) { +export_func void PkmnLib_WeatherChangeEvent_Destruct(WeatherChangeEvent* p) { delete p; } +export_func const char* PkmnLib_WeatherChangeEvent_GetWeatherName(WeatherChangeEvent* p) { return p->GetWeatherName().c_str(); } -export void PkmnLib_CaptureAttemptEvent_Destruct(CaptureAttemptEvent* p) { delete p; } -export const PkmnLib::Battling::Pokemon* PkmnLib_CaptureAttemptEvent_GetPokemon(CaptureAttemptEvent* p) { +export_func void PkmnLib_CaptureAttemptEvent_Destruct(CaptureAttemptEvent* p) { delete p; } +export_func const PkmnLib::Battling::Pokemon* PkmnLib_CaptureAttemptEvent_GetPokemon(CaptureAttemptEvent* p) { return p->GetPokemon(); } -export const PkmnLib::Battling::CaptureLibrary::CaptureResult +export_func const PkmnLib::Battling::CaptureLibrary::CaptureResult PkmnLib_CaptureAttemptEvent_GetResult(CaptureAttemptEvent* p) { return p->GetResult(); } \ No newline at end of file diff --git a/CInterface/Battling/ExperienceLibrary.cpp b/CInterface/Battling/ExperienceLibrary.cpp index f0382a2..9d9f95e 100644 --- a/CInterface/Battling/ExperienceLibrary.cpp +++ b/CInterface/Battling/ExperienceLibrary.cpp @@ -2,9 +2,9 @@ #include "../Core.hpp" using namespace PkmnLib::Battling; -export ExperienceLibrary* PkmnLib_ExperienceLibrary_Construct() { return new ExperienceLibrary(); } +export_func ExperienceLibrary* PkmnLib_ExperienceLibrary_Construct() { return new ExperienceLibrary(); } -export uint8_t PkmnLib_ExperienceLibrary_HandleExperienceGain(ExperienceLibrary* p, +export_func uint8_t PkmnLib_ExperienceLibrary_HandleExperienceGain(ExperienceLibrary* p, CreatureLib::Battling::Creature* faintedMon, CreatureLib::Battling::Creature* const* opponents, size_t numberOfOpponents) { @@ -12,4 +12,4 @@ export uint8_t PkmnLib_ExperienceLibrary_HandleExperienceGain(ExperienceLibrary* opponents, opponents + numberOfOpponents));) } -export void PkmnLib_ExperienceLibrary_Destruct(ExperienceLibrary* p) { delete p; } +export_func void PkmnLib_ExperienceLibrary_Destruct(ExperienceLibrary* p) { delete p; } diff --git a/CInterface/Battling/MiscLibrary.cpp b/CInterface/Battling/MiscLibrary.cpp index 9f2e267..0c9c797 100644 --- a/CInterface/Battling/MiscLibrary.cpp +++ b/CInterface/Battling/MiscLibrary.cpp @@ -2,13 +2,13 @@ #include "../Core.hpp" using namespace PkmnLib::Battling; -export MiscLibrary* PkmnLib_MiscLibrary_Construct(PkmnLib::Library::TimeOfDay (*getTime)()) { +export_func MiscLibrary* PkmnLib_MiscLibrary_Construct(PkmnLib::Library::TimeOfDay (*getTime)()) { return new MiscLibrary(getTime); } -export void PkmnLib_MiscLibrary_Destruct(MiscLibrary* p) { delete p; } +export_func void PkmnLib_MiscLibrary_Destruct(MiscLibrary* p) { delete p; } -export u8 PkmnLib_MiscLibrary_CanEvolveFromLevelUp(bool& out, MiscLibrary* p, +export_func u8 PkmnLib_MiscLibrary_CanEvolveFromLevelUp(bool& out, MiscLibrary* p, const PkmnLib::Library::EvolutionData* evoData, const Pokemon* pokemon) { Try(out = p->CanEvolveFromLevelUp(evoData, pokemon)) diff --git a/CInterface/Battling/PkmnScript.cpp b/CInterface/Battling/PkmnScript.cpp index 86646cf..b7de0b2 100644 --- a/CInterface/Battling/PkmnScript.cpp +++ b/CInterface/Battling/PkmnScript.cpp @@ -4,14 +4,14 @@ #include "../Core.hpp" using namespace PkmnLib::Battling; -export uint8_t PkmnLib_PkmnScript_ModifyCriticalStage(PkmnScript* script, +export_func uint8_t PkmnLib_PkmnScript_ModifyCriticalStage(PkmnScript* script, CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target, uint8_t hit, uint8_t* critStage) { Try(script->ModifyCriticalStage(attack, target, hit, critStage);) } -export u8 PkmnLib_EvolutionScript_DoesEvolveFromLevelUp(EvolutionScript* script, +export_func u8 PkmnLib_EvolutionScript_DoesEvolveFromLevelUp(EvolutionScript* script, const PkmnLib::Library::EvolutionData* evoData, const Pokemon* pokemon, bool* out) { Try(script->DoesEvolveFromLevelUp(evoData, pokemon, out)); diff --git a/CInterface/Battling/Pokemon.cpp b/CInterface/Battling/Pokemon.cpp index 2f91f79..1afe981 100644 --- a/CInterface/Battling/Pokemon.cpp +++ b/CInterface/Battling/Pokemon.cpp @@ -2,7 +2,7 @@ #include "../Core.hpp" using namespace PkmnLib::Battling; -export uint8_t +export_func uint8_t PkmnLib_Pokemon_Construct(Pokemon*& out, const BattleLibrary* library, const PkmnLib::Library::PokemonSpecies* species, const PkmnLib::Library::PokemonForme* forme, uint8_t level, uint32_t experience, uint32_t uid, CreatureLib::Library::Gender gender, uint8_t coloring, const PkmnLib::Library::Item* heldItem, @@ -27,37 +27,37 @@ PkmnLib_Pokemon_Construct(Pokemon*& out, const BattleLibrary* library, const Pkm }) }; -export void PkmnLib_Pokemon_Destruct(const Pokemon* p) { delete p; } +export_func void PkmnLib_Pokemon_Destruct(const Pokemon* p) { delete p; } SIMPLE_GET_FUNC(Pokemon, IsShiny, bool) SIMPLE_GET_FUNC(Pokemon, WasCaught, bool) SIMPLE_GET_FUNC_SMART_PTR(Pokemon, GetNature, const PkmnLib::Library::Nature*) -export u8 PkmnLib_Pokemon_GetIndividualValue(const Pokemon* p, CreatureLib::Library::Statistic stat) { +export_func u8 PkmnLib_Pokemon_GetIndividualValue(const Pokemon* p, CreatureLib::Library::Statistic stat) { return p->GetIndividualValue(stat); } -export void PkmnLib_Pokemon_SetIndividualValue(Pokemon* p, CreatureLib::Library::Statistic stat, uint8_t value) { +export_func void PkmnLib_Pokemon_SetIndividualValue(Pokemon* p, CreatureLib::Library::Statistic stat, uint8_t value) { p->SetIndividualValue(stat, value); } -export u8 PkmnLib_Pokemon_GetEffortValue(const Pokemon* p, CreatureLib::Library::Statistic stat) { +export_func u8 PkmnLib_Pokemon_GetEffortValue(const Pokemon* p, CreatureLib::Library::Statistic stat) { return p->GetEffortValue(stat); } -export void PkmnLib_Pokemon_SetEffortValue(Pokemon* p, CreatureLib::Library::Statistic stat, uint8_t value) { +export_func void PkmnLib_Pokemon_SetEffortValue(Pokemon* p, CreatureLib::Library::Statistic stat, uint8_t value) { p->SetEffortValue(stat, value); } SIMPLE_GET_FUNC(Pokemon, GetFriendship, uint8_t) -export void PkmnLib_Pokemon_SetFriendship(Pokemon* p, u8 value) { p->SetFriendship(value); } -export void PkmnLib_Pokemon_ChangeFriendship(Pokemon* p, i8 amount) { p->ChangeFriendship(amount); } +export_func void PkmnLib_Pokemon_SetFriendship(Pokemon* p, u8 value) { p->SetFriendship(value); } +export_func void PkmnLib_Pokemon_ChangeFriendship(Pokemon* p, i8 amount) { p->ChangeFriendship(amount); } SIMPLE_GET_FUNC(Pokemon, IsEgg, bool) -export void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); } +export_func void PkmnLib_Pokemon_SetIsEgg(Pokemon* p, bool value) { p->SetIsEgg(value); } -export u8 PkmnLib_Pokemon_Evolve(Pokemon* p, const PkmnLib::Library::PokemonSpecies* species, +export_func u8 PkmnLib_Pokemon_Evolve(Pokemon* p, const PkmnLib::Library::PokemonSpecies* species, const PkmnLib::Library::PokemonForme* forme) { Try(p->Evolve(species, forme);) } -export u8 PkmnLib_Pokemon_AttemptCapture(Pokemon* p, PkmnLib::Library::Item* non_null catchItem) { +export_func u8 PkmnLib_Pokemon_AttemptCapture(Pokemon* p, PkmnLib::Library::Item* non_null catchItem) { Try(p->AttemptCapture(catchItem);) } \ No newline at end of file diff --git a/CInterface/Battling/StatCalculator.cpp b/CInterface/Battling/StatCalculator.cpp index 5159655..db5251b 100644 --- a/CInterface/Battling/StatCalculator.cpp +++ b/CInterface/Battling/StatCalculator.cpp @@ -2,6 +2,6 @@ #include "../Core.hpp" using namespace PkmnLib::Battling; -export StatCalculator* PkmnLib_StatCalculator_Construct() { return new StatCalculator(); } +export_func StatCalculator* PkmnLib_StatCalculator_Construct() { return new StatCalculator(); } -export void PkmnLib_StatCalculator_Destruct(StatCalculator* p) { delete p; } +export_func void PkmnLib_StatCalculator_Destruct(StatCalculator* p) { delete p; } diff --git a/CInterface/Core.cpp b/CInterface/Core.cpp index d6469f3..438279c 100644 --- a/CInterface/Core.cpp +++ b/CInterface/Core.cpp @@ -3,5 +3,5 @@ std::string ExceptionHandler::_pkmnLibLastException = ""; std::string ExceptionHandler::_pkmnLibLastExceptionStacktrace = "Unset"; -export const char* PkmnLib_C_GetLastException() { return ExceptionHandler::GetLastException(); } -export const char* PkmnLib_C_GetLastExceptionStacktrace() { return ExceptionHandler::GetLastExceptionStacktrace(); } \ No newline at end of file +export_func const char* PkmnLib_C_GetLastException() { return ExceptionHandler::GetLastException(); } +export_func const char* PkmnLib_C_GetLastExceptionStacktrace() { return ExceptionHandler::GetLastExceptionStacktrace(); } \ No newline at end of file diff --git a/CInterface/Core.hpp b/CInterface/Core.hpp index f2a7a40..5b09b44 100644 --- a/CInterface/Core.hpp +++ b/CInterface/Core.hpp @@ -6,7 +6,7 @@ #include #include #include -#define export extern "C" [[maybe_unused]] +#define export_func extern "C" [[maybe_unused]] #define PkmnLibException 4 @@ -46,10 +46,10 @@ public: } #define SIMPLE_GET_FUNC(type, name, returnType) \ - export returnType PkmnLib_##type##_##name(const type* p) { return p->name(); } + export_func returnType PkmnLib_##type##_##name(const type* p) { return p->name(); } #define SIMPLE_GET_FUNC_SMART_PTR(type, name, returnType) \ - export returnType PkmnLib_##type##_##name(const type* p) { return p->name().GetRaw(); } + export_func returnType PkmnLib_##type##_##name(const type* p) { return p->name().GetRaw(); } #define DESTRUCTOR(type) \ - export void PkmnLib_##type##_Destruct(const type* p) { delete p; } + export_func void PkmnLib_##type##_Destruct(const type* p) { delete p; } #endif // PKMNLIB_CORE_HPP diff --git a/CInterface/Library/EvolutionData.cpp b/CInterface/Library/EvolutionData.cpp index 2388c1b..6d47f4c 100644 --- a/CInterface/Library/EvolutionData.cpp +++ b/CInterface/Library/EvolutionData.cpp @@ -2,78 +2,78 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export const EvolutionData* PkmnLib_EvolutionData_CreateLevelEvolution(uint8_t level, const PokemonSpecies* into) { +export_func const EvolutionData* PkmnLib_EvolutionData_CreateLevelEvolution(uint8_t level, const PokemonSpecies* into) { return EvolutionData::CreateLevelEvolution(level, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipEvolution(uint8_t friendship, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipEvolution(uint8_t friendship, const PokemonSpecies* into) { return EvolutionData::CreateFriendshipEvolution(friendship, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipTimeEvolution(uint8_t friendship, TimeOfDay startTime, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateFriendshipTimeEvolution(uint8_t friendship, TimeOfDay startTime, TimeOfDay endTime, const PokemonSpecies* into) { return EvolutionData::CreateFriendshipTimeEvolution(friendship, startTime, endTime, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateKnownMoveEvolution(const MoveData* move, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateKnownMoveEvolution(const MoveData* move, const PokemonSpecies* into) { return EvolutionData::CreateKnownMoveEvolution(move, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateLocationEvolution(const char* location, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateLocationEvolution(const char* location, const PokemonSpecies* into) { return EvolutionData::CreateLocationEvolution(ArbUt::StringView(location), into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateTimeEvolution(TimeOfDay startTime, TimeOfDay endTime, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateTimeEvolution(TimeOfDay startTime, TimeOfDay endTime, const PokemonSpecies* into) { return EvolutionData::CreateTimeEvolution(startTime, endTime, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemEvolution(const Item* item, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemEvolution(const Item* item, const PokemonSpecies* into) { return EvolutionData::CreateHeldItemEvolution(item, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateHeldItemTimeEvolution(const Item* item, TimeOfDay startTime, TimeOfDay endTime, const PokemonSpecies* into) { return EvolutionData::CreateHeldItemTimeEvolution(item, startTime, endTime, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateGenderBasedEvolution(CreatureLib::Library::Gender gender, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateGenderBasedEvolution(CreatureLib::Library::Gender gender, uint8_t level, const PokemonSpecies* into) { return EvolutionData::CreateGenderBasedEvolution(gender, level, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateItemUseEvolution(const Item* item, const PokemonSpecies* into) { +export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseEvolution(const Item* item, const PokemonSpecies* into) { return EvolutionData::CreateItemUseEvolution(item, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateItemUseWithGenderEvolution(const Item* item, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateItemUseWithGenderEvolution(const Item* item, CreatureLib::Library::Gender gender, const PokemonSpecies* into) { return EvolutionData::CreateItemUseWithGenderEvolution(item, gender, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateTradeEvolution(const PokemonSpecies* into) { +export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeEvolution(const PokemonSpecies* into) { return EvolutionData::CreateTradeEvolution(into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateTradeWithItemEvolution(const Item* item, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeWithItemEvolution(const Item* item, const PokemonSpecies* into) { return EvolutionData::CreateTradeWithItemEvolution(item, into); } -export const EvolutionData* PkmnLib_EvolutionData_CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded, +export_func const EvolutionData* PkmnLib_EvolutionData_CreateTradeWithSpeciesEvolution(const PokemonSpecies* traded, const PokemonSpecies* into) { return EvolutionData::CreateTradeWithSpeciesEvolution(traded, into); } -export const EvolutionData* +export_func const EvolutionData* PkmnLib_EvolutionData_CreateCustomEvolution(const CreatureLib::Library::EffectParameter** data, size_t dataLength, const PokemonSpecies* into) { auto list = std::vector(data, data + dataLength); return EvolutionData::CreateCustomEvolution(list, into); } -export EvolutionMethod PkmnLib_EvolutionData_GetMethod(const EvolutionData* data) { return data->GetMethod(); } -export const PokemonSpecies* PkmnLib_EvolutionData_GetNewSpecies(const EvolutionData* data) { +export_func EvolutionMethod PkmnLib_EvolutionData_GetMethod(const EvolutionData* data) { return data->GetMethod(); } +export_func const PokemonSpecies* PkmnLib_EvolutionData_GetNewSpecies(const EvolutionData* data) { return data->GetNewSpecies().GetRaw(); } -export size_t PkmnLib_EvolutionData_GetDataCount(const EvolutionData* data) { return data->GetDataCount(); } -export uint8_t PkmnLib_EvolutionData_GetDataAt(const EvolutionData* data, size_t index, +export_func size_t PkmnLib_EvolutionData_GetDataCount(const EvolutionData* data) { return data->GetDataCount(); } +export_func uint8_t PkmnLib_EvolutionData_GetDataAt(const EvolutionData* data, size_t index, const CreatureLib::Library::EffectParameter*& out) { Try(out = data->GetDataAt(index).GetRaw()); } diff --git a/CInterface/Library/Item.cpp b/CInterface/Library/Item.cpp index ddae6d1..463b6b0 100644 --- a/CInterface/Library/Item.cpp +++ b/CInterface/Library/Item.cpp @@ -3,7 +3,7 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export Item* PkmnLib_Item_Construct(const char* name, CreatureLib::Library::ItemCategory category, +export_func Item* PkmnLib_Item_Construct(const char* name, CreatureLib::Library::ItemCategory category, CreatureLib::Library::BattleItemCategory battleCategory, int32_t price, const char* effectName, CreatureLib::Library::EffectParameter* effectParameters[], size_t effectParameterCount, const char* battleTriggerEffectName, @@ -28,6 +28,6 @@ export Item* PkmnLib_Item_Construct(const char* name, CreatureLib::Library::Item conversedFlags, flingPower); }; -export void PkmnLib_Item_Destruct(const Item* p) { delete p; } +export_func void PkmnLib_Item_Destruct(const Item* p) { delete p; } SIMPLE_GET_FUNC(Item, GetFlingPower, uint8_t) \ No newline at end of file diff --git a/CInterface/Library/LearnableMoves.cpp b/CInterface/Library/LearnableMoves.cpp index c7f15a2..730c46e 100644 --- a/CInterface/Library/LearnableMoves.cpp +++ b/CInterface/Library/LearnableMoves.cpp @@ -2,13 +2,13 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export uint8_t PkmnLib_LearnableMoves_Construct(LearnableMoves*& out, size_t levelAttackCapacity) { +export_func uint8_t PkmnLib_LearnableMoves_Construct(LearnableMoves*& out, size_t levelAttackCapacity) { Try(out = new LearnableMoves(levelAttackCapacity)); } DESTRUCTOR(LearnableMoves) -export void PkmnLib_LearnableMoves_AddEggMove(LearnableMoves* p, MoveData* move) { p->AddEggMove(move); } -export size_t PkmnLib_LearnableMoves_GetEggMovesCount(LearnableMoves* p) { return p->GetEggMoves().Count(); } -export const MoveData* const* PkmnLib_LearnableMoves_GetEggMoves(LearnableMoves* p) { +export_func void PkmnLib_LearnableMoves_AddEggMove(LearnableMoves* p, MoveData* move) { p->AddEggMove(move); } +export_func size_t PkmnLib_LearnableMoves_GetEggMovesCount(LearnableMoves* p) { return p->GetEggMoves().Count(); } +export_func const MoveData* const* PkmnLib_LearnableMoves_GetEggMoves(LearnableMoves* p) { return reinterpret_cast(p->GetEggMoves().RawData()); } \ No newline at end of file diff --git a/CInterface/Library/LibrarySettings.cpp b/CInterface/Library/LibrarySettings.cpp index 9dafa48..c68cc43 100644 --- a/CInterface/Library/LibrarySettings.cpp +++ b/CInterface/Library/LibrarySettings.cpp @@ -2,11 +2,11 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export const LibrarySettings* PkmnLib_LibrarySettings_Construct(uint8_t maximalLevel, uint8_t maximalMoves, +export_func const LibrarySettings* PkmnLib_LibrarySettings_Construct(uint8_t maximalLevel, uint8_t maximalMoves, uint16_t shinyRate) { return new LibrarySettings(maximalLevel, maximalMoves, shinyRate); } -export void PkmnLib_LibrarySettings_Destruct(const LibrarySettings* p) { delete p; } +export_func void PkmnLib_LibrarySettings_Destruct(const LibrarySettings* p) { delete p; } SIMPLE_GET_FUNC(LibrarySettings, GetShinyRate, uint16_t); \ No newline at end of file diff --git a/CInterface/Library/Nature.cpp b/CInterface/Library/Nature.cpp index cd71aca..66c322b 100644 --- a/CInterface/Library/Nature.cpp +++ b/CInterface/Library/Nature.cpp @@ -2,19 +2,19 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export Nature* PkmnLib_Nature_Construct(CreatureLib::Library::Statistic increasedStat, +export_func Nature* PkmnLib_Nature_Construct(CreatureLib::Library::Statistic increasedStat, CreatureLib::Library::Statistic decreasedStat, float increasedModifier, float decreasedModifier) { return new Nature(increasedStat, decreasedStat, increasedModifier, decreasedModifier); } -export void PkmnLib_Nature_Destruct(const Nature* p) { delete p; } +export_func void PkmnLib_Nature_Destruct(const Nature* p) { delete p; } SIMPLE_GET_FUNC(Nature, GetIncreaseModifier, float) SIMPLE_GET_FUNC(Nature, GetDecreaseModifier, float) SIMPLE_GET_FUNC(Nature, GetIncreasedStat, CreatureLib::Library::Statistic) SIMPLE_GET_FUNC(Nature, GetDecreasedStat, CreatureLib::Library::Statistic) -export float PkmnLib_Nature_GetStatModifier(const PkmnLib::Library::Nature* nature, +export_func float PkmnLib_Nature_GetStatModifier(const PkmnLib::Library::Nature* nature, CreatureLib::Library::Statistic stat) { return nature->GetStatModifier(stat); } \ No newline at end of file diff --git a/CInterface/Library/NatureLibrary.cpp b/CInterface/Library/NatureLibrary.cpp index 662174c..00c4cf3 100644 --- a/CInterface/Library/NatureLibrary.cpp +++ b/CInterface/Library/NatureLibrary.cpp @@ -2,27 +2,27 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export NatureLibrary* PkmnLib_NatureLibrary_Construct(size_t initialCapacity) { +export_func NatureLibrary* PkmnLib_NatureLibrary_Construct(size_t initialCapacity) { return new NatureLibrary(initialCapacity); } -export void PkmnLib_NatureLibrary_Destruct(const NatureLibrary* p) { delete p; } +export_func void PkmnLib_NatureLibrary_Destruct(const NatureLibrary* p) { delete p; } -export uint8_t PkmnLib_NatureLibrary_LoadNature(NatureLibrary* p, const char* name, const Nature* nature) { +export_func uint8_t PkmnLib_NatureLibrary_LoadNature(NatureLibrary* p, const char* name, const Nature* nature) { Try(p->LoadNature(ArbUt::StringView(name), nature);) } -export uint8_t PkmnLib_NatureLibrary_GetNatureByName(NatureLibrary* p, const char* name, const Nature*& out) { +export_func uint8_t PkmnLib_NatureLibrary_GetNatureByName(NatureLibrary* p, const char* name, const Nature*& out) { Try(out = p->GetNatureByName(ArbUt::StringView(name)).GetRaw()); } -export uint8_t PkmnLib_NatureLibrary_GetRandomNatureName(NatureLibrary* p, ArbUt::Random* rand, const char*& out) { +export_func uint8_t PkmnLib_NatureLibrary_GetRandomNatureName(NatureLibrary* p, ArbUt::Random* rand, const char*& out) { Try(out = p->GetRandomNatureName(*rand).c_str();) } -export uint8_t PkmnLib_NatureLibrary_GetNatureName(NatureLibrary* p, const Nature* nature, const char*& out) { +export_func uint8_t PkmnLib_NatureLibrary_GetNatureName(NatureLibrary* p, const Nature* nature, const char*& out) { Try(out = p->GetNatureName(nature).c_str()); } SIMPLE_GET_FUNC(NatureLibrary, GetNatureCount, size_t) -export uint8_t PkmnLib_NatureLibrary_GetNatureByIndex(NatureLibrary* p, size_t index, const char*& out) { +export_func uint8_t PkmnLib_NatureLibrary_GetNatureByIndex(NatureLibrary* p, size_t index, const char*& out) { Try(out = p->GetNatureFromIndex(index).c_str();) } \ No newline at end of file diff --git a/CInterface/Library/PokemonForme.cpp b/CInterface/Library/PokemonForme.cpp index 8b11cae..25b383c 100644 --- a/CInterface/Library/PokemonForme.cpp +++ b/CInterface/Library/PokemonForme.cpp @@ -3,7 +3,7 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export PokemonForme* +export_func PokemonForme* PkmnLib_PokemonForme_Construct(const char* name, float height, float weight, uint32_t baseExperience, uint8_t types[], size_t typeLength, uint16_t baseHealth, uint16_t baseAttack, uint16_t baseDefense, uint16_t baseMagicalAttack, uint16_t baseMagicalDefense, uint16_t baseSpeed, diff --git a/CInterface/Library/PokemonLibrary.cpp b/CInterface/Library/PokemonLibrary.cpp index a9c9734..b63168e 100644 --- a/CInterface/Library/PokemonLibrary.cpp +++ b/CInterface/Library/PokemonLibrary.cpp @@ -2,7 +2,7 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export uint8_t PkmnLib_PokemonLibrary_Construct(PokemonLibrary*& out, PkmnLib::Library::LibrarySettings* settings, +export_func uint8_t PkmnLib_PokemonLibrary_Construct(PokemonLibrary*& out, PkmnLib::Library::LibrarySettings* settings, SpeciesLibrary* species, MoveLibrary* moves, ItemLibrary* items, CreatureLib::Library::GrowthRateLibrary* growthRates, CreatureLib::Library::TypeLibrary* typeLibrary, @@ -11,7 +11,7 @@ export uint8_t PkmnLib_PokemonLibrary_Construct(PokemonLibrary*& out, PkmnLib::L Try(out = new PokemonLibrary(settings, species, moves, items, growthRates, typeLibrary, talentLibrary, natures)); } -export void PkmnLib_PokemonLibrary_Destruct(const PokemonLibrary* p) { delete p; } -export const NatureLibrary* PkmnLib_PokemonLibrary_GetNatureLibrary(const PokemonLibrary* p) { +export_func void PkmnLib_PokemonLibrary_Destruct(const PokemonLibrary* p) { delete p; } +export_func const NatureLibrary* PkmnLib_PokemonLibrary_GetNatureLibrary(const PokemonLibrary* p) { return p->GetNatureLibrary().GetRaw(); } \ No newline at end of file diff --git a/CInterface/Library/PokemonSpecies.cpp b/CInterface/Library/PokemonSpecies.cpp index dd991e1..9753c72 100644 --- a/CInterface/Library/PokemonSpecies.cpp +++ b/CInterface/Library/PokemonSpecies.cpp @@ -2,7 +2,7 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint16_t id, const char* name, +export_func uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint16_t id, const char* name, const PokemonForme* defaultForme, float genderRatio, const char* growthRate, uint8_t captureRate, uint8_t baseHappiness, const char* const* eggGroupsRaw, size_t eggGroupsLength, @@ -20,22 +20,22 @@ export uint8_t PkmnLib_PokemonSpecies_Construct(const PokemonSpecies*& out, uint eggGroups, conversedFlags);) } -export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; } +export_func void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; } SIMPLE_GET_FUNC(PokemonSpecies, GetBaseHappiness, uint8_t); -export void PkmnLib_PokemonSpecies_AddEvolution(PokemonSpecies* p, EvolutionData* evo) { p->AddEvolution(evo); } +export_func void PkmnLib_PokemonSpecies_AddEvolution(PokemonSpecies* p, EvolutionData* evo) { p->AddEvolution(evo); } -export size_t PkmnLib_PokemonSpecies_GetEvolutionCount(const PokemonSpecies* p) { return p->GetEvolutions().Count(); } +export_func size_t PkmnLib_PokemonSpecies_GetEvolutionCount(const PokemonSpecies* p) { return p->GetEvolutions().Count(); } -export uint8_t PkmnLib_PokemonSpecies_GetEvolution(const PokemonSpecies* p, size_t index, const EvolutionData*& out) { +export_func uint8_t PkmnLib_PokemonSpecies_GetEvolution(const PokemonSpecies* p, size_t index, const EvolutionData*& out) { Try(out = p->GetEvolutions().At(index).GetRaw()); } -export uint8_t PkmnLib_PokemonSpecies_GetEvolutions(const PokemonSpecies* p, const EvolutionData* const*& out) { +export_func uint8_t PkmnLib_PokemonSpecies_GetEvolutions(const PokemonSpecies* p, const EvolutionData* const*& out) { Try(out = p->GetEvolutions().RawData()); } -export size_t PkmnLib_PokemonSpecies_GetEggGroupCount(const PokemonSpecies* p) { return p->GetEggGroups().Count(); } -export const char* PkmnLib_PokemonSpecies_GetEggGroup(const PokemonSpecies* p, size_t index) { +export_func size_t PkmnLib_PokemonSpecies_GetEggGroupCount(const PokemonSpecies* p) { return p->GetEggGroups().Count(); } +export_func const char* PkmnLib_PokemonSpecies_GetEggGroup(const PokemonSpecies* p, size_t index) { return p->GetEggGroups()[index].c_str(); } \ No newline at end of file diff --git a/CInterface/Library/SpeciesLibrary.cpp b/CInterface/Library/SpeciesLibrary.cpp index 174b256..dde53a4 100644 --- a/CInterface/Library/SpeciesLibrary.cpp +++ b/CInterface/Library/SpeciesLibrary.cpp @@ -2,11 +2,11 @@ #include "../Core.hpp" using namespace PkmnLib::Library; -export const SpeciesLibrary* PkmnLib_SpeciesLibrary_Construct(size_t initialCapacity) { +export_func const SpeciesLibrary* PkmnLib_SpeciesLibrary_Construct(size_t initialCapacity) { return new SpeciesLibrary(initialCapacity); }; -export u8 PkmnLib_SpeciesLibrary_FindPreEvolution(const PokemonSpecies*& out, const SpeciesLibrary* p, +export_func u8 PkmnLib_SpeciesLibrary_FindPreEvolution(const PokemonSpecies*& out, const SpeciesLibrary* p, const PokemonSpecies* species) { Try( auto v = p->FindPreEvolution(species); diff --git a/CMakeLists.txt b/CMakeLists.txt index 361563c..9c3bd16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,12 @@ endif () if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") add_link_options(-fuse-ld=lld) + # Only warn for unknown sanitizers. This error is not major enough to error on. + add_compile_options(-Wno-error=unknown-sanitizers) + # Ignore pedantic nullability extension warning, as we only use this for clang specifically + add_compile_options(-Wno-nullability-extension) + # As far as I can tell this is an invalid pedantic warning since C++ 20. Empty variadic macro arguments is completely legal. + add_compile_options(-Wno-gnu-zero-variadic-macro-arguments) endif () execute_process(COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/include) @@ -159,7 +165,7 @@ endif () file(GLOB_RECURSE CORE_SRC_FILES ${FILE_SOURCE}) add_library(pkmnLib ${LIBTYPE} ${CORE_SRC_FILES}) # Enable all warnings, and make them error when occurring. -target_compile_options(pkmnLib PRIVATE -Wall -Wextra -Werror) +target_compile_options(pkmnLib PRIVATE -Wall -Wextra -Werror -pedantic-errors) target_link_directories(pkmnLib PUBLIC ${Angelscript_BINARY_DIR}) # If interprocedural optimization is available, apply it @@ -218,7 +224,7 @@ if (PKMNLIB_TESTS) file(GLOB_RECURSE TEST_FILES "tests/*.cpp" "tests/*.hpp") add_executable(pkmnLibTests ${TEST_FILES}) # Enable all warnings, and make them error when occurring. - target_compile_options(pkmnLibTests PRIVATE -Wall -Wextra -Werror) + target_compile_options(pkmnLibTests PRIVATE -Wall -Wextra -Werror -pedantic-errors) message(STATUS "${_TESTLINKS}") target_link_libraries(pkmnLibTests PUBLIC ${_TESTLINKS}) diff --git a/src/Battling/Library/MiscLibrary.hpp b/src/Battling/Library/MiscLibrary.hpp index af9d13c..eea75cc 100644 --- a/src/Battling/Library/MiscLibrary.hpp +++ b/src/Battling/Library/MiscLibrary.hpp @@ -14,7 +14,7 @@ namespace PkmnLib::Battling { "struggle"_cnc, 0, PkmnLib::Library::MoveCategory::Physical, 50, 255, 10, CreatureLib::Library::AttackTarget::Any, 0, new CreatureLib::Library::SecondaryEffect(-1, "struggle"_cnc, {}), std::unordered_set()); - ; + std::unique_ptr _struggle = std::make_unique(_struggleData, CreatureLib::Battling::AttackLearnMethod::Unknown); diff --git a/src/ScriptResolving/AngelScript/AngelScriptEvolutionScript.hpp b/src/ScriptResolving/AngelScript/AngelScriptEvolutionScript.hpp index 470b9f7..7d3f963 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptEvolutionScript.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptEvolutionScript.hpp @@ -15,7 +15,7 @@ class AngelScriptEvolutionScript final : public PkmnLib::Battling::EvolutionScri asIScriptFunction* nullable Function = nullptr; }; -#define EVO_SCRIPT_HOOK_FUNCTION(name, decl) FunctionInfo __##name = Initialize(decl); +#define EVO_SCRIPT_HOOK_FUNCTION(name, decl) FunctionInfo __##name = Initialize(decl) FunctionInfo Initialize(const std::string& decl) { auto val = _scriptObject->GetObjectType()->GetMethodByDecl(decl.c_str(), false); diff --git a/src/ScriptResolving/AngelScript/AngelScriptItemUseScript.hpp b/src/ScriptResolving/AngelScript/AngelScriptItemUseScript.hpp index fa756ad..71f30bd 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptItemUseScript.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptItemUseScript.hpp @@ -70,7 +70,7 @@ private: FunctionInfo __GetOwner = InitializeGetOwner(); FunctionInfo __SetOwner = InitializeSetOwner(); -#define ITEM_USE_SCRIPT_HOOK_FUNCTION(name, decl) FunctionInfo __##name = Initialize(decl); +#define ITEM_USE_SCRIPT_HOOK_FUNCTION(name, decl) FunctionInfo __##name = Initialize(decl) ITEM_USE_SCRIPT_HOOK_FUNCTION( OnInitialize, "void OnInitialize(const BattleLibrary@ library, const narray@ parameters)"); diff --git a/src/ScriptResolving/AngelScript/TypeRegistry/ConstString.cpp b/src/ScriptResolving/AngelScript/TypeRegistry/ConstString.cpp index 6edf2b7..8e77609 100644 --- a/src/ScriptResolving/AngelScript/TypeRegistry/ConstString.cpp +++ b/src/ScriptResolving/AngelScript/TypeRegistry/ConstString.cpp @@ -17,7 +17,7 @@ static std::string ImplConstStringStringConv(const ArbUt::StringView& s) { retur void ConstStringRegister::Register(asIScriptEngine* engine) { auto r = engine->RegisterObjectType("constString", sizeof(ArbUt::StringView), - asOBJ_VALUE | asGetTypeTraits()); + asOBJ_VALUE | asGetTypeTraits() | asOBJ_APP_CLASS_ALIGN8); Ensure(r >= 0); r = engine->RegisterObjectBehaviour("constString", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructConstString),