From 81155fd0f427c775c887ed50a642d9912421ad94 Mon Sep 17 00:00:00 2001 From: SMUnlimited Date: Thu, 14 Dec 2023 13:14:12 +0000 Subject: [PATCH] Use mine check to account for taken expansions as well --- Jobs/DETECT_DOUBLE_EXP.eai | 11 ----------- common.eai | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Jobs/DETECT_DOUBLE_EXP.eai b/Jobs/DETECT_DOUBLE_EXP.eai index dabd372c5..b44a5bd7f 100644 --- a/Jobs/DETECT_DOUBLE_EXP.eai +++ b/Jobs/DETECT_DOUBLE_EXP.eai @@ -4,17 +4,6 @@ //============================================================================ // Detect double expansion //============================================================================ -function IsUnitGoldMine takes unit u returns boolean - local integer i = 0 - loop - exitwhen i >= gold_mine_ids_size - if GetUnitTypeId(u) == gold_mines_ids[i] then - return true - endif - set i = i + 1 - endloop - return false -endfunction function GetOtherExpansionNearby takes unit ru, real tx, real ty returns unit local group g = CreateGroup() diff --git a/common.eai b/common.eai index 9b99c3250..9d577f266 100644 --- a/common.eai +++ b/common.eai @@ -5803,6 +5803,19 @@ function MultipleMinefix takes nothing returns boolean return b endfunction +function IsUnitGoldMine takes unit u returns boolean + local integer i = 0 + loop + exitwhen i >= gold_mine_ids_size + if GetUnitTypeId(u) == gold_mines_ids[i] then + return true + endif + set i = i + 1 + endloop + return false +endfunction + + //============================================================================ function CheckExpansionTaken takes unit expa returns boolean local group g = null @@ -5822,7 +5835,7 @@ function CheckExpansionTaken takes unit expa returns boolean loop set u = FirstOfGroup(g) exitwhen u == null - if GetUnitTypeId(u) == old_id[racial_expansion] or IsUnitType(u,UNIT_TYPE_TOWNHALL) then + if GetUnitTypeId(u) == old_id[racial_expansion] or IsUnitGoldMine(u) or IsUnitType(u,UNIT_TYPE_TOWNHALL) then call DestroyGroup(g) set g = null set u = null