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

Method checkup

src/Savegame/Craft.cpp:656–686  ·  view source on GitHub ↗

* Checks the condition of all the craft's systems * to define its new status (eg. when arriving at base). */

Source from the content-addressed store, hash-verified

654 * to define its new status (eg. when arriving at base).
655 */
656void Craft::checkup()
657{
658 int available = 0, full = 0;
659 for (std::vector<CraftWeapon*>::iterator i = _weapons.begin(); i != _weapons.end(); ++i)
660 {
661 if ((*i) == 0)
662 continue;
663 available++;
664 if ((*i)->getAmmo() >= (*i)->getRules()->getAmmoMax())
665 {
666 full++;
667 }
668 else
669 {
670 (*i)->setRearming(true);
671 }
672 }
673
674 if (_damage > 0)
675 {
676 _status = "STR_REPAIRS";
677 }
678 else if (available != full)
679 {
680 _status = "STR_REARMING";
681 }
682 else
683 {
684 _status = "STR_REFUELLING";
685 }
686}
687
688/**
689 * Returns if a certain target is detected by the craft's

Callers 1

advanceMethod · 0.80

Calls 4

getAmmoMaxMethod · 0.80
setRearmingMethod · 0.80
getAmmoMethod · 0.45
getRulesMethod · 0.45

Tested by

no test coverage detected