RMG-Core: remove unrequired usage of std::vector<T>::at()

This commit is contained in:
Rosalie Wanders
2025-03-19 22:11:49 +01:00
parent 6d81b8cda3
commit 6552aa23ec
2 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -188,7 +188,7 @@ static std::string join_split_string(const std::vector<std::string>& 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<std::string>& 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<std::string>& 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<std::string>& 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<std::string>& 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("]"))
{
+2 -2
View File
@@ -1560,7 +1560,7 @@ static bool int_list_to_string(const std::vector<int>& 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<std::string>& 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