Added lots of security using asserts.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -29,6 +29,7 @@ namespace CreatureLib::Battling {
|
||||
public:
|
||||
AttackTurnChoice(Creature* user, LearnedAttack* attack, const CreatureIndex& target)
|
||||
: BaseTurnChoice(user), _attack(attack), _target(target) {
|
||||
AssertNotNull(attack)
|
||||
ResolveScript();
|
||||
}
|
||||
AttackTurnChoice(Creature* user, LearnedAttack* attack, const CreatureIndex& target, Script* script)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef CREATURELIB_BASETURNCHOICE_HPP
|
||||
#define CREATURELIB_BASETURNCHOICE_HPP
|
||||
|
||||
#include <Arbutils/Assert.hpp>
|
||||
#include "../ScriptHandling/ScriptSource.hpp"
|
||||
#include "TurnChoiceKind.hpp"
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ namespace CreatureLib::Battling {
|
||||
Creature* _newCreature;
|
||||
|
||||
public:
|
||||
SwitchTurnChoice(Creature* user, Creature* newCreature) : BaseTurnChoice(user), _newCreature(newCreature) {}
|
||||
SwitchTurnChoice(Creature* user, Creature* newCreature) : BaseTurnChoice(user), _newCreature(newCreature) {
|
||||
AssertNotNull(_newCreature)
|
||||
}
|
||||
|
||||
TurnChoiceKind GetKind() const final { return TurnChoiceKind::Switch; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user