summaryrefslogtreecommitdiff
path: root/src/depot_gui.cpp
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-12-14 21:33:53 +0000
committerterkhen <terkhen@openttd.org>2010-12-14 21:33:53 +0000
commit48b7916458de4b2cdbc226a4a6ab078db4c77e73 (patch)
treec3a49ca7a91890042ca56765574bc40a54c15f96 /src/depot_gui.cpp
parenta93944e765776c6e9a2bd556457cd93748068da6 (diff)
downloadopenttd-48b7916458de4b2cdbc226a4a6ab078db4c77e73.tar.xz
(svn r21521) -Codechange: Unify some cached values that were present in both road vehicles and trains.
Diffstat (limited to 'src/depot_gui.cpp')
-rw-r--r--src/depot_gui.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 8caeea967..8b6188efd 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -287,7 +287,7 @@ struct DepotWindow : Window {
this->sel, free_wagon ? 0 : this->hscroll->GetPosition(), this->vehicle_over);
/* Number of wagons relative to a standard length wagon (rounded up) */
- SetDParam(0, CeilDiv(u->tcache.cached_total_length, 8));
+ SetDParam(0, CeilDiv(u->gcache.cached_total_length, 8));
DrawString(rtl ? left + WD_FRAMERECT_LEFT : right - this->count_width, rtl ? left + this->count_width : right - WD_FRAMERECT_RIGHT, y + (this->resize.step_height - FONT_HEIGHT_SMALL) / 2, STR_TINY_BLACK_COMA, TC_FROMSTRING, SA_RIGHT); // Draw the counter
break;
}
@@ -507,19 +507,7 @@ struct DepotWindow : Window {
this->sel = v->index;
this->SetDirty();
- switch (v->type) {
- case VEH_TRAIN:
- _cursor.short_vehicle_offset = 16 - Train::From(v)->tcache.cached_veh_length * 2;
- break;
-
- case VEH_ROAD:
- _cursor.short_vehicle_offset = 16 - RoadVehicle::From(v)->rcache.cached_veh_length * 2;
- break;
-
- default:
- _cursor.short_vehicle_offset = 0;
- break;
- }
+ _cursor.short_vehicle_offset = v->IsGroundVehicle() ? 16 - v->GetGroundVehicleCache()->cached_veh_length * 2 : 0;
_cursor.vehchain = _ctrl_pressed;
}
break;