From f463ba8496d1965c04cea56c858af83c3db4d9b4 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 5 Jun 2020 14:35:23 +0200 Subject: [PATCH] Simplify check whether mon is on battle field. --- src/Battling/Flow/TurnHandler.cpp | 2 +- src/Battling/Models/Creature.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Battling/Flow/TurnHandler.cpp b/src/Battling/Flow/TurnHandler.cpp index c4b16c9..0266c0f 100644 --- a/src/Battling/Flow/TurnHandler.cpp +++ b/src/Battling/Flow/TurnHandler.cpp @@ -31,7 +31,7 @@ void TurnHandler::ExecuteChoice(ArbUt::BorrowedPtr choice) { auto battle = user->GetBattle(); AssertNotNull(battle) // If the user is not in the field, we don't want to execute its choice. - if (!battle->CreatureInField(user)) { + if (!user->IsOnBattleField()) { return; } // If the choice is not valid, we don't want to execute it. diff --git a/src/Battling/Models/Creature.hpp b/src/Battling/Models/Creature.hpp index 19456d7..b49de6b 100644 --- a/src/Battling/Models/Creature.hpp +++ b/src/Battling/Models/Creature.hpp @@ -102,10 +102,10 @@ namespace CreatureLib::Battling { void SetBattleData(ArbUt::BorrowedPtr battle, ArbUt::BorrowedPtr side); const ArbUt::BorrowedPtr& GetBattle() const; const ArbUt::BorrowedPtr& GetBattleSide() const; - void SetOnBattleField(bool value) { _onBattleField = value; } - bool IsOnBattleField() const { return _onBattleField; } + inline void SetOnBattleField(bool value) { _onBattleField = value; } + inline bool IsOnBattleField() const { return _onBattleField; } - const std::string& GetNickname() const noexcept { return _nickname; } + inline const std::string& GetNickname() const noexcept { return _nickname; } const ArbUt::CaseInsensitiveConstString& GetActiveTalent() const; [[nodiscard]] bool IsFainted() const noexcept;