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

Method updateStats

src/Battlescape/InventoryState.cpp:301–339  ·  view source on GitHub ↗

* Updates the soldier stats (Weight, TU). */

Source from the content-addressed store, hash-verified

299 * Updates the soldier stats (Weight, TU).
300 */
301void 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.

Callers

nothing calls this directly

Calls 13

getSelectedUnitMethod · 0.80
getTimeUnitsMethod · 0.80
getCarriedWeightMethod · 0.80
getSelectedItemMethod · 0.80
getHealthMethod · 0.80
isResearchedMethod · 0.80
getSavedGameMethod · 0.80
getPsiRequirementsMethod · 0.80
argMethod · 0.60
setTextMethod · 0.45
getStatsMethod · 0.45
setSecondaryColorMethod · 0.45

Tested by

no test coverage detected