MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / updateItemStrings

Method updateItemStrings

src/Basescape/PurchaseState.cpp:575–607  ·  view source on GitHub ↗

* Updates the quantity-strings of the selected item. */

Source from the content-addressed store, hash-verified

573 * Updates the quantity-strings of the selected item.
574 */
575void PurchaseState::updateItemStrings()
576{
577 _txtPurchases->setText(tr("STR_COST_OF_PURCHASES").arg(Text::formatFunding(_total)));
578 std::wostringstream ss, ss5;
579 ss << _qtys[_sel];
580 _lstItems->setCellText(_sel, 3, ss.str());
581 if (_qtys[_sel] > 0)
582 {
583 _lstItems->setRowColor(_sel, Palette::blockOffset(13));
584 }
585 else
586 {
587 _lstItems->setRowColor(_sel, Palette::blockOffset(13) + 10);
588 if (_sel > _itemOffset)
589 {
590 RuleItem *rule = _game->getRuleset()->getItem(_items[_sel - _itemOffset]);
591 if (rule->getBattleType() == BT_AMMO || (rule->getBattleType() == BT_NONE && rule->getClipSize() > 0))
592 {
593 _lstItems->setRowColor(_sel, Palette::blockOffset(15) + 6);
594 }
595 }
596 }
597 ss5 << _base->getUsedStores();
598 if (std::abs(_iQty) > 0.05)
599 {
600 ss5 << "(";
601 if (_iQty > 0.05)
602 ss5 << "+";
603 ss5 << std::fixed << std::setprecision(1) << _iQty << ")";
604 }
605 ss5 << ":" << _base->getAvailableStores();
606 _txtSpaceUsed->setText(tr("STR_SPACE_USED").arg(ss5.str()));
607}
608
609}

Callers

nothing calls this directly

Calls 10

setCellTextMethod · 0.80
setRowColorMethod · 0.80
getBattleTypeMethod · 0.80
getClipSizeMethod · 0.80
getUsedStoresMethod · 0.80
getAvailableStoresMethod · 0.80
argMethod · 0.60
setTextMethod · 0.45
getItemMethod · 0.45
getRulesetMethod · 0.45

Tested by

no test coverage detected