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" #include "../Core.hpp"
using namespace CreatureLib::Battling; using namespace CreatureLib::Battling;
export const BattleLibrary* CreatureLib_BattleLibrary_Construct(const CreatureLib::Library::DataLibrary* staticLib, export uint8_t CreatureLib_BattleLibrary_Construct(const BattleLibrary*& out,
BattleStatCalculator* statCalculator, const CreatureLib::Library::DataLibrary* staticLib,
DamageLibrary* damageLibrary, BattleStatCalculator* statCalculator, DamageLibrary* damageLibrary,
ExperienceLibrary* experienceLibrary, ExperienceLibrary* experienceLibrary, ScriptResolver* scriptResolver,
ScriptResolver* scriptResolver, MiscLibrary* miscLibrary) {
MiscLibrary* miscLibrary) { Try(out = new BattleLibrary(staticLib, statCalculator, damageLibrary, experienceLibrary, scriptResolver,
return new BattleLibrary(staticLib, statCalculator, damageLibrary, experienceLibrary, scriptResolver, miscLibrary); miscLibrary);)
} }
export void CreatureLib_BattleLibrary_Destruct(const BattleLibrary* p) { delete p; } 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, DamageLibrary* damageLibrary, ExperienceLibrary* experienceLibrary,
ScriptResolver* scriptResolver, MiscLibrary* miscLibrary) ScriptResolver* scriptResolver, MiscLibrary* miscLibrary)
: _staticLib(staticLib), _statCalculator(statCalculator), _damageLibrary(damageLibrary), : _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() { BattleLibrary::~BattleLibrary() {
delete _staticLib; delete _staticLib;