Fixes and tweaks for CreatureParty, added C Interface.
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:
@@ -9,6 +9,7 @@ namespace CreatureLib::Battling {
|
||||
std::vector<Creature*> _party;
|
||||
|
||||
public:
|
||||
CreatureParty(size_t size) : _party(size) {}
|
||||
CreatureParty(std::vector<Creature*> party) : _party(party) {}
|
||||
CreatureParty(std::initializer_list<Creature*> party) : _party(party) {}
|
||||
|
||||
@@ -18,9 +19,9 @@ namespace CreatureLib::Battling {
|
||||
}
|
||||
}
|
||||
|
||||
Creature* GetAtIndex(int index) const { return _party[index]; }
|
||||
Creature* GetAtIndex(size_t index) const { return _party[index]; }
|
||||
|
||||
void Switch(int a, int b) {
|
||||
void Switch(size_t a, size_t b) {
|
||||
auto ca = _party[a];
|
||||
_party[a] = _party[b];
|
||||
_party[b] = ca;
|
||||
@@ -38,6 +39,9 @@ namespace CreatureLib::Battling {
|
||||
}
|
||||
|
||||
std::vector<Creature*>& GetParty() { return _party; }
|
||||
const std::vector<Creature*>& GetParty() const { return _party; }
|
||||
|
||||
size_t GetLength() const { return _party.size(); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user