Fixes for standard library changes
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2022-05-26 10:36:02 +02:00
parent a4ac678154
commit bc975aba53
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
4 changed files with 4 additions and 8 deletions

View File

@ -2,6 +2,7 @@
#define PKMNLIB_MISCLIBRARY_HPP #define PKMNLIB_MISCLIBRARY_HPP
#include <CreatureLib/Battling/Library/MiscLibrary.hpp> #include <CreatureLib/Battling/Library/MiscLibrary.hpp>
#include <functional>
#include "../../Library/Evolutions/EvolutionData.hpp" #include "../../Library/Evolutions/EvolutionData.hpp"
#include "../../Library/Moves/MoveData.hpp" #include "../../Library/Moves/MoveData.hpp"
#include "../Pokemon/LearnedMove.hpp" #include "../Pokemon/LearnedMove.hpp"

View File

@ -87,7 +87,7 @@ void RegisterGetter(asIScriptEngine* engine, const char* asType, const char* asD
} }
#define REGISTER_GETTER(asType, asDef, cType, cFunc) \ #define REGISTER_GETTER(asType, asDef, cType, cFunc) \
RegisterGetter<cType, std::result_of<decltype (&cType::cFunc)(cType)>::type, &cType::cFunc>(engine, asType, asDef); RegisterGetter<cType, decltype(std::declval<cType>().cFunc()), &cType::cFunc>(engine, asType, asDef);
#define REGISTER_EXPLICIT_GETTER(asType, asDef, cType, cFunc, returnType) \ #define REGISTER_EXPLICIT_GETTER(asType, asDef, cType, cFunc, returnType) \
RegisterGetter<cType, returnType, &cType::cFunc>(engine, asType, asDef); RegisterGetter<cType, returnType, &cType::cFunc>(engine, asType, asDef);

View File

@ -19,10 +19,7 @@ wasm_func_t* Species_GetFormeByHash(WebAssemblyScriptResolver* resolver) {
resolver, resolver,
{[](WebAssemblyScriptResolver*, const CreatureSpecies* species, u32 variant) -> const SpeciesVariant* { {[](WebAssemblyScriptResolver*, const CreatureSpecies* species, u32 variant) -> const SpeciesVariant* {
auto opt = species->TryGetVariant(variant); auto opt = species->TryGetVariant(variant);
if (opt.has_value()) { return opt.has_value() ? opt.value() : nullptr;
return opt.value();
}
return nullptr;
}}); }});
} }

View File

@ -211,8 +211,6 @@ private:
#define REGISTER_GETTER(name, cType, cFunc, resolver) \ #define REGISTER_GETTER(name, cType, cFunc, resolver) \
externs.Insert( \ externs.Insert( \
name, \ name, WasmHelpers::RegisterGetter<cType, decltype(std::declval<cType>().cFunc()), &cType::cFunc>(resolver));
WasmHelpers::RegisterGetter<cType, std::result_of<decltype (&cType::cFunc)(cType)>::type, &cType::cFunc>( \
resolver));
#endif // PKMNLIB_HELPERFILE_H #endif // PKMNLIB_HELPERFILE_H