summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2024-09-07 22:55:57 +0000
committerFedja Beader <fedja@protonmail.ch>2024-09-07 22:55:57 +0000
commitdb452921bafb2dd322b52c1e5d03e5e713849dd0 (patch)
treee2493834648b86a21383f40fd464b409ea6f7acc
parent315867beac8c4836e802856d2dae29c5ef58911a (diff)
downloadmv-db452921bafb2dd322b52c1e5d03e5e713849dd0.tar.gz
mv-db452921bafb2dd322b52c1e5d03e5e713849dd0.tar.bz2
mv-db452921bafb2dd322b52c1e5d03e5e713849dd0.tar.xz
mv-db452921bafb2dd322b52c1e5d03e5e713849dd0.zip
There is no need to first pack this into a vector and then into array
TODO: are all these casts actually required? SMH **** mana/plus!101
-rw-r--r--src/gui/windows/outfitwindow.cpp21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index d547e5486..cd015a114 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -151,30 +151,17 @@ void OutfitWindow::load()
std::string buf;
std::stringstream ss(outfit);
- STD_VECTOR<int> tokens;
-
- while (ss >> buf)
- tokens.push_back(atoi(buf.c_str()));
-
- for (size_t i = 0, sz = tokens.size();
- i < sz && i < OUTFIT_ITEM_COUNT; i++)
+ for (size_t i = 0; (ss >> buf) && i < OUTFIT_ITEM_COUNT; i++)
{
- mItems[o][i] = tokens[i];
+ mItems[o][i] = atoi(buf.c_str());
}
outfit = cfg->getValue("OutfitColor" + toString(o), "1");
std::stringstream ss2(outfit);
- tokens.clear();
-
- STD_VECTOR<unsigned char> tokens2;
- while (ss2 >> buf)
- tokens2.push_back(CAST_U8(atoi(buf.c_str())));
-
- for (size_t i = 0, sz = tokens2.size();
- i < sz && i < OUTFIT_ITEM_COUNT; i++)
+ for (size_t i = 0; (ss2 >> buf) && i < OUTFIT_ITEM_COUNT; i++)
{
- mItemColors[o][i] = fromInt(tokens2[i], ItemColor);
+ mItemColors[o][i] = fromInt(CAST_U8(atoi(buf.c_str())), ItemColor);
}
mItemsUnequip[o] = cfg->getValueBool("OutfitUnequip" + toString(o),