--- a/src/train.h Wed Jun 13 11:17:30 2007 +0000
+++ b/src/train.h Wed Jun 13 11:45:14 2007 +0000
@@ -228,4 +228,27 @@
byte FreightWagonMult(CargoID cargo);
+/**
+ * This class 'wraps' Vehicle; you do not actually instantiate this class.
+ * You create a Vehicle using AllocateVehicle, so it is added to the pool
+ * and you reinitialize that to a Train using:
+ * v = new (v) Train();
+ *
+ * As side-effect the vehicle type is set correctly.
+ */
+struct Train : public Vehicle {
+ /** Initializes the Vehicle to a train */
+ Train() { this->type = VEH_TRAIN; }
+
+ /** We want to 'destruct' the right class. */
+ virtual ~Train() {}
+
+ const char *GetTypeString() const { return "train"; }
+ void MarkDirty();
+ void UpdateDeltaXY(Direction direction);
+ ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_TRAIN_INC : EXPENSES_TRAIN_RUN; }
+ WindowClass GetVehicleListWindowClass() const { return WC_TRAINS_LIST; }
+ void PlayLeaveStationSound() const;
+};
+
#endif /* TRAIN_H */