* Returns the total amount of used * Containment Space in the base. * @return Containment Lab space. */
| 1079 | * @return Containment Lab space. |
| 1080 | */ |
| 1081 | int 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 |
no test coverage detected