Skip to content

Commit 2f5893b

Browse files
committed
Cleanup, and display cost again
1 parent 862478c commit 2f5893b

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

Source/Menus/BuyMenuGUI.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,19 +2158,11 @@ void BuyMenuGUI::AddObjectsToItemList(std::vector<std::list<Entity*>>& moduleLis
21582158

21592159
void BuyMenuGUI::AddPresetsToItemList() {
21602160
m_SelectedLoadoutIndex = -1;
2161-
2162-
AllegroBitmap* pItemBitmap = 0;
2163-
std::string loadoutLabel;
2164-
float loadoutCost;
2165-
const Actor* pPassenger = 0;
2166-
char costString[256];
21672161

21682162
// Go through all the presets, making intelligible list items from then for the GUI item list
21692163
for (std::vector<Loadout>::iterator lItr = m_Loadouts.begin(); lItr != m_Loadouts.end(); ++lItr) {
2170-
loadoutLabel.clear();
2171-
loadoutCost = 0;
2172-
pItemBitmap = 0;
2173-
pPassenger = 0;
2164+
AllegroBitmap* pItemBitmap = nullptr;
2165+
float loadoutCost = 0;
21742166

21752167
int bitmapHeight = 0;
21762168
int bitmapWidth = 0;
@@ -2220,8 +2212,8 @@ void BuyMenuGUI::AddPresetsToItemList() {
22202212
loadoutCost += sceneObject->GetGoldValue(m_NativeTechModule, m_ForeignCostMult);
22212213
}
22222214

2223-
// Passing in ownership of the bitmap, but not of the pSpriteObj
2224-
m_pShopList->AddItem("", costString, pItemBitmap);
2215+
// Passing in ownership of the bitmap
2216+
m_pShopList->AddItem("", std::to_string(loadoutCost), pItemBitmap, 0);
22252217
}
22262218
}
22272219

0 commit comments

Comments
 (0)