|
@@ -269,13 +269,13 @@ struct DepotWindow : Window {
|
|
|
|
|
|
switch (v->type) {
|
|
|
case VEH_TRAIN:
|
|
|
DrawTrainImage(v, x + 21, sprite_y, this->sel, this->hscroll.cap + 4, this->hscroll.pos);
|
|
|
|
|
|
/* Number of wagons relative to a standard length wagon (rounded up) */
|
|
|
SetDParam(0, (((const Train *)v)->tcache.cached_total_length + 7) / 8);
|
|
|
SetDParam(0, (Train::From(v)->tcache.cached_total_length + 7) / 8);
|
|
|
DrawString(this->widget[DEPOT_WIDGET_MATRIX].left, this->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING, SA_RIGHT); // Draw the counter
|
|
|
break;
|
|
|
|
|
|
case VEH_ROAD: DrawRoadVehImage( v, x + 24, sprite_y, this->sel, 1); break;
|
|
|
case VEH_SHIP: DrawShipImage( v, x + 19, sprite_y - 1, this->sel); break;
|
|
|
case VEH_AIRCRAFT: {
|
|
@@ -325,13 +325,13 @@ struct DepotWindow : Window {
|
|
|
|
|
|
/* determine amount of items for scroller */
|
|
|
if (this->type == VEH_TRAIN) {
|
|
|
hnum = 8;
|
|
|
for (uint num = 0; num < this->vehicle_list.Length(); num++) {
|
|
|
const Vehicle *v = this->vehicle_list[num];
|
|
|
hnum = max(hnum, ((const Train *)v)->tcache.cached_total_length);
|
|
|
hnum = max(hnum, Train::From(v)->tcache.cached_total_length);
|
|
|
}
|
|
|
/* Always have 1 empty row, so people can change the setting of the train */
|
|
|
SetVScrollCount(w, this->vehicle_list.Length() + this->wagon_list.Length() + 1);
|
|
|
SetHScrollCount(w, WagonLengthToPixels(hnum));
|
|
|
} else {
|
|
|
SetVScrollCount(w, (this->vehicle_list.Length() + this->hscroll.cap - 1) / this->hscroll.cap);
|
|
@@ -447,13 +447,13 @@ struct DepotWindow : Window {
|
|
|
x = (x * 8) / _traininfo_vehicle_width;
|
|
|
|
|
|
/* Skip vehicles that are scrolled off the list */
|
|
|
x += skip;
|
|
|
|
|
|
/* find the vehicle in this row that was clicked */
|
|
|
while (v != NULL && (x -= ((const Train *)v)->tcache.cached_veh_length) >= 0) v = v->Next();
|
|
|
while (v != NULL && (x -= Train::From(v)->tcache.cached_veh_length) >= 0) v = v->Next();
|
|
|
|
|
|
/* if an articulated part was selected, find its parent */
|
|
|
while (v != NULL && IsArticulatedPart(v)) v = v->Previous();
|
|
|
|
|
|
d->wagon = v;
|
|
|
|
|
@@ -511,17 +511,17 @@ struct DepotWindow : Window {
|
|
|
this->sel = v->index;
|
|
|
this->SetDirty();
|
|
|
SetObjectToPlaceWnd(image, GetVehiclePalette(v), HT_DRAG, this);
|
|
|
|
|
|
switch (v->type) {
|
|
|
case VEH_TRAIN:
|
|
|
_cursor.short_vehicle_offset = 16 - ((const Train *)v)->tcache.cached_veh_length * 2;
|
|
|
_cursor.short_vehicle_offset = 16 - Train::From(v)->tcache.cached_veh_length * 2;
|
|
|
break;
|
|
|
|
|
|
case VEH_ROAD:
|
|
|
_cursor.short_vehicle_offset = 16 - ((const RoadVehicle *)v)->rcache.cached_veh_length * 2;
|
|
|
_cursor.short_vehicle_offset = 16 - RoadVehicle::From(v)->rcache.cached_veh_length * 2;
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
_cursor.short_vehicle_offset = 0;
|
|
|
break;
|
|
|
}
|