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

Method getUsedStores

src/Savegame/Base.cpp:561–586  ·  view source on GitHub ↗

* Returns the amount of stores used up by equipment in the base, * and equipment about to arrive. * @return Storage space. */

Source from the content-addressed store, hash-verified

559 * @return Storage space.
560 */
561double Base::getUsedStores()
562{
563 double total = _items->getTotalSize(_rule);
564 for (std::vector<Craft*>::const_iterator i = _crafts.begin(); i != _crafts.end(); ++i)
565 {
566 total += (*i)->getItems()->getTotalSize(_rule);
567 for (std::vector<Vehicle*>::const_iterator j = (*i)->getVehicles()->begin(); j != (*i)->getVehicles()->end(); ++j)
568 {
569 total += (*j)->getRules()->getSize();
570 }
571 }
572 for (std::vector<Transfer*>::const_iterator i = _transfers.begin(); i != _transfers.end(); ++i)
573 {
574 if ((*i)->getType() == TRANSFER_ITEM)
575 {
576 total += (*i)->getQuantity() * _rule->getItem((*i)->getItems())->getSize();
577 }
578 else if ((*i)->getType() == TRANSFER_CRAFT)
579 {
580 Craft *craft = (*i)->getCraft();
581 total += craft->getItems()->getTotalSize(_rule);
582 }
583 }
584 total -= getIgnoredStores();
585 return total;
586}
587
588/**
589 * Checks if the base's stores are overfull.

Callers 8

inUseMethod · 0.80
initMethod · 0.80
SellStateMethod · 0.80
updateItemStringsMethod · 0.80
increaseByValueMethod · 0.80
PurchaseStateMethod · 0.80
increaseByValueMethod · 0.80
updateItemStringsMethod · 0.80

Calls 9

getTotalSizeMethod · 0.80
getItemsMethod · 0.45
getVehiclesMethod · 0.45
getSizeMethod · 0.45
getRulesMethod · 0.45
getTypeMethod · 0.45
getQuantityMethod · 0.45
getItemMethod · 0.45
getCraftMethod · 0.45

Tested by

no test coverage detected