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

Method getUsedContainment

src/Savegame/Base.cpp:1081–1113  ·  view source on GitHub ↗

* Returns the total amount of used * Containment Space in the base. * @return Containment Lab space. */

Source from the content-addressed store, hash-verified

1079 * @return Containment Lab space.
1080 */
1081int Base::getUsedContainment() const
1082{
1083 int total = 0;
1084 for (std::map<std::string, int>::iterator i = _items->getContents()->begin(); i != _items->getContents()->end(); ++i)
1085 {
1086 if (_rule->getItem((i)->first)->getAlien())
1087 {
1088 total += (i)->second;
1089 }
1090 }
1091 for (std::vector<Transfer*>::const_iterator i = _transfers.begin(); i != _transfers.end(); ++i)
1092 {
1093 if ((*i)->getType() == TRANSFER_ITEM)
1094 {
1095 if(_rule->getItem((*i)->getItems())->getAlien())
1096 {
1097 total += (*i)->getQuantity();
1098 }
1099 }
1100 }
1101 if (Options::storageLimitsEnforced)
1102 {
1103 for (std::vector<ResearchProject*>::const_iterator i = _research.begin(); i != _research.end(); ++i)
1104 {
1105 const RuleResearch *projRules = (*i)->getRules();
1106 if (projRules->needItem() && _rule->getUnit(projRules->getName()))
1107 {
1108 ++total;
1109 }
1110 }
1111 }
1112 return total;
1113}
1114
1115/**
1116 * Returns the total amount of Containment Space

Callers 7

inUseMethod · 0.80
prepareDebriefingMethod · 0.80
recoverItemsMethod · 0.80
initMethod · 0.80
updateStringsMethod · 0.80
increaseByValueMethod · 0.80

Calls 10

getContentsMethod · 0.80
getAlienMethod · 0.80
needItemMethod · 0.80
getItemMethod · 0.45
getTypeMethod · 0.45
getItemsMethod · 0.45
getQuantityMethod · 0.45
getRulesMethod · 0.45
getUnitMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected