Update to newer Arbutils version.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -5,13 +5,13 @@ using namespace CreatureLib::Battling;
|
||||
export uint8_t CreatureLib_Battle_Construct(Battle*& out, const BattleLibrary* library, BattleParty* partyArr[],
|
||||
size_t numberOfParties, bool canFlee, uint8_t numberOfSides,
|
||||
uint8_t creaturesPerSide) {
|
||||
Try(List<BattleParty*> parties(partyArr, partyArr + numberOfParties);
|
||||
Try(ArbUt::List<BattleParty*> parties(partyArr, partyArr + numberOfParties);
|
||||
out = new Battle(library, parties, canFlee, numberOfSides, creaturesPerSide);)
|
||||
}
|
||||
|
||||
export void CreatureLib_Battle_Destruct(const Battle* p) { delete p; }
|
||||
|
||||
export const BattleLibrary* CreatureLib_Battle_GetLibrary(const Battle* p) { return p->GetLibrary(); }
|
||||
export const BattleLibrary* CreatureLib_Battle_GetLibrary(const Battle* p) { return p->GetLibrary().GetRaw(); }
|
||||
export uint8_t CreatureLib_Battle_CanUse(bool& out, Battle* p, const BaseTurnChoice* turnChoice) {
|
||||
Try(out = p->CanUse(turnChoice);)
|
||||
}
|
||||
@@ -49,7 +49,9 @@ export size_t CreatureLib_Battle_GetSidesCount(const Battle* p) { return p->GetS
|
||||
export BattleSide* const* CreatureLib_Battle_GetSides(const Battle* p) { return p->GetSides().RawData(); }
|
||||
|
||||
export size_t CreatureLib_Battle_GetPartiesCount(const Battle* p) { return p->GetParties().Count(); }
|
||||
export BattleParty* const* CreatureLib_Battle_GetParties(const Battle* p) { return p->GetParties().RawData(); }
|
||||
export BattleParty* const* CreatureLib_Battle_GetParties(const Battle* p) {
|
||||
return reinterpret_cast<BattleParty* const*>(p->GetParties().RawData());
|
||||
}
|
||||
|
||||
export Script* CreatureLib_Battle_GetVolatileScript(Battle* p, const char* key) {
|
||||
return p->GetVolatileScript(ConstString::GetHash(key));
|
||||
|
||||
@@ -6,10 +6,9 @@ using namespace CreatureLib::Battling;
|
||||
// side, one after the other.
|
||||
export uint8_t CreatureLib_BattleParty_Construct(BattleParty*& out, CreatureParty* p, uint8_t creatureIndices[],
|
||||
size_t numberOfIndices) {
|
||||
Try(Arbutils::Collections::List<CreatureIndex> indices(numberOfIndices);
|
||||
for (size_t i = 0; i < numberOfIndices; i++) {
|
||||
indices[i] = CreatureIndex(creatureIndices[i * 2], creatureIndices[i * 2 + 1]);
|
||||
} out = new BattleParty(p, indices);)
|
||||
Try(ArbUt::List<CreatureIndex> indices(numberOfIndices); for (size_t i = 0; i < numberOfIndices; i++) {
|
||||
indices[i] = CreatureIndex(creatureIndices[i * 2], creatureIndices[i * 2 + 1]);
|
||||
} out = new BattleParty(p, indices);)
|
||||
}
|
||||
|
||||
export void CreatureLib_BattleParty_Destruct(const BattleParty* p) { delete p; }
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "../../src/Battling/Models/Creature.hpp"
|
||||
#include "../Core.hpp"
|
||||
using namespace CreatureLib::Battling;
|
||||
using ConstString = Arbutils::CaseInsensitiveConstString;
|
||||
|
||||
export uint8_t CreatureLib_Creature_Construct(Creature*& out, const BattleLibrary* library,
|
||||
const CreatureLib::Library::CreatureSpecies* species,
|
||||
@@ -10,11 +9,11 @@ export uint8_t CreatureLib_Creature_Construct(Creature*& out, const BattleLibrar
|
||||
uint8_t coloring, const CreatureLib::Library::Item* heldItem,
|
||||
const char* nickname, bool secretTalent, uint8_t talent,
|
||||
LearnedAttack* attacks[], size_t attacksNum, bool allowedExperienceGain) {
|
||||
Try(auto attacksVec = List<LearnedAttack*>(attacks, attacks + attacksNum);
|
||||
out = new Creature(library, borrowed_ptr<const CreatureLib::Library::CreatureSpecies>(species), variant, level,
|
||||
experience, uid, gender, coloring, borrowed_ptr<const CreatureLib::Library::Item>(heldItem),
|
||||
nickname, CreatureLib::Library::TalentIndex(secretTalent, talent), attacksVec,
|
||||
allowedExperienceGain);)
|
||||
Try(auto attacksVec = ArbUt::List<LearnedAttack*>(attacks, attacks + attacksNum);
|
||||
out = new Creature(library, ArbUt::BorrowedPtr<const CreatureLib::Library::CreatureSpecies>(species), variant,
|
||||
level, experience, uid, gender, coloring,
|
||||
ArbUt::BorrowedPtr<const CreatureLib::Library::Item>(heldItem), nickname,
|
||||
CreatureLib::Library::TalentIndex(secretTalent, talent), attacksVec, allowedExperienceGain);)
|
||||
};
|
||||
|
||||
export void CreatureLib_Creature_Destruct(const Creature* p) { delete p; }
|
||||
@@ -32,16 +31,16 @@ SIMPLE_GET_FUNC(Creature, GetGender, CreatureLib::Library::Gender);
|
||||
SIMPLE_GET_FUNC(Creature, GetColoring, uint8_t);
|
||||
|
||||
export bool CreatureLib_Creature_HasHeldItem(const Creature* p, const char* name) {
|
||||
return p->HasHeldItem(ConstString(name));
|
||||
return p->HasHeldItem(ArbUt::CaseInsensitiveConstString(name));
|
||||
}
|
||||
export bool CreatureLib_Creature_HasHeldItemWithHash(const Creature* p, uint32_t hash) { return p->HasHeldItem(hash); }
|
||||
SIMPLE_GET_FUNC_SMART_PTR(Creature, GetHeldItem, const CreatureLib::Library::Item*);
|
||||
export uint8_t CreatureLib_Creature_SetHeldItem(Creature* p, const char* name) {
|
||||
Try(p->SetHeldItem(ConstString(name));)
|
||||
Try(p->SetHeldItem(ArbUt::CaseInsensitiveConstString(name));)
|
||||
}
|
||||
export uint8_t CreatureLib_Creature_SetHeldItemWithHash(Creature* p, uint32_t hash) { Try(p->SetHeldItem(hash);) }
|
||||
export void CreatureLib_Creature_SetHeldItemFromItem(Creature* p, const CreatureLib::Library::Item* item) {
|
||||
return p->SetHeldItem(borrowed_ptr<const CreatureLib::Library::Item>(item));
|
||||
return p->SetHeldItem(ArbUt::BorrowedPtr<const CreatureLib::Library::Item>(item));
|
||||
}
|
||||
SIMPLE_GET_FUNC(Creature, GetCurrentHealth, uint32_t);
|
||||
SIMPLE_GET_FUNC(Creature, GetBattle, Battle*);
|
||||
@@ -60,33 +59,33 @@ export uint8_t CreatureLib_Creature_Heal(Creature* p, uint32_t health, bool canR
|
||||
Try(p->Heal(health, canRevive);)
|
||||
}
|
||||
export uint8_t CreatureLib_Creature_OverrideActiveTalent(Creature* p, const char* talent) {
|
||||
Try(p->OverrideActiveTalent(ConstString(talent));)
|
||||
Try(p->OverrideActiveTalent(ArbUt::CaseInsensitiveConstString(talent));)
|
||||
}
|
||||
export uint8_t CreatureLib_Creature_AddExperience(Creature* p, uint32_t experience) {
|
||||
Try(p->AddExperience(experience);)
|
||||
}
|
||||
export uint8_t CreatureLib_Creature_ClearVolatileScripts(Creature* p) { Try(p->ClearVolatileScripts();) }
|
||||
export uint8_t CreatureLib_Creature_AddVolatileScriptByName(Creature* p, const char* scriptName) {
|
||||
Try(p->AddVolatileScript(ConstString(scriptName));)
|
||||
Try(p->AddVolatileScript(ArbUt::CaseInsensitiveConstString(scriptName));)
|
||||
}
|
||||
export uint8_t CreatureLib_Creature_AddVolatileScript(Creature* p, Script* script) {
|
||||
Try(p->AddVolatileScript(script);)
|
||||
}
|
||||
export uint8_t CreatureLib_Creature_RemoveVolatileScriptByName(Creature* p, const char* scriptName) {
|
||||
Try(p->RemoveVolatileScript(ConstString(scriptName));)
|
||||
Try(p->RemoveVolatileScript(ArbUt::CaseInsensitiveConstString(scriptName));)
|
||||
}
|
||||
export uint8_t CreatureLib_Creature_RemoveVolatileScript(Creature* p, Script* script) {
|
||||
Try(p->RemoveVolatileScript(script);)
|
||||
}
|
||||
export bool CreatureLib_Creature_HasVolatileScript(Creature* p, const char* scriptName) {
|
||||
return p->HasVolatileScript(ConstString(scriptName));
|
||||
return p->HasVolatileScript(ArbUt::CaseInsensitiveConstString(scriptName));
|
||||
}
|
||||
export size_t CreatureLib_Creature_GetAttacksCount(Creature* p) { return p->GetAttacks().Count(); }
|
||||
export LearnedAttack* const* CreatureLib_Creature_GetAttacks(Creature* p) { return p->GetAttacks().RawData(); }
|
||||
SIMPLE_GET_FUNC_SMART_PTR(Creature, GetDisplaySpecies, const CreatureLib::Library::CreatureSpecies*);
|
||||
SIMPLE_GET_FUNC_SMART_PTR(Creature, GetDisplayVariant, const CreatureLib::Library::SpeciesVariant*);
|
||||
export void CreatureLib_Creature_SetDisplaySpecies(Creature* p, const CreatureLib::Library::CreatureSpecies* species) {
|
||||
return p->SetDisplaySpecies(borrowed_ptr<const CreatureLib::Library::CreatureSpecies>(species));
|
||||
return p->SetDisplaySpecies(ArbUt::BorrowedPtr<const CreatureLib::Library::CreatureSpecies>(species));
|
||||
}
|
||||
export void CreatureLib_Creature_SetDisplayVariant(Creature* p, const CreatureLib::Library::SpeciesVariant* variant) {
|
||||
return p->SetDisplayVariant(variant);
|
||||
|
||||
@@ -4,7 +4,7 @@ using namespace CreatureLib::Battling;
|
||||
|
||||
export CreatureParty* CreatureLib_CreatureParty_ConstructWithSize(size_t size) { return new CreatureParty(size); }
|
||||
export CreatureParty* CreatureLib_CreatureParty_ConstructFromArray(Creature* creatures[], size_t size) {
|
||||
return new CreatureParty(Arbutils::Collections::List<Creature*>(creatures, creatures + size));
|
||||
return new CreatureParty(ArbUt::List<Creature*>(creatures, creatures + size));
|
||||
}
|
||||
|
||||
export void CreatureLib_CreatureParty_Destruct(const CreatureParty* p) { delete p; }
|
||||
|
||||
@@ -5,7 +5,7 @@ using namespace CreatureLib::Battling;
|
||||
export uint8_t CreatureLib_ExecutingAttack_Construct(ExecutingAttack*& out, Creature* const* targets,
|
||||
size_t targetCount, uint8_t numberHits, Creature* user,
|
||||
LearnedAttack* attack, Script* script) {
|
||||
Try(auto ls = List<Creature*>(targets, targets + targetCount);
|
||||
Try(auto ls = ArbUt::List<Creature*>(targets, targets + targetCount);
|
||||
out = new ExecutingAttack(ls, numberHits, user, attack, script);)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ using namespace CreatureLib::Battling;
|
||||
|
||||
export uint8_t CreatureLib_LearnedAttack_Construct(LearnedAttack*& out, const CreatureLib::Library::AttackData* attack,
|
||||
uint8_t maxUses, AttackLearnMethod learnMethod) {
|
||||
Try(out = new LearnedAttack(borrowed_ptr<const CreatureLib::Library::AttackData>(attack), maxUses, learnMethod);)
|
||||
Try(out = new LearnedAttack(ArbUt::BorrowedPtr<const CreatureLib::Library::AttackData>(attack), maxUses,
|
||||
learnMethod);)
|
||||
}
|
||||
export void CreatureLib_LearnedAttack_Destruct(LearnedAttack* p) { delete p; }
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ export const char* CreatureLib_Script_GetName(Script* p) { return p->GetName().c
|
||||
export uint8_t CreatureLib_Script_OnBeforeTurn(Script* p, const BaseTurnChoice* choice) {
|
||||
Try(p->OnBeforeTurn(choice));
|
||||
}
|
||||
export uint8_t CreatureLib_Script_ChangeAttack(Script* p, AttackTurnChoice* choice, ConstString* outAttack) {
|
||||
export uint8_t CreatureLib_Script_ChangeAttack(Script* p, AttackTurnChoice* choice,
|
||||
ArbUt::CaseInsensitiveConstString* outAttack) {
|
||||
Try(p->ChangeAttack(choice, outAttack));
|
||||
}
|
||||
export uint8_t CreatureLib_Script_PreventAttack(Script* p, ExecutingAttack* attack, bool* outResult) {
|
||||
|
||||
@@ -11,5 +11,5 @@ export uint8_t CreatureLib_ScriptResolver_Initialize(ScriptResolver* p, BattleLi
|
||||
};
|
||||
export uint8_t CreatureLib_ScriptResolver_LoadScript(Script*& out, ScriptResolver* p, ScriptCategory category,
|
||||
const char* scriptName) {
|
||||
Try(out = p->LoadScript(category, ConstString(scriptName));)
|
||||
Try(out = p->LoadScript(category, ArbUt::CaseInsensitiveConstString(scriptName));)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user