summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2014-09-22 13:13:02 +0000
committerpeter1138 <peter1138@openttd.org>2014-09-22 13:13:02 +0000
commitc64586ea44134e966affa5c923dd2d53574f0e8c (patch)
tree26689291cd90f0d542c4a2cd2d1c1f5f66ddf8d3 /src
parent51fe741987da095274cd3782ff62371a1126ddb8 (diff)
downloadopenttd-c64586ea44134e966affa5c923dd2d53574f0e8c.tar.xz
(svn r26907) -Codechange: Scale engine purchase list to GUI zoom level for multihead engines.
Diffstat (limited to 'src')
-rw-r--r--src/train_cmd.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index db4b852b6..73e26a4b1 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -538,10 +538,10 @@ void DrawTrainEngine(int left, int right, int preferred_x, int y, EngineID engin
const Sprite *real_spritef = GetSprite(spritef, ST_NORMAL);
const Sprite *real_spriter = GetSprite(spriter, ST_NORMAL);
- preferred_x = Clamp(preferred_x, left - UnScaleByZoom(real_spritef->x_offs, ZOOM_LVL_GUI) + 14, right - UnScaleByZoom(real_spriter->width, ZOOM_LVL_GUI) - UnScaleByZoom(real_spriter->x_offs, ZOOM_LVL_GUI) - 15);
+ preferred_x = Clamp(preferred_x, left - UnScaleByZoom(real_spritef->x_offs, ZOOM_LVL_GUI) + UnScaleByZoom(14 * 4, ZOOM_LVL_GUI), right - UnScaleByZoom(real_spriter->width, ZOOM_LVL_GUI) - UnScaleByZoom(real_spriter->x_offs, ZOOM_LVL_GUI) - UnScaleByZoom(15 * 4, ZOOM_LVL_GUI));
- DrawSprite(spritef, pal, preferred_x - 14, yf);
- DrawSprite(spriter, pal, preferred_x + 15, yr);
+ DrawSprite(spritef, pal, preferred_x - UnScaleByZoom(14 * 4, ZOOM_LVL_GUI), yf);
+ DrawSprite(spriter, pal, preferred_x + UnScaleByZoom(15 * 4, ZOOM_LVL_GUI), yr);
} else {
SpriteID sprite = GetRailIcon(engine, false, y, image_type);
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
@@ -576,9 +576,9 @@ void GetTrainSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs,
real_sprite = GetSprite(sprite, ST_NORMAL);
/* Calculate values relative to an imaginary center between the two sprites. */
- width = TRAININFO_DEFAULT_VEHICLE_WIDTH + UnScaleByZoom(real_sprite->width, ZOOM_LVL_GUI) + UnScaleByZoom(real_sprite->x_offs, ZOOM_LVL_GUI) - xoffs;
+ width = UnScaleByZoom(TRAININFO_DEFAULT_VEHICLE_WIDTH * 4, ZOOM_LVL_GUI) + UnScaleByZoom(real_sprite->width, ZOOM_LVL_GUI) + UnScaleByZoom(real_sprite->x_offs, ZOOM_LVL_GUI) - xoffs;
height = max<uint>(height, UnScaleByZoom(real_sprite->height, ZOOM_LVL_GUI));
- xoffs = xoffs - TRAININFO_DEFAULT_VEHICLE_WIDTH / 2;
+ xoffs = xoffs - UnScaleByZoom(TRAININFO_DEFAULT_VEHICLE_WIDTH * 4, ZOOM_LVL_GUI) / 2;
yoffs = min(yoffs, UnScaleByZoom(real_sprite->y_offs, ZOOM_LVL_GUI));
}
}