summaryrefslogtreecommitdiff
path: root/src/engine_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-16 17:15:42 +0000
committerrubidium <rubidium@openttd.org>2009-11-16 17:15:42 +0000
commit1c5a92ae98954adb4c8e3841577ad771f79aaa47 (patch)
treefe3616b09774c5199a985cd3bf9461134335caad /src/engine_gui.cpp
parent179b924173e250de707102f319da03d609c482b4 (diff)
downloadopenttd-1c5a92ae98954adb4c8e3841577ad771f79aaa47.tar.xz
(svn r18121) -Codechange: pass the maximum left/right location to the Draw*Engine functions
Diffstat (limited to 'src/engine_gui.cpp')
-rw-r--r--src/engine_gui.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index 0ce2428bc..60343bfb8 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -104,7 +104,7 @@ struct EnginePreviewWindow : Window {
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_ENGINE_NAME, TC_BLACK, SA_CENTER);
y += FONT_HEIGHT_NORMAL;
- DrawVehicleEngine(this->width >> 1, y + VEHICLE_SPACE / 2, engine, GetEnginePalette(engine, _local_company));
+ DrawVehicleEngine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, this->width >> 1, y + VEHICLE_SPACE / 2, engine, GetEnginePalette(engine, _local_company));
y += VEHICLE_SPACE;
DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, r.bottom, GetEngineInfoString(engine), TC_FROMSTRING, SA_CENTER);
@@ -248,30 +248,32 @@ StringID GetEngineInfoString(EngineID engine)
/**
* Draw an engine.
- * @param x Horizontal position to use for drawing the engine.
+ * @param left Minimum horizontal position to use for drawing the engine
+ * @param right Maximum horizontal position to use for drawing the engine
+ * @param preferred_x Horizontal position to use for drawing the engine.
* @param y Vertical position to use for drawing the engine.
* @param engine Engine to draw.
* @param pal Palette to use for drawing.
*/
-void DrawVehicleEngine(int x, int y, EngineID engine, SpriteID pal)
+void DrawVehicleEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
{
const Engine *e = Engine::Get(engine);
switch (e->type) {
case VEH_TRAIN:
- DrawTrainEngine(x, y, engine, pal);
+ DrawTrainEngine(left, right, preferred_x, y, engine, pal);
break;
case VEH_ROAD:
- DrawRoadVehEngine(x, y, engine, pal);
+ DrawRoadVehEngine(left, right, preferred_x, y, engine, pal);
break;
case VEH_SHIP:
- DrawShipEngine(x, y, engine, pal);
+ DrawShipEngine(left, right, preferred_x, y, engine, pal);
break;
case VEH_AIRCRAFT:
- DrawAircraftEngine(x, y, engine, pal);
+ DrawAircraftEngine(left, right, preferred_x, y, engine, pal);
break;
default: NOT_REACHED();