From c64586ea44134e966affa5c923dd2d53574f0e8c Mon Sep 17 00:00:00 2001 From: peter1138 Date: Mon, 22 Sep 2014 13:13:02 +0000 Subject: [PATCH] (svn r26907) -Codechange: Scale engine purchase list to GUI zoom level for multihead engines. --- src/train_cmd.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index db4b852b6e..73e26a4b18 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(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)); } }