From 00397f5990c57252ef3b727e52ab51c9b7f442d4 Mon Sep 17 00:00:00 2001 From: SMUnlimited Date: Sun, 10 Mar 2024 16:38:47 +0000 Subject: [PATCH] Fix retry failing as temp unit not removed yet #278 --- Jobs/BUILD_EXPANSION.eai | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Jobs/BUILD_EXPANSION.eai b/Jobs/BUILD_EXPANSION.eai index ed607d7f0..601036112 100644 --- a/Jobs/BUILD_EXPANSION.eai +++ b/Jobs/BUILD_EXPANSION.eai @@ -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 @@ -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