Skip to content

Commit

Permalink
Use mine check to account for taken expansions as well
Browse files Browse the repository at this point in the history
  • Loading branch information
SMUnlimited committed Dec 14, 2023
1 parent aa5f1fa commit 81155fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
11 changes: 0 additions & 11 deletions Jobs/DETECT_DOUBLE_EXP.eai
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
15 changes: 14 additions & 1 deletion common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 81155fd

Please sign in to comment.