From 99e1a1e036a06e998b7c99c32eb8d2fde4a334ae Mon Sep 17 00:00:00 2001 From: Anthony Stewart Date: Sun, 23 Mar 2025 13:31:06 -0500 Subject: [PATCH] Updated GetSmallKeyCount to return int8_t. --- soh/soh/Enhancements/randomizer/logic.cpp | 8 ++++---- soh/soh/Enhancements/randomizer/logic.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/logic.cpp b/soh/soh/Enhancements/randomizer/logic.cpp index b45dc0418..382da787b 100644 --- a/soh/soh/Enhancements/randomizer/logic.cpp +++ b/soh/soh/Enhancements/randomizer/logic.cpp @@ -2171,7 +2171,7 @@ namespace Rando { return dungeonSmallKeyDoors[key]; } - uint8_t GetUsedSmallKeyCount(SceneID sceneId) { + int8_t GetUsedSmallKeyCount(SceneID sceneId) { const auto& smallKeyDoors = GetDungeonSmallKeyDoors(sceneId); // Get the swch value for the scene @@ -2183,7 +2183,7 @@ namespace Rando { } // Count the number of small keys doors unlocked - uint8_t unlockedSmallKeyDoors = 0; + int8_t unlockedSmallKeyDoors = 0; for (auto& smallKeyDoor : smallKeyDoors) { unlockedSmallKeyDoors += swch >> smallKeyDoor & 1; } @@ -2191,11 +2191,11 @@ namespace Rando { return unlockedSmallKeyDoors; } - uint8_t Logic::GetSmallKeyCount(uint32_t dungeonIndex) { + int8_t Logic::GetSmallKeyCount(uint32_t dungeonIndex) { return mSaveContext->inventory.dungeonKeys[dungeonIndex] + GetUsedSmallKeyCount(SceneID(dungeonIndex)); } - void Logic::SetSmallKeyCount(uint32_t dungeonIndex, uint8_t count) { + void Logic::SetSmallKeyCount(uint32_t dungeonIndex, int8_t count) { mSaveContext->inventory.dungeonKeys[dungeonIndex] = count; } diff --git a/soh/soh/Enhancements/randomizer/logic.h b/soh/soh/Enhancements/randomizer/logic.h index d8fa9864b..6c94ae62e 100644 --- a/soh/soh/Enhancements/randomizer/logic.h +++ b/soh/soh/Enhancements/randomizer/logic.h @@ -260,8 +260,8 @@ class Logic { bool CheckEquipment(uint32_t item); bool CheckQuestItem(uint32_t item); void SetQuestItem(uint32_t item, bool state); - uint8_t GetSmallKeyCount(uint32_t dungeonIndex); - void SetSmallKeyCount(uint32_t dungeonIndex, uint8_t count); + int8_t GetSmallKeyCount(uint32_t dungeonIndex); + void SetSmallKeyCount(uint32_t dungeonIndex, int8_t count); bool CheckDungeonItem(uint32_t item, uint32_t dungeonIndex); void SetDungeonItem(uint32_t item, uint32_t dungeonIndex, bool state); bool CheckRandoInf(uint32_t flag);