diff options
author | orwell96 <orwell@bleipb.de> | 2017-10-25 10:51:19 +0200 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2017-10-25 10:51:19 +0200 |
commit | 1f9a9062e022c401826155efd3cd45a479d50c15 (patch) | |
tree | 9b308cac57e0599f9e562ba0d628c0ad7d6c22aa /advtrains/helpers.lua | |
parent | c67770833b772e438f81ac80f10f1c46bbeebcfa (diff) | |
download | advtrains-1f9a9062e022c401826155efd3cd45a479d50c15.tar.gz advtrains-1f9a9062e022c401826155efd3cd45a479d50c15.tar.bz2 advtrains-1f9a9062e022c401826155efd3cd45a479d50c15.zip |
Replace many math.floor(x+0.5) calls (or math.floor calls that should be those) by custom atround() function
Diffstat (limited to 'advtrains/helpers.lua')
-rw-r--r-- | advtrains/helpers.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/advtrains/helpers.lua b/advtrains/helpers.lua index 91c0c1c..d7b977e 100644 --- a/advtrains/helpers.lua +++ b/advtrains/helpers.lua @@ -48,6 +48,10 @@ function advtrains.minN(list, expectstart) return n+1
end
+function atround(number)
+ return math.floor(number+0.5)
+end
+
--vertical_transmit:
--[[
rely1, rely2 tell to which height the connections are pointed to. 1 means it will go up the next node
@@ -80,7 +84,7 @@ function advtrains.conway(midreal, prev, drives_on)--in order prev,mid,return end
--dir2???
local cor2=advtrains.dirCoordSet(mid, middir1)--<<<<
- if math.floor(cor2.x+0.5)==math.floor(prev.x+0.5) and math.floor(cor2.z+0.5)==math.floor(prev.z+0.5) then
+ if atround(cor2.x)==atround(prev.x) and atround(cor2.z)==atround(prev.z) then
next=advtrains.dirCoordSet(mid, middir2)--dir2 wird überprüft, alles gut.
if midrely2>=1 then
next.y=next.y+1
|