* Move all the leftover items in base defense missions to random locations in the storage facilities * @param t the tile where all our goodies are initially stored. */
| 961 | * @param t the tile where all our goodies are initially stored. |
| 962 | */ |
| 963 | void SavedBattleGame::randomizeItemLocations(Tile *t) |
| 964 | { |
| 965 | if (!_storageSpace.empty()) |
| 966 | { |
| 967 | for (std::vector<BattleItem*>::iterator it = t->getInventory()->begin(); it != t->getInventory()->end();) |
| 968 | { |
| 969 | if ((*it)->getSlot()->getId() == "STR_GROUND") |
| 970 | { |
| 971 | getTile(_storageSpace.at(RNG::generate(0, _storageSpace.size() -1)))->addItem(*it, (*it)->getSlot()); |
| 972 | it = t->getInventory()->erase(it); |
| 973 | } |
| 974 | else |
| 975 | { |
| 976 | ++it; |
| 977 | } |
| 978 | } |
| 979 | } |
| 980 | } |
| 981 | /** |
| 982 | * Removes an item from the game. Eg. when ammo item is depleted. |
| 983 | * @param item The Item to remove. |
no test coverage detected