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

Method getIgnoredStores

src/Savegame/Base.cpp:626–654  ·  view source on GitHub ↗

* Determines space taken up by ammo clips about to rearm craft. * @return Ignored storage space. */

Source from the content-addressed store, hash-verified

624 * @return Ignored storage space.
625 */
626double Base::getIgnoredStores()
627{
628 double space = 0;
629 for (std::vector<Craft*>::iterator c = getCrafts()->begin(); c != getCrafts()->end(); ++c)
630 {
631 if ((*c)->getStatus() == "STR_REARMING")
632 {
633 for (std::vector<CraftWeapon*>::iterator w = (*c)->getWeapons()->begin(); w != (*c)->getWeapons()->end() ; ++w)
634 {
635 if (*w != 0 && (*w)->isRearming())
636 {
637 std::string clip = (*w)->getRules()->getClipItem();
638 int available = getItems()->getItem(clip);
639 if (clip != "" && available > 0)
640 {
641 int clipSize = _rule->getItem(clip)->getClipSize();
642 int needed;
643 if (clipSize > 0)
644 {
645 needed = ((*w)->getRules()->getAmmoMax() - (*w)->getAmmo()) / clipSize;
646 }
647 space += std::min(available, needed) * _rule->getItem(clip)->getSize();
648 }
649 }
650 }
651 }
652 }
653 return space;
654}
655
656/**
657 * Returns the amount of laboratories used up

Callers

nothing calls this directly

Calls 10

isRearmingMethod · 0.80
getClipItemMethod · 0.80
getClipSizeMethod · 0.80
getAmmoMaxMethod · 0.80
getStatusMethod · 0.45
getWeaponsMethod · 0.45
getRulesMethod · 0.45
getItemMethod · 0.45
getAmmoMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected