Skip to content

Commit

Permalink
Further tweaking to checkingexpansiontaken logic
Browse files Browse the repository at this point in the history
  • Loading branch information
SMUnlimited committed Mar 10, 2024
1 parent 63f8090 commit 53fc37a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Jobs/DETECT_DOUBLE_EXP.eai
Expand Up @@ -48,6 +48,7 @@ function CheckDoubleExpansionsClaimedInArea takes real tx, real ty, boolean isBu
set double_expansion_allyhuman_present = false
set double_own_present = false
call GroupEnumUnitsInRange(g, tx, ty, expansion_taken_radius, null)
set g = SelectUnittype(g, UNIT_TYPE_STRUCTURE, true)
set g = SelectByAlive2(g, true)
loop
set u = FirstOfGroup(g)
Expand Down
6 changes: 3 additions & 3 deletions common.eai
Expand Up @@ -5996,18 +5996,18 @@ function CheckExpansionTaken takes unit expa returns boolean
return true
endif
if IsUnitGoldMine(u) or IsUnitType(u,UNIT_TYPE_TOWNHALL) then
if IsValidMineClaimed(u) then
if IsValidMineClaimed(u) and DistanceBetweenUnits(u, expa) < race_max_expa_mine_distance then
set claimedMines = claimedMines + 1
endif
if not IsUnitType(u, UNIT_TYPE_TOWNHALL) then
set minecount = minecount + 1
set minecount = minecount + 1 // Informative but not used
endif
endif
call GroupRemoveUnit(g, u)
endloop
call DestroyGroup(g)
set g = null
if claimedMines >= minecount then
if claimedMines >= 1 then // While there may be extra mines, we focusing on is this mine taken
return true
else
return false
Expand Down

0 comments on commit 53fc37a

Please sign in to comment.