Skip to content

Commit

Permalink
Fixed a major lag due to an infinite loop that could occur during the…
Browse files Browse the repository at this point in the history
… heal army routines
  • Loading branch information
SMUnlimited committed Mar 10, 2024
1 parent 20e147f commit 63f8090
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
## Unreleased

### Added
- If human player constructs an expansion where the AI is, allied AI's will immediately give up the expansion location if the player attacks the expansion.
- If non-ai player constructs an expansion where the AI is, allied AI's will immediately give up the expansion location if his expansion is damaged.

### Changed
- Increase creep expansion radius slightly to 1250 from 1000 to better detect creeps that could cause issues.
- Increased expansion taken radius to 1300 from 1000 to more accurately detect additional mines available.

### Fixed
- Some more double expansion minor fixes correcting claim counts being off in some edge cases.
- Double expansion retry for humans, orcs and nightelfs should now be successful.
- Align expansion taken check with the double expansion check which should means AI's will expand when multiple empty mines at one expansion.
- Double expansion retry for humans, orcs and nightelfs should now be more successful.
- Align expansion taken check with the double expansion check which should means AI's will expand when multiple empty mines available at one expansion.
- Fixed a possible lag/crash cause in the heal army routines.
- Fixed an issue where human players were building too many scout towers and not upgrading them.
- Fix human players unable to train seige engines with the barrage upgrade. (jzy-chitong56)
- Some debug cache fixes. (jzy-chitong56)
- Fix exchange behaviour to only include players currently playing. (jzy-chitong56)
Expand Down
12 changes: 4 additions & 8 deletions common.eai
Original file line number Diff line number Diff line change
Expand Up @@ -13033,7 +13033,7 @@ function HealArmy takes nothing returns nothing
local item mh_i = null
local boolean mass_healed = false
local boolean global_heal = false
local integer sleepLength = 10
local integer sleepLength = 2
local real healthTrigger = 0.75
local integer sleepFrequency = 0
loop
Expand Down Expand Up @@ -13082,23 +13082,19 @@ function HealArmy takes nothing returns nothing
call ApplyHealingItem(u, mh_i)
endif
if hs <= healthTrigger then
call Sleep(sleepLength * sleep_multiplier) // Wait some time for item effects to work
else
call Sleep(2 * sleep_multiplier)
set sleepLength = 2
endif
endif
else
call StartEmergencyItem(1, mh_item)
if hs <= healthTrigger then
call Sleep(8*sleep_multiplier) // Wait some time for item to be bought
else
call Sleep(2 * sleep_multiplier)
set sleepLength = 8
endif
endif
else
call Sleep(2 * sleep_multiplier)
endif
set sleepFrequency = sleepFrequency + 1
call Sleep(sleepLength * sleep_multiplier) // Wait some time for item effects to work
endloop
set mh_i = null
set u = null
Expand Down

0 comments on commit 63f8090

Please sign in to comment.