From 6552aa23ecfc9ea53846efc06a625d46facd1e7f Mon Sep 17 00:00:00 2001 From: Rosalie Wanders Date: Wed, 19 Mar 2025 22:11:49 +0100 Subject: [PATCH] RMG-Core: remove unrequired usage of std::vector::at() --- Source/RMG-Core/Cheats.cpp | 12 ++++++------ Source/RMG-Core/Settings.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/RMG-Core/Cheats.cpp b/Source/RMG-Core/Cheats.cpp index 90abc18c..44d424fc 100644 --- a/Source/RMG-Core/Cheats.cpp +++ b/Source/RMG-Core/Cheats.cpp @@ -188,7 +188,7 @@ static std::string join_split_string(const std::vector& splitStr, c continue; } - element = splitStr.at(i); + element = splitStr[i]; joinedString += element; // when not at the last element, @@ -208,7 +208,7 @@ static bool parse_cheat(const std::vector& lines, int startIndex, C std::string line; for (size_t i = startIndex; i < lines.size(); i++) { - line = lines.at(i); + line = lines[i]; // Parse metadata // $Cheat Name @@ -253,8 +253,8 @@ static bool parse_cheat(const std::vector& lines, int startIndex, C return false; } - std::string address = splitLine.at(0); - std::string value = splitLine.at(1); + std::string address = splitLine[0]; + std::string value = splitLine[1]; if (splitLine.size() == 2 && address.size() == 8 && (value.size() == 4 || value.size() == 9)) { // cheat code @@ -265,7 +265,7 @@ static bool parse_cheat(const std::vector& lines, int startIndex, C // so strip the old value if (value.size() == 9) { - if (value.at(4) == ':') + if (value[4] == ':') { value.erase(4, 5); } @@ -347,7 +347,7 @@ static bool parse_cheat_file(const std::vector& lines, CoreCheatFil for (size_t index = 0; index < lines.size(); index++) { - line = lines.at(index); + line = lines[index]; if (!readHeader && line.starts_with("[") && line.ends_with("]")) { diff --git a/Source/RMG-Core/Settings.cpp b/Source/RMG-Core/Settings.cpp index 1dddf340..0aaec0ee 100644 --- a/Source/RMG-Core/Settings.cpp +++ b/Source/RMG-Core/Settings.cpp @@ -1560,7 +1560,7 @@ static bool int_list_to_string(const std::vector& intList, std::string& str { for (size_t i = 0; i < intList.size(); i++) { - int num = intList.at(i); + int num = intList[i]; string += std::to_string(num); // don't add seperator at end @@ -1604,7 +1604,7 @@ static bool string_list_to_string(const std::vector& stringList, st for (size_t i = 0; i < stringList.size(); i++) { - std::string str = stringList.at(i); + std::string str = stringList[i]; // ensure the string doesn't contain // the separator character