* Determines space taken up by ammo clips about to rearm craft. * @return Ignored storage space. */
| 624 | * @return Ignored storage space. |
| 625 | */ |
| 626 | double 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 |
nothing calls this directly
no test coverage detected