Fix a few Lua 5.3-related errors

Reported on bay12:
http://www.bay12forums.com/smf/index.php?topic=164123.msg7821831#msg7821831
develop
lethosor 2018-08-02 14:36:15 -04:00
parent 0983891089
commit 1c137f9a35
3 changed files with 7 additions and 5 deletions

@ -39,8 +39,10 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes
- `building-hacks`: fixed error when dealing with custom animation tables
- `devel/test-perlin`: fixed Lua error (``math.pow()``)
- `embark-assistant`: fixed crash when entering finder with a 16x16 embark selected, and added 16 to dimension choices
- `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)
- `siege-engine`: fixed a few Lua errors (``math.pow()``, ``unit.relationship_ids``)
## Misc Improvements
- `devel/export-dt-ini`: added viewscreen offsets for DT 40.1.2

@ -163,7 +163,7 @@ function getBaseUnitWeight(unit)
rv = rv * 3
elseif unit.job.destroy_target then
rv = rv * 2
elseif unit.relations.group_leader_id < 0 and not flags1.rider then
elseif unit.relationship_ids.GroupLeader < 0 and not flags1.rider then
rv = rv * 1.5
end
@ -172,7 +172,7 @@ end
function getUnitWeight(unit)
local base = getBaseUnitWeight(unit)
return base * math.pow(0.7, recent_targets[unit.id] or 0)
return base * (0.7 ^ (recent_targets[unit.id] or 0))
end
function unitWeightCache()
@ -200,7 +200,7 @@ function scoreTargets(engine, reachable)
computeNearbyWeight(engine, reachable, ucache)
for _,tgt in ipairs(reachable) do
tgt.score = (tgt.score + tgt.nearby_weight*0.7) * math.pow(0.995, tgt.time/3)
tgt.score = (tgt.score + tgt.nearby_weight*0.7) * (0.995 ^ (tgt.time/3))
end
table.sort(reachable, function(a,b)
@ -309,4 +309,4 @@ function doAimProjectile(engine, item, target_min, target_max, operator, skill)
produceCombatReport(operator, item, nil)
end
return _ENV
return _ENV

@ -1 +1 @@
Subproject commit 66b39d888e5f2d4f5c194ece08ba62ac7f110478
Subproject commit 87cc0fcad57a3a8ff7b558be9f3523101ac2f69d