summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-05-19 23:52:04 +0000
committertruelight <truelight@openttd.org>2007-05-19 23:52:04 +0000
commit49aa3bedfb1dced207281249da635d28d5f310a3 (patch)
treed468c2b79a9bef97f027aeadc327e65c7fc0ed6e /src/viewport.cpp
parent6954045bb4872b15677562e73d0e028c640ac8a7 (diff)
downloadopenttd-49aa3bedfb1dced207281249da635d28d5f310a3.tar.xz
(svn r9885) -Fix r9846: some last bitshifts with zoom-levels that were forgotten
-Fix r9846: initialize the zoom level for 'screen', as assuming 0 is not correct
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 82a9ebb1b..68b9a947f 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -164,8 +164,8 @@ void AssignWindowViewport(Window *w, int x, int y,
vp->zoom = zoom;
- vp->virtual_width = width << zoom;
- vp->virtual_height = height << zoom;
+ vp->virtual_width = ScaleByZoom(width, zoom);
+ vp->virtual_height = ScaleByZoom(height, zoom);
if (follow_flags & 0x80000000) {
const Vehicle *veh;
@@ -1196,17 +1196,17 @@ static void ViewportDrawStrings(DrawPixelInfo *dpi, const StringSpriteToDraw *ss
zoom = dp.zoom;
dp.zoom = ZOOM_LVL_NORMAL;
- dp.left >>= zoom;
- dp.top >>= zoom;
- dp.width >>= zoom;
- dp.height >>= zoom;
+ dp.left = UnScaleByZoom(dp.left, zoom);
+ dp.top = UnScaleByZoom(dp.top, zoom);
+ dp.width = UnScaleByZoom(dp.width, zoom);
+ dp.height = UnScaleByZoom(dp.height, zoom);
do {
uint16 colour;
if (ss->width != 0) {
- int x = (ss->x >> zoom) - 1;
- int y = (ss->y >> zoom) - 1;
+ int x = UnScaleByZoom(ss->x, zoom) - 1;
+ int y = UnScaleByZoom(ss->y, zoom) - 1;
int bottom = y + 11;
int w = ss->width;
@@ -1239,7 +1239,7 @@ static void ViewportDrawStrings(DrawPixelInfo *dpi, const StringSpriteToDraw *ss
colour = 16;
}
DrawString(
- ss->x >> zoom, (ss->y >> zoom) - (ss->width & 0x8000 ? 2 : 0),
+ UnScaleByZoom(ss->x, zoom), UnScaleByZoom(ss->y, zoom) - (ss->width & 0x8000 ? 2 : 0),
ss->string, colour
);