summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-12-21 13:56:52 +0000
committerterkhen <terkhen@openttd.org>2010-12-21 13:56:52 +0000
commita136200c39704302ddaea1a46a9f3990eb736758 (patch)
treef148bf3e3f629ae2bff801a9ad80388c62974373
parent5a124feb6dc6a68d56200ffb9c2b497b1970176a (diff)
downloadopenttd-a136200c39704302ddaea1a46a9f3990eb736758.tar.xz
(svn r21565) -Codechange: Add pixel skip to DrawRoadVehImage().
-rw-r--r--src/roadveh_gui.cpp5
-rw-r--r--src/vehicle_gui.cpp2
-rw-r--r--src/vehicle_gui.h2
3 files changed, 5 insertions, 4 deletions
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index cc44c4139..029234c26 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -128,8 +128,9 @@ void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y)
* @param right The maximum horizontal position
* @param y Vertical position to draw at
* @param selection Selected vehicle to draw a frame around
+ * @param skip Number of pixels to skip at the front (for scrolling)
*/
-void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection)
+void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection, int skip)
{
bool rtl = _current_text_dir == TD_RTL;
Direction dir = rtl ? DIR_E : DIR_W;
@@ -143,7 +144,7 @@ void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID se
old_dpi = _cur_dpi;
_cur_dpi = &tmp_dpi;
- int px = rtl ? max_width : 0;
+ int px = rtl ? max_width + skip : -skip;
for (; u != NULL && (rtl ? px > 0 : px < max_width); u = u->Next()) {
Point offset;
int width = u->GetDisplayImageWidth(&offset);
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 5393a5a71..7bb6395ab 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -998,7 +998,7 @@ void DrawVehicleImage(const Vehicle *v, int left, int right, int y, VehicleID se
{
switch (v->type) {
case VEH_TRAIN: DrawTrainImage(Train::From(v), left, right, y, selection, skip); break;
- case VEH_ROAD: DrawRoadVehImage(v, left, right, y, selection); break;
+ case VEH_ROAD: DrawRoadVehImage(v, left, right, y, selection, skip); break;
case VEH_SHIP: DrawShipImage(v, left, right, y, selection); break;
case VEH_AIRCRAFT: DrawAircraftImage(v, left, right, y, selection); break;
default: NOT_REACHED();
diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h
index 51646bbd8..6f4113028 100644
--- a/src/vehicle_gui.h
+++ b/src/vehicle_gui.h
@@ -49,7 +49,7 @@ enum TrainDetailsWindowTabs {
int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number);
void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID selection, int skip, VehicleID drag_dest = INVALID_VEHICLE);
-void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection);
+void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection, int skip = 0);
void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selection);
void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID selection);