summaryrefslogtreecommitdiff
path: root/src/depot_gui.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-07-01 22:22:01 +0000
committersmatz <smatz@openttd.org>2009-07-01 22:22:01 +0000
commitadc5363202629aa07c762f459d7e9f5bc78efa34 (patch)
treeb0c087f513113051159d435af05d823798b2ee67 /src/depot_gui.cpp
parent15990079ce2bb53446305c5b61c7a620cd58b2dc (diff)
downloadopenttd-adc5363202629aa07c762f459d7e9f5bc78efa34.tar.xz
(svn r16717) -Codechange: make IsFrontEngine() member of Train
Diffstat (limited to 'src/depot_gui.cpp')
-rw-r--r--src/depot_gui.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 6618d0b40..e1612c680 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -437,11 +437,11 @@ struct DepotWindow : Window {
switch (this->type) {
case VEH_TRAIN: {
- const Vehicle *v = *veh;
+ const Train *v = Train::From(*veh);
d->head = d->wagon = v;
/* either pressed the flag or the number, but only when it's a loco */
- if (x < 0 && IsFrontEngine(v)) return (x >= -10) ? MODE_START_STOP : MODE_SHOW_VEHICLE;
+ if (x < 0 && v->IsFrontEngine()) return (x >= -10) ? MODE_START_STOP : MODE_SHOW_VEHICLE;
skip = (skip * 8) / _traininfo_vehicle_width;
x = (x * 8) / _traininfo_vehicle_width;
@@ -450,7 +450,7 @@ struct DepotWindow : Window {
x += skip;
/* find the vehicle in this row that was clicked */
- while (v != NULL && (x -= Train::From(v)->tcache.cached_veh_length) >= 0) v = v->Next();
+ while (v != NULL && (x -= 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();
@@ -564,7 +564,7 @@ struct DepotWindow : Window {
if (!v->IsPrimaryVehicle()) {
v = v->First();
/* Do nothing when clicking on a train in depot with no loc attached */
- if (v->type == VEH_TRAIN && !IsFrontEngine(v)) return;
+ if (v->type == VEH_TRAIN && !Train::From(v)->IsFrontEngine()) return;
}
switch (v->type) {
@@ -950,7 +950,7 @@ struct DepotWindow : Window {
DoCommandP(Vehicle::Get(sel)->tile, Vehicle::Get(sel)->index, true, CMD_REVERSE_TRAIN_DIRECTION | CMD_MSG(STR_ERROR_CAN_T_MAKE_VEHICLE_TURN));
} else if (gdvp.wagon == NULL || gdvp.wagon->index != sel) {
TrainDepotMoveVehicle(gdvp.wagon, sel, gdvp.head);
- } else if (gdvp.head != NULL && IsFrontEngine(gdvp.head)) {
+ } else if (gdvp.head != NULL && Train::From(gdvp.head)->IsFrontEngine()) {
ShowVehicleViewWindow(gdvp.head);
}
}
@@ -977,7 +977,7 @@ struct DepotWindow : Window {
int sell_cmd = (v->type == VEH_TRAIN && (widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0;
- bool is_engine = (!(v->type == VEH_TRAIN && !IsFrontEngine(v)));
+ bool is_engine = (v->type != VEH_TRAIN || Train::From(v)->IsFrontEngine());
if (is_engine) {
_backup_orders_tile = v->tile;