MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / updateSelection

Method updateSelection

source/frontend/StarMerchantInterface.cpp:265–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265void MerchantPane::updateSelection() {
266 if (m_selectedIndex != m_itemGuiList->selectedItem()) {
267 m_selectedIndex = m_itemGuiList->selectedItem();
268
269 if (m_selectedIndex != NPos) {
270 auto itemConfig = m_itemList.get(m_selectedIndex);
271 m_selectedItem = Root::singleton().itemDatabase()->itemShared(ItemDescriptor(itemConfig.get("item")));
272 findChild<ButtonWidget>("spinCount.up")->enable();
273 findChild<ButtonWidget>("spinCount.down")->enable();
274 m_countTextBox->setColor(Color::White);
275 m_buyCount = 1;
276 } else {
277 findChild<ButtonWidget>("spinCount.up")->disable();
278 findChild<ButtonWidget>("spinCount.down")->disable();
279 m_countTextBox->setColor(Color::Gray);
280 m_buyCount = 0;
281 }
282
283 countChanged();
284 }
285}
286
287void MerchantPane::updateBuyTotal() {
288 if (auto selected = m_itemGuiList->selectedWidget())

Callers

nothing calls this directly

Calls 9

singletonClass · 0.85
ItemDescriptorClass · 0.85
itemSharedMethod · 0.80
itemDatabaseMethod · 0.80
selectedItemMethod · 0.45
getMethod · 0.45
enableMethod · 0.45
setColorMethod · 0.45
disableMethod · 0.45

Tested by

no test coverage detected