Skip to content

Commit 1c137f9

Browse files
committed
Fix a few Lua 5.3-related errors
Reported on bay12: http://www.bay12forums.com/smf/index.php?topic=164123.msg7821831#msg7821831
1 parent 0983891 commit 1c137f9

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

docs/changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
3939

4040
## Fixes
4141
- `building-hacks`: fixed error when dealing with custom animation tables
42+
- `devel/test-perlin`: fixed Lua error (``math.pow()``)
4243
- `embark-assistant`: fixed crash when entering finder with a 16x16 embark selected, and added 16 to dimension choices
4344
- `prospector`: (also affected `embark-tools`) - fixed a crash when prospecting an unusable site (ocean, mountains, etc.) with a large default embark size in d_init.txt (e.g. 16x16)
45+
- `siege-engine`: fixed a few Lua errors (``math.pow()``, ``unit.relationship_ids``)
4446

4547
## Misc Improvements
4648
- `devel/export-dt-ini`: added viewscreen offsets for DT 40.1.2

plugins/lua/siege-engine.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ function getBaseUnitWeight(unit)
163163
rv = rv * 3
164164
elseif unit.job.destroy_target then
165165
rv = rv * 2
166-
elseif unit.relations.group_leader_id < 0 and not flags1.rider then
166+
elseif unit.relationship_ids.GroupLeader < 0 and not flags1.rider then
167167
rv = rv * 1.5
168168
end
169169

@@ -172,7 +172,7 @@ end
172172

173173
function getUnitWeight(unit)
174174
local base = getBaseUnitWeight(unit)
175-
return base * math.pow(0.7, recent_targets[unit.id] or 0)
175+
return base * (0.7 ^ (recent_targets[unit.id] or 0))
176176
end
177177

178178
function unitWeightCache()
@@ -200,7 +200,7 @@ function scoreTargets(engine, reachable)
200200
computeNearbyWeight(engine, reachable, ucache)
201201

202202
for _,tgt in ipairs(reachable) do
203-
tgt.score = (tgt.score + tgt.nearby_weight*0.7) * math.pow(0.995, tgt.time/3)
203+
tgt.score = (tgt.score + tgt.nearby_weight*0.7) * (0.995 ^ (tgt.time/3))
204204
end
205205

206206
table.sort(reachable, function(a,b)
@@ -309,4 +309,4 @@ function doAimProjectile(engine, item, target_min, target_max, operator, skill)
309309
produceCombatReport(operator, item, nil)
310310
end
311311

312-
return _ENV
312+
return _ENV

0 commit comments

Comments
 (0)