* Updates the quantity-strings of the selected item. */
| 692 | * Updates the quantity-strings of the selected item. |
| 693 | */ |
| 694 | void 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. |
nothing calls this directly
no test coverage detected