From 428483e73d1c4ba33efbb49fa39fac36774d997d Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 16 Feb 2020 17:24:33 +0100 Subject: [PATCH] Make GetRandom in Battle class a pointer. --- src/Battling/Library/MiscLibrary.cpp | 2 +- src/Battling/Models/Battle.cpp | 2 +- src/Battling/Models/Battle.hpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Battling/Library/MiscLibrary.cpp b/src/Battling/Library/MiscLibrary.cpp index 8d2f80d..d6a9c69 100644 --- a/src/Battling/Library/MiscLibrary.cpp +++ b/src/Battling/Library/MiscLibrary.cpp @@ -5,6 +5,6 @@ bool CreatureLib::Battling::MiscLibrary::IsCritical(CreatureLib::Battling::Execu CreatureLib::Battling::Creature* target, uint8_t hit) const { auto rand = target->GetBattle()->GetRandom(); // HOOK: Increase chance for critical hits. - return rand.Get(10) <= 0; + return rand->Get(10) <= 0; } bool CreatureLib::Battling::MiscLibrary::CanFlee(FleeTurnChoice* switchChoice) const { return true; } diff --git a/src/Battling/Models/Battle.cpp b/src/Battling/Models/Battle.cpp index d5d90a5..39fdda6 100644 --- a/src/Battling/Models/Battle.cpp +++ b/src/Battling/Models/Battle.cpp @@ -69,7 +69,7 @@ void Battle::CheckChoicesSetAndRun() { ChoiceQueue* Battle::GetCurrentTurnQueue() const { return _currentTurnQueue; } -BattleRandom& Battle::GetRandom() { return _random; } +BattleRandom* Battle::GetRandom() { return &_random; } bool Battle::CreatureInField(const Creature* creature) const { for (auto s : _sides) { diff --git a/src/Battling/Models/Battle.hpp b/src/Battling/Models/Battle.hpp index 5812c89..1c85a15 100644 --- a/src/Battling/Models/Battle.hpp +++ b/src/Battling/Models/Battle.hpp @@ -56,7 +56,7 @@ namespace CreatureLib::Battling { void CheckChoicesSetAndRun(); [[nodiscard]] ChoiceQueue* GetCurrentTurnQueue() const; - BattleRandom& GetRandom(); + BattleRandom* GetRandom(); bool CreatureInField(const Creature* creature) const;