aboutsummaryrefslogtreecommitdiff
path: root/advtrains/trainhud.lua
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2021-12-04 18:51:06 +0100
committerGabriel PĂ©rez-Cerezo <gabriel@gpcf.eu>2021-12-16 22:24:05 +0100
commit5912f778e1e4ed568a0874bc200d71f258624390 (patch)
treed6a8c98f38a872ffefb30bd698c718ce7851eb22 /advtrains/trainhud.lua
parent0b9441c28908f2d878d59cd0c363656115b27837 (diff)
downloadadvtrains-5912f778e1e4ed568a0874bc200d71f258624390.tar.gz
advtrains-5912f778e1e4ed568a0874bc200d71f258624390.tar.bz2
advtrains-5912f778e1e4ed568a0874bc200d71f258624390.zip
Fix speed sign allowing v>max_speed
Diffstat (limited to 'advtrains/trainhud.lua')
0 files changed, 0 insertions, 0 deletions
(i < max_positive) { return i; } else { return i - (max_positive * 2); } } // Modulo of a negative number does not work consistently in C static inline s64 pythonmodulo(s64 i, s16 mod) { if (i >= 0) { return i % mod; } return mod - ((-i) % mod); } s64 Database::getBlockAsInteger(const v3s16 pos) const { return (u64) pos.Z * 0x1000000 + (u64) pos.Y * 0x1000 + (u64) pos.X; } v3s16 Database::getIntegerAsBlock(s64 i) const { v3s16 pos; pos.X = unsigned_to_signed(pythonmodulo(i, 4096), 2048); i = (i - pos.X) / 4096; pos.Y = unsigned_to_signed(pythonmodulo(i, 4096), 2048); i = (i - pos.Y) / 4096; pos.Z = unsigned_to_signed(pythonmodulo(i, 4096), 2048); return pos; }