summaryrefslogtreecommitdiff
path: root/src/aircraft_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2015-02-01 20:54:24 +0000
committerfrosch <frosch@openttd.org>2015-02-01 20:54:24 +0000
commita8080b62563dcb9f3e3bf5180ebf2de6cf6b68ae (patch)
tree3ac628ab264823257073f281ce7e692f07e5c651 /src/aircraft_cmd.cpp
parent3bc7ee3ab731c7a855f811b36356ed907b42989a (diff)
downloadopenttd-a8080b62563dcb9f3e3bf5180ebf2de6cf6b68ae.tar.xz
(svn r27134) -Codechange: Simplify GUI scaling by adding UnScaleGUI() and ScaleGUITrad().
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r--src/aircraft_cmd.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index ac71254e1..18dcbea27 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -201,13 +201,15 @@ void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID en
{
SpriteID sprite = GetAircraftIcon(engine, image_type);
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
- preferred_x = Clamp(preferred_x, left - UnScaleByZoom(real_sprite->x_offs, ZOOM_LVL_GUI), right - UnScaleByZoom(real_sprite->width, ZOOM_LVL_GUI) - UnScaleByZoom(real_sprite->x_offs, ZOOM_LVL_GUI));
+ preferred_x = Clamp(preferred_x,
+ left - UnScaleGUI(real_sprite->x_offs),
+ right - UnScaleGUI(real_sprite->width) - UnScaleGUI(real_sprite->x_offs));
DrawSprite(sprite, pal, preferred_x, y);
if (!(AircraftVehInfo(engine)->subtype & AIR_CTOL)) {
SpriteID rotor_sprite = GetCustomRotorIcon(engine, image_type);
if (rotor_sprite == 0) rotor_sprite = SPR_ROTOR_STOPPED;
- DrawSprite(rotor_sprite, PAL_NONE, preferred_x, y - UnScaleByZoom(4 * 5, ZOOM_LVL_GUI));
+ DrawSprite(rotor_sprite, PAL_NONE, preferred_x, y - ScaleGUITrad(5));
}
}
@@ -224,10 +226,10 @@ void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height, int &xoff
{
const Sprite *spr = GetSprite(GetAircraftIcon(engine, image_type), ST_NORMAL);
- width = UnScaleByZoom(spr->width, ZOOM_LVL_GUI);
- height = UnScaleByZoom(spr->height, ZOOM_LVL_GUI);
- xoffs = UnScaleByZoom(spr->x_offs, ZOOM_LVL_GUI);
- yoffs = UnScaleByZoom(spr->y_offs, ZOOM_LVL_GUI);
+ width = UnScaleGUI(spr->width);
+ height = UnScaleGUI(spr->height);
+ xoffs = UnScaleGUI(spr->x_offs);
+ yoffs = UnScaleGUI(spr->y_offs);
}
/**