Add support for swapping in and out of a party.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
3f447a3e16
commit
8f921ce89b
|
@ -15,6 +15,10 @@ export uint8_t CreatureLib_CreatureParty_GetAtIndex(Creature*& out, const Creatu
|
|||
|
||||
export uint8_t CreatureLib_CreatureParty_Switch(CreatureParty* p, size_t a, size_t b) { Try(p->Switch(a, b);) }
|
||||
|
||||
export Creature* CreatureLib_CreatureParty_SwapInto(CreatureParty* p, size_t index, Creature* creature) {
|
||||
return p->SwapInto(index, creature);
|
||||
}
|
||||
|
||||
export bool CreatureLib_CreatureParty_HasAvailableCreatures(const CreatureParty* p) {
|
||||
return p->HasAvailableCreatures();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,12 @@ namespace CreatureLib::Battling {
|
|||
_party[b] = ca;
|
||||
}
|
||||
|
||||
Creature* SwapInto(size_t index, Creature* creature) {
|
||||
auto p = _party.TakeOwnership(index);
|
||||
_party.Set(index, creature);
|
||||
return p;
|
||||
}
|
||||
|
||||
bool HasAvailableCreatures() const noexcept {
|
||||
for (Creature* c : _party) {
|
||||
if (c == nullptr)
|
||||
|
|
Loading…
Reference in New Issue