summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-05-26 15:20:13 +0000
committertruelight <truelight@openttd.org>2007-05-26 15:20:13 +0000
commit0c13d007354c0b8ecf4b14b2c51ffe04157d12f8 (patch)
treee4303d75d2e53aa0a7c785c08e51b5e21e4d0f10
parent235916db4c7933a03eb60e83773000a8337f9597 (diff)
downloadopenttd-0c13d007354c0b8ecf4b14b2c51ffe04157d12f8.tar.xz
(svn r9936) -Fix: (Un)ScaleByZoom missed a minus sign in some cases
-rw-r--r--src/zoom.hpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/zoom.hpp b/src/zoom.hpp
index e5e119452..c80f094bf 100644
--- a/src/zoom.hpp
+++ b/src/zoom.hpp
@@ -37,14 +37,14 @@ static inline int ScaleByZoom(int value, ZoomLevel zoom)
{
if (zoom == ZOOM_LVL_NORMAL) return value;
int izoom = (int)zoom - (int)ZOOM_LVL_NORMAL;
- return (zoom > ZOOM_LVL_NORMAL) ? value << izoom : value >> izoom;
+ return (zoom > ZOOM_LVL_NORMAL) ? value << izoom : value >> -izoom;
}
static inline int UnScaleByZoom(int value, ZoomLevel zoom)
{
if (zoom == ZOOM_LVL_NORMAL) return value;
int izoom = (int)zoom - (int)ZOOM_LVL_NORMAL;
- return (zoom > ZOOM_LVL_NORMAL) ? value >> izoom : value << izoom;
+ return (zoom > ZOOM_LVL_NORMAL) ? value >> izoom : value << -izoom;
}
#endif /* ZOOM_HPP */