Skip to content

Commit

Permalink
Fix retry failing as temp unit not removed yet #278
Browse files Browse the repository at this point in the history
  • Loading branch information
SMUnlimited committed Mar 10, 2024
1 parent a4ff233 commit 00397f5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Jobs/BUILD_EXPANSION.eai
Expand Up @@ -7,7 +7,9 @@ function BuildExpansionJob takes unit u, unit expansion returns nothing
local unit v = null
local player p = null
local real d = 0
if u == null or UnitAlive(u) == false then
local real x = 0
local real y = 0
if u == null or not UnitAlive(u) then
return
endif
if expansion == null then
Expand Down Expand Up @@ -38,12 +40,14 @@ function BuildExpansionJob takes unit u, unit expansion returns nothing
call CheckDoubleExpansionsClaimedInArea(GetUnitX(expansion), GetUnitY(expansion), true) // Result doesn't matter as long as its only enemies in the proximity
if (not double_own_present and not double_expansion_ally_present and double_expansion_enemy_present and GetLocationNonCreepStrength(GetUnitX(u), GetUnitY(u), race_max_expa_mine_distance) == 0) then
set v = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), old_id[racial_expansion], GetUnitX(expansion), GetUnitY(expansion), 270.0)
if DistanceBetweenPoints_dd(GetUnitLoc(v), GetUnitLoc(expansion)) <= race_max_expa_mine_distance then
call IssuePointOrderById(u, old_id[racial_expansion], GetUnitX(v), GetUnitY(v))
set x = GetUnitX(v)
set y = GetUnitY(v)
call RemoveUnit(v)
if DistanceBetweenPoints_dd(Location(x,y), GetUnitLoc(expansion)) <= race_max_expa_mine_distance then
call IssuePointOrderById(u, old_id[racial_expansion], x, y)
call TQAddUnit2Job(2, BUILD_EXPANSION, 0, u, expansion)
call Trace("Build Expansion JOB Retry Threat")
endif
call RemoveUnit(v)
set v = null
endif
endif
Expand Down

0 comments on commit 00397f5

Please sign in to comment.