Fixes and tweaks for CreatureParty, added C Interface.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-08 13:53:58 +01:00
parent 1d18066bcc
commit bbe99da0f0
2 changed files with 30 additions and 2 deletions

View File

@@ -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(); }
};
}