* Updates the soldier stats (Weight, TU). */
| 299 | * Updates the soldier stats (Weight, TU). |
| 300 | */ |
| 301 | void InventoryState::updateStats() |
| 302 | { |
| 303 | BattleUnit *unit = _battleGame->getSelectedUnit(); |
| 304 | |
| 305 | _txtTus->setText(tr("STR_TIME_UNITS_SHORT").arg(unit->getTimeUnits())); |
| 306 | |
| 307 | int weight = unit->getCarriedWeight(_inv->getSelectedItem()); |
| 308 | _txtWeight->setText(tr("STR_WEIGHT").arg(weight).arg(unit->getStats()->strength)); |
| 309 | if (weight > unit->getStats()->strength) |
| 310 | { |
| 311 | _txtWeight->setSecondaryColor(Palette::blockOffset(2)); |
| 312 | } |
| 313 | else |
| 314 | { |
| 315 | _txtWeight->setSecondaryColor(Palette::blockOffset(1)); |
| 316 | } |
| 317 | |
| 318 | _txtFAcc->setText(tr("STR_ACCURACY_SHORT").arg((int)(unit->getStats()->firing * unit->getHealth()) / unit->getStats()->health)); |
| 319 | |
| 320 | _txtReact->setText(tr("STR_REACTIONS_SHORT").arg(unit->getStats()->reactions)); |
| 321 | |
| 322 | if (unit->getStats()->psiSkill > 0) |
| 323 | { |
| 324 | _txtPSkill->setText(tr("STR_PSIONIC_SKILL_SHORT").arg(unit->getStats()->psiSkill)); |
| 325 | } |
| 326 | else |
| 327 | { |
| 328 | _txtPSkill->setText(L""); |
| 329 | } |
| 330 | |
| 331 | if (unit->getStats()->psiSkill > 0 || (Options::psiStrengthEval && _game->getSavedGame()->isResearched(_game->getRuleset()->getPsiRequirements()))) |
| 332 | { |
| 333 | _txtPStr->setText(tr("STR_PSIONIC_STRENGTH_SHORT").arg(unit->getStats()->psiStrength)); |
| 334 | } |
| 335 | else |
| 336 | { |
| 337 | _txtPStr->setText(L""); |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | /** |
| 342 | * Saves the soldiers' equipment-layout. |
nothing calls this directly
no test coverage detected