Made C Interface for BattleLibrary constructor try.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-04-04 13:42:06 +02:00
parent 937071df59
commit 3429f1647c
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 15 additions and 8 deletions

View File

@ -2,13 +2,13 @@
#include "../Core.hpp"
using namespace CreatureLib::Battling;
export const BattleLibrary* CreatureLib_BattleLibrary_Construct(const CreatureLib::Library::DataLibrary* staticLib,
BattleStatCalculator* statCalculator,
DamageLibrary* damageLibrary,
ExperienceLibrary* experienceLibrary,
ScriptResolver* scriptResolver,
MiscLibrary* miscLibrary) {
return new BattleLibrary(staticLib, statCalculator, damageLibrary, experienceLibrary, scriptResolver, miscLibrary);
export uint8_t CreatureLib_BattleLibrary_Construct(const BattleLibrary*& out,
const CreatureLib::Library::DataLibrary* staticLib,
BattleStatCalculator* statCalculator, DamageLibrary* damageLibrary,
ExperienceLibrary* experienceLibrary, ScriptResolver* scriptResolver,
MiscLibrary* miscLibrary) {
Try(out = new BattleLibrary(staticLib, statCalculator, damageLibrary, experienceLibrary, scriptResolver,
miscLibrary);)
}
export void CreatureLib_BattleLibrary_Destruct(const BattleLibrary* p) { delete p; }

View File

@ -6,7 +6,14 @@ BattleLibrary::BattleLibrary(const CreatureLib::Library::DataLibrary* staticLib,
DamageLibrary* damageLibrary, ExperienceLibrary* experienceLibrary,
ScriptResolver* scriptResolver, MiscLibrary* miscLibrary)
: _staticLib(staticLib), _statCalculator(statCalculator), _damageLibrary(damageLibrary),
_experienceLibrary(experienceLibrary), _scriptResolver(scriptResolver), _miscLibrary(miscLibrary) {}
_experienceLibrary(experienceLibrary), _scriptResolver(scriptResolver), _miscLibrary(miscLibrary) {
AssertNotNull(_staticLib);
AssertNotNull(_statCalculator);
AssertNotNull(_damageLibrary);
AssertNotNull(_experienceLibrary);
AssertNotNull(_scriptResolver);
AssertNotNull(_miscLibrary);
}
BattleLibrary::~BattleLibrary() {
delete _staticLib;