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

Method updateItemStrings

src/Basescape/SellState.cpp:694–734  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

692 * Updates the quantity-strings of the selected item.
693 */
694void SellState::updateItemStrings()
695{
696 std::wostringstream ss, ss2, ss5;
697 ss << _qtys[_sel];
698 _lstItems->setCellText(_sel, 2, ss.str());
699 ss2 << getQuantity() - _qtys[_sel];
700 _lstItems->setCellText(_sel, 1, ss2.str());
701 _txtSales->setText(tr("STR_VALUE_OF_SALES").arg(Text::formatFunding(_total)));
702
703 if (_qtys[_sel] > 0)
704 {
705 _lstItems->setRowColor(_sel, _color2);
706 }
707 else
708 {
709 _lstItems->setRowColor(_sel, _color);
710 if (_sel > _itemOffset)
711 {
712 RuleItem *rule = _game->getRuleset()->getItem(_items[_sel - _itemOffset]);
713 if (rule->getBattleType() == BT_AMMO || (rule->getBattleType() == BT_NONE && rule->getClipSize() > 0))
714 {
715 _lstItems->setRowColor(_sel, _colorAmmo);
716 }
717 }
718 }
719
720 ss5 << _base->getUsedStores();
721 if (std::abs(_spaceChange) > 0.05)
722 {
723 ss5 << "(";
724 if (_spaceChange > 0.05)
725 ss5 << "+";
726 ss5 << std::fixed << std::setprecision(1) << _spaceChange << ")";
727 }
728 ss5 << ":" << _base->getAvailableStores();
729 _txtSpaceUsed->setText(tr("STR_SPACE_USED").arg(ss5.str()));
730 if (Options::storageLimitsEnforced)
731 {
732 _btnOk->setVisible(!_base->storesOverfull(_spaceChange));
733 }
734}
735
736/**
737 * Gets the Type of the selected item.

Callers

nothing calls this directly

Calls 12

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

Tested by

no test coverage detected