Turns PokemonSpecies Construct C interface into Try function

This commit is contained in:
Deukhoofd 2020-05-03 12:46:35 +02:00
parent 91bd7f8670
commit 93983bdf5b
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 9 additions and 10 deletions

View File

@ -2,13 +2,12 @@
#include "../Core.hpp"
using namespace PkmnLib::Library;
export const PokemonSpecies* PkmnLib_PokemonSpecies_Construct(uint16_t id, const char* name,
export 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) {
auto cName = Arbutils::CaseInsensitiveConstString(name);
const char* growthRate, uint8_t captureRate, uint8_t baseHappiness) {
Try(auto cName = Arbutils::CaseInsensitiveConstString(name);
auto cGrowthRate = Arbutils::CaseInsensitiveConstString(growthRate);
return new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness);
out = new PokemonSpecies(id, cName, defaultForme, genderRatio, cGrowthRate, captureRate, baseHappiness);)
}
export void PkmnLib_PokemonSpecies_Destruct(const PokemonSpecies* p) { delete p; }

View File

@ -36,10 +36,10 @@ if (NOT EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
endif()
if (NOT WINDOWS)
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
-s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION})
-s compiler=clang -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -o *:staticC=True)
else()
execute_process(COMMAND conan install ${CMAKE_SOURCE_DIR} --install-folder=${CMAKE_BINARY_DIR} --build outdated
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows)
-s compiler=gcc -s compiler.libcxx=libstdc++11 -s compiler.version=${VERSION} -s os=Windows -o *:staticC=True)
endif()
endif ()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
@ -97,13 +97,13 @@ if (WINDOWS)
endif (WINDOWS)
if (STATICC)
message(STATUS "Linking C library statically")
SET(_LINKS ${_LINKS} -static-libgcc -static-libstdc++)
if (NOT DEFINED CONAN_EXPORTED)
SET(_TESTLINKS ${_TESTLINKS} -static-libgcc -static-libstdc++)
endif()
endif()
target_link_libraries(pkmnLib PUBLIC ${_LINKS})
if (NOT DEFINED CONAN_EXPORTED)