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 ## Fixes
- `building-hacks`: fixed error when dealing with custom animation tables - `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 - `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) - `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 ## Misc Improvements
- `devel/export-dt-ini`: added viewscreen offsets for DT 40.1.2 - `devel/export-dt-ini`: added viewscreen offsets for DT 40.1.2

@ -163,7 +163,7 @@ function getBaseUnitWeight(unit)
rv = rv * 3 rv = rv * 3
elseif unit.job.destroy_target then elseif unit.job.destroy_target then
rv = rv * 2 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 rv = rv * 1.5
end end
@ -172,7 +172,7 @@ end
function getUnitWeight(unit) function getUnitWeight(unit)
local base = getBaseUnitWeight(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 end
function unitWeightCache() function unitWeightCache()
@ -200,7 +200,7 @@ function scoreTargets(engine, reachable)
computeNearbyWeight(engine, reachable, ucache) computeNearbyWeight(engine, reachable, ucache)
for _,tgt in ipairs(reachable) do 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 end
table.sort(reachable, function(a,b) table.sort(reachable, function(a,b)

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