| 313 | } |
| 314 | |
| 315 | void ReserveAllStructures(PlacementReserve &reserve, UnitType type, TilePosition desiredPosition) |
| 316 | { |
| 317 | if ( type.isAddon() ) |
| 318 | return; |
| 319 | reserve.backup(); |
| 320 | |
| 321 | // Reserve space around owned resource depots and resource containers |
| 322 | Unitset myUnits = Broodwar->self()->getUnits(); |
| 323 | myUnits.erase_if( !(Exists && (IsCompleted || (ProducesLarva && IsMorphing)) && IsBuilding && (IsResourceDepot || IsRefinery)) ); |
| 324 | for ( auto &u : myUnits) |
| 325 | ReserveStructure(reserve, u, 2, type, desiredPosition); |
| 326 | |
| 327 | // Reserve space around neutral resources |
| 328 | if ( type != UnitTypes::Terran_Bunker ) |
| 329 | { |
| 330 | Unitset resources = Broodwar->getNeutralUnits(); |
| 331 | resources.erase_if( !(Exists && IsResourceContainer) ); |
| 332 | for ( auto &u : resources) |
| 333 | ReserveStructure(reserve, u, 2, type, desiredPosition); |
| 334 | } |
| 335 | reserve.restoreIfInvalid(__FUNCTION__); |
| 336 | } |
| 337 | |
| 338 | TilePosition gDirections[] = { |
| 339 | TilePosition( 1, 1), |
no test coverage detected