Rework for C Interfaces to handle exceptions a bit better.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-25 19:07:36 +01:00
parent 27288563cd
commit 7ce3e6940d
53 changed files with 7526 additions and 8340 deletions

View File

@@ -32,21 +32,21 @@ namespace CreatureLib::Battling {
AssertNotNull(attack)
ResolveScript();
}
AttackTurnChoice(Creature* user, LearnedAttack* attack, const CreatureIndex& target, Script* script)
AttackTurnChoice(Creature* user, LearnedAttack* attack, const CreatureIndex& target, Script* script) noexcept
: BaseTurnChoice(user), _attack(attack), _target(target), _attackScript(script) {}
inline LearnedAttack* GetAttack() const { return _attack; }
inline LearnedAttack* GetAttack() const noexcept { return _attack; }
TurnChoiceKind GetKind() const override { return TurnChoiceKind ::Attack; }
TurnChoiceKind GetKind() const noexcept override { return TurnChoiceKind ::Attack; }
int8_t GetPriority() const {
// HOOK: Change priority
return _attack->GetAttack()->GetPriority();
}
const CreatureIndex& GetTarget() const { return _target; }
const CreatureIndex& GetTarget() const noexcept { return _target; }
Script* GetAttackScript() const { return _attackScript; }
Script* GetAttackScript() const noexcept { return _attackScript; }
protected:
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {

View File

@@ -12,12 +12,12 @@ namespace CreatureLib::Battling {
Creature* _user;
protected:
BaseTurnChoice(Creature* user) : _user(user){};
BaseTurnChoice(Creature* user) noexcept : _user(user){};
public:
virtual ~BaseTurnChoice() = default;
[[nodiscard]] virtual TurnChoiceKind GetKind() const = 0;
[[nodiscard]] inline Creature* GetUser() const { return _user; }
[[nodiscard]] virtual TurnChoiceKind GetKind() const noexcept = 0;
[[nodiscard]] inline Creature* GetUser() const noexcept { return _user; }
};
}

View File

@@ -9,7 +9,7 @@ namespace CreatureLib::Battling {
public:
FleeTurnChoice(Creature* user) : BaseTurnChoice(user) {}
TurnChoiceKind GetKind() const override { return TurnChoiceKind ::Flee; }
TurnChoiceKind GetKind() const noexcept override { return TurnChoiceKind ::Flee; }
protected:
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {

View File

@@ -8,7 +8,7 @@ namespace CreatureLib::Battling {
public:
PassTurnChoice(Creature* c) : BaseTurnChoice(c) {}
TurnChoiceKind GetKind() const override { return TurnChoiceKind ::Pass; }
TurnChoiceKind GetKind() const noexcept override { return TurnChoiceKind ::Pass; }
protected:
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {

View File

@@ -7,13 +7,12 @@ namespace CreatureLib::Battling {
Creature* _newCreature;
public:
SwitchTurnChoice(Creature* user, Creature* newCreature) : BaseTurnChoice(user), _newCreature(newCreature) {
AssertNotNull(_newCreature)
}
SwitchTurnChoice(Creature* user, Creature* newCreature) noexcept
: BaseTurnChoice(user), _newCreature(newCreature) {}
TurnChoiceKind GetKind() const final { return TurnChoiceKind::Switch; }
TurnChoiceKind GetKind() const noexcept final { return TurnChoiceKind::Switch; }
inline Creature* GetNewCreature() const { return _newCreature; }
inline Creature* GetNewCreature() const noexcept { return _newCreature; }
protected:
void GetActiveScripts(Arbutils::Collections::List<ScriptWrapper>& scripts) override {