diff -r 5a8b295aa345 -r 4cc327ad39d5 src/roadveh.h --- a/src/roadveh.h Tue Mar 27 23:27:27 2007 +0000 +++ b/src/roadveh.h Sat Jun 02 19:59:29 2007 +0000 @@ -1,5 +1,7 @@ /* $Id$ */ +/** @file src/roadveh.h Road vehicle states */ + #ifndef ROADVEH_H #define ROADVEH_H @@ -20,4 +22,28 @@ void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2); void CcCloneRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2); + +/** + * 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) RoadVehicle(); + * + * As side-effect the vehicle type is set correctly. + */ +struct RoadVehicle : public Vehicle { + /** Initializes the Vehicle to a road vehicle */ + RoadVehicle() { this->type = VEH_ROAD; } + + /** We want to 'destruct' the right class. */ + virtual ~RoadVehicle() {} + + const char *GetTypeString() const { return "road vehicle"; } + void MarkDirty(); + void UpdateDeltaXY(Direction direction); + ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; } + WindowClass GetVehicleListWindowClass() const { return WC_ROADVEH_LIST; } + bool IsPrimaryVehicle() const { return true; } +}; + #endif /* ROADVEH_H */