| 16 | } |
| 17 | |
| 18 | void UnitWrap::RunWorkerController() |
| 19 | { |
| 20 | // Check timer |
| 21 | int timer = pUnit->getClientInfo<int>(UnitInfo::AI_Controller_Timer); |
| 22 | if ( timer ) |
| 23 | { |
| 24 | pUnit->setClientInfo(--timer, UnitInfo::AI_Controller_Timer); |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | // Check for things that need to be repaired |
| 29 | if ( pUnit->getType() == UnitTypes::Terran_SCV && AttendRepair() ) |
| 30 | return; |
| 31 | |
| 32 | // Check if the town is requesting any construction work |
| 33 | if ( AttendTown() ) |
| 34 | return; |
| 35 | |
| 36 | // @TODO |
| 37 | // if ( !town_has_resource_depot ) |
| 38 | // return; |
| 39 | |
| 40 | |
| 41 | /* switch for something (task value?) |
| 42 | Unit gas = nullptr; |
| 43 | Unit mineral = nullptr; |
| 44 | switch ( blah ) |
| 45 | { |
| 46 | case 1: |
| 47 | mineral = pUnit->getTargetResource(); |
| 48 | if ( !mineral || !mineral->getType().isMineralField() ) |
| 49 | { |
| 50 | mineral = town->resource; |
| 51 | if ( !mineral || <resourceBelongsToAI> ) |
| 52 | { |
| 53 | mineral = getNextNearestResource(townCountSomething <= 12, pUnit); |
| 54 | if ( !mineral ) |
| 55 | mineral = town->resource; |
| 56 | } |
| 57 | |
| 58 | gas = GetTownRefinery(town, REFINERY_GOOD, 1); |
| 59 | if ( !gas ) |
| 60 | gas = GetTownRefinery(town, REFINERY_DEPLETED, 1); |
| 61 | } |
| 62 | AI_Harvest(pUnit, mineral, gas); |
| 63 | return; |
| 64 | case 2: |
| 65 | gas = GetTownRefinery(town, REFINERY_GOOD, 1); |
| 66 | break; |
| 67 | case 3: |
| 68 | gas = GetTownRefinery(town, REFINERY_GOOD, 2); |
| 69 | break; |
| 70 | default: |
| 71 | gas = GetTownRefinery(town, REFINERY_GOOD, 3); |
| 72 | break; |
| 73 | } |
| 74 | |
| 75 | if ( !gas ) |
nothing calls this directly
no test coverage detected