Added lots of security using asserts.
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-03-22 13:42:26 +01:00
parent 970ca8ddd5
commit 899e432271
35 changed files with 138 additions and 56 deletions

View File

@@ -1,6 +1,7 @@
#ifndef CREATURELIB_BATTLESIDE_HPP
#define CREATURELIB_BATTLESIDE_HPP
#include <Arbutils/Assert.hpp>
#include <vector>
#include "../TurnChoices/BaseTurnChoice.hpp"
#include "Creature.hpp"
@@ -19,10 +20,8 @@ namespace CreatureLib::Battling {
public:
explicit BattleSide(uint8_t index, Battle* battle, uint8_t creaturesPerSide)
: _index(index), _creaturesPerSide(creaturesPerSide), _battle(battle) {
_creatures = std::vector<Creature*>(creaturesPerSide);
_choices = std::vector<BaseTurnChoice*>(creaturesPerSide);
_fillableSlots = std::vector<bool>(creaturesPerSide);
: _index(index), _creaturesPerSide(creaturesPerSide), _creatures(creaturesPerSide),
_choices(creaturesPerSide), _fillableSlots(creaturesPerSide), _battle(battle) {
for (size_t i = 0; i < creaturesPerSide; i++) {
_creatures[i] = nullptr;
_choices[i] = nullptr;