From cb0f4ffd9798ec194b7718f76f49cf855a46e5bc Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Wed, 7 Sep 2022 21:30:33 -0400 Subject: [PATCH] Prevents leading 0s added to hash from being in file name --- soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index 2f8bfa245..f7efe4633 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -39,11 +39,13 @@ std::string placementtxt; static SpoilerData spoilerData; void GenerateHash() { - while (Settings::hash.length() < 10) { - Settings::hash = "0" + Settings::hash; + std::string hash = Settings::hash; + // adds leading 0s to the hash string if it has less than 10 digits. + while (hash.length() < 10) { + hash = "0" + hash; } for (size_t i = 0, j = 0; i < Settings::hashIconIndexes.size(); i++, j += 2) { - int number = std::stoi(Settings::hash.substr(j, 2)); + int number = std::stoi(hash.substr(j, 2)); Settings::hashIconIndexes[i] = number; }