summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2012-12-23 01:00:25 +0000
committermichi_cc <michi_cc@openttd.org>2012-12-23 01:00:25 +0000
commit245e32a10efb0dc924289a8cdec089cd13f3b47d (patch)
tree59f7728808701336fff2999efbd8c1d81e18c2a2 /src/roadveh_cmd.cpp
parentc41027fbaeb3ba722c1477e10d4d3fa7c25a0bff (diff)
downloadopenttd-245e32a10efb0dc924289a8cdec089cd13f3b47d.tar.xz
(svn r24839) -Feature [FS#5271]: [NewGRF] Support oversized purchase list sprites. (Based on patch by Eddi)
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 0bbef9632..fcc3b30ff 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -156,6 +156,25 @@ void DrawRoadVehEngine(int left, int right, int preferred_x, int y, EngineID eng
}
/**
+ * Get the size of the sprite of a road vehicle sprite heading west (used for lists).
+ * @param engine The engine to get the sprite from.
+ * @param[out] width The width of the sprite.
+ * @param[out] height The height of the sprite.
+ * @param[out] xoffs Number of pixels to shift the sprite to the right.
+ * @param[out] yoffs Number of pixels to shift the sprite downwards.
+ * @param image_type Context the sprite is used in.
+ */
+void GetRoadVehSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
+{
+ const Sprite *spr = GetSprite(GetRoadVehIcon(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);
+}
+
+/**
* Get length of a road vehicle.
* @param v Road vehicle to query length.
* @return Length of the given road vehicle.