From db452921bafb2dd322b52c1e5d03e5e713849dd0 Mon Sep 17 00:00:00 2001 From: Fedja Beader Date: Sat, 7 Sep 2024 22:55:57 +0000 Subject: 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 --- src/gui/windows/outfitwindow.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/gui') 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 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 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), -- cgit v1.2.3-70-g09d2