* Returns the amount of hangars used up * by crafts in the base. * @return Storage space. */
| 728 | * @return Storage space. |
| 729 | */ |
| 730 | int Base::getUsedHangars() const |
| 731 | { |
| 732 | size_t total = _crafts.size(); |
| 733 | for (std::vector<Transfer*>::const_iterator i = _transfers.begin(); i != _transfers.end(); ++i) |
| 734 | { |
| 735 | if ((*i)->getType() == TRANSFER_CRAFT) |
| 736 | { |
| 737 | total += (*i)->getQuantity(); |
| 738 | } |
| 739 | } |
| 740 | for (std::vector<Production*>::const_iterator i = _productions.begin(); i != _productions.end(); ++i) |
| 741 | { |
| 742 | if ((*i)->getRules()->getCategory() == "STR_CRAFT") |
| 743 | { |
| 744 | // This should be fixed on the case when (*i)->getInfiniteAmount() == TRUE |
| 745 | total += ((*i)->getAmountTotal() - (*i)->getAmountProduced()); |
| 746 | } |
| 747 | } |
| 748 | return total; |
| 749 | } |
| 750 | |
| 751 | /** |
| 752 | * Returns the total amount of hangars |
no test coverage detected