When creating a CreatureParty with a size, don't just reserve the space, but append nullptr as well.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-07-26 16:08:41 +02:00
parent 8ba564d4b7
commit a4bb8864a0
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 5 additions and 1 deletions

View File

@ -9,7 +9,11 @@ namespace CreatureLib::Battling {
ArbUt::UniquePtrList<Creature> _party; ArbUt::UniquePtrList<Creature> _party;
public: public:
CreatureParty(size_t size) noexcept : _party(size) {} CreatureParty(size_t size) noexcept : _party(size) {
for (size_t i = 0; i < size; i++) {
_party.Append(nullptr);
}
}
CreatureParty(ArbUt::List<Creature*> party) noexcept : _party(party.GetStdList()) {} CreatureParty(ArbUt::List<Creature*> party) noexcept : _party(party.GetStdList()) {}
CreatureParty(std::initializer_list<Creature*> party) noexcept : _party(party) {} CreatureParty(std::initializer_list<Creature*> party) noexcept : _party(party) {}