Skip to content

Commit cb3e7d1

Browse files
committed
Fix harrass strength calculation issue #518
1 parent f30e2b4 commit cb3e7d1

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1919
- Fixed some consistency and edge case issues when checking if expansions are claimed. (jzy-chitong56)
2020
- Improvements to the chinese language translations (jzy-chitong56)
2121
- Fixes to random hero mode not being responsive enough in detecting the hero.
22+
- Fixed minor memory leak in harass (jzy-chitong56)
23+
- Fixed mistake in harass strength calculation (jzy-chitong56)
2224
- (DevTools) Strategy Manager will strip whitespace when extracting or importing new strategies and profiles correctly. (jzy-chitong56)
2325

2426
## [3.4.2b] - 2025-04-05

common.eai

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10086,8 +10086,8 @@ endfunction
1008610086
function StartHarass takes integer groupnum, integer harass_target, boolean avoid_towers, real strength_limit, real flee_percent, integer flee_number, real lx, real ly returns nothing
1008710087
local integer i = 0
1008810088
local integer t = 0
10089-
local group harasser = CreateGroup()
10090-
local group g = CreateGroup()
10089+
local group harasser = null
10090+
local group g = null
1009110091
local integer key = groupnum
1009210092
local real strength = 0
1009310093
local integer qty = 0
@@ -10097,6 +10097,9 @@ function StartHarass takes integer groupnum, integer harass_target, boolean avoi
1009710097
// This harass is still running
1009810098
return
1009910099
endif
10100+
10101+
set harasser = CreateGroup()
10102+
set g = CreateGroup()
1010010103

1010110104
call GroupEnumUnitsOfPlayer(g, ai_player, null)
1010210105
set g = SelectByHidden(g, false)
@@ -10154,8 +10157,8 @@ function GetHarassGroupStrength takes integer groupnum returns real
1015410157
local integer t = 0
1015510158
loop
1015610159
exitwhen i >= harass_size[groupnum] or t >= 12
10157-
set id = LoadInteger(harass_groups, groupnum, i)
10158-
set qty = LoadInteger(harass_groups, groupnum, i + 1)
10160+
set qty = LoadInteger(harass_groups, groupnum, i)
10161+
set id = LoadInteger(harass_groups, groupnum, i + 1)
1015910162
set t = t + qty
1016010163
if t + qty > 12 then
1016110164
set qty = 12 - t

0 commit comments

Comments
 (0)