2006-06-05 10:23:18 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2007-04-03 19:19:04 +00:00
|
|
|
/** @file src/roadveh.h Road vehicle states */
|
2007-03-28 20:41:35 +00:00
|
|
|
|
2006-09-28 18:42:35 +00:00
|
|
|
#ifndef ROADVEH_H
|
|
|
|
#define ROADVEH_H
|
|
|
|
|
2006-06-05 10:23:18 +00:00
|
|
|
#include "vehicle.h"
|
|
|
|
|
|
|
|
|
|
|
|
static inline bool IsRoadVehInDepot(const Vehicle* v)
|
|
|
|
{
|
2007-03-08 16:27:54 +00:00
|
|
|
assert(v->type == VEH_ROAD);
|
2006-06-05 10:23:18 +00:00
|
|
|
return v->u.road.state == 254;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool IsRoadVehInDepotStopped(const Vehicle* v)
|
|
|
|
{
|
|
|
|
return IsRoadVehInDepot(v) && v->vehstatus & VS_STOPPED;
|
|
|
|
}
|
2006-09-27 15:40:55 +00:00
|
|
|
|
2007-01-22 02:09:51 +00:00
|
|
|
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
|
2006-09-27 15:40:55 +00:00
|
|
|
void CcCloneRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
|
2006-09-28 18:42:35 +00:00
|
|
|
|
2007-04-29 21:24:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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() {}
|
|
|
|
|
2007-05-02 09:39:11 +00:00
|
|
|
const char *GetTypeString() const { return "road vehicle"; }
|
2007-04-29 22:33:51 +00:00
|
|
|
void MarkDirty();
|
2007-05-01 16:35:14 +00:00
|
|
|
void UpdateDeltaXY(Direction direction);
|
2007-05-02 09:39:11 +00:00
|
|
|
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; }
|
|
|
|
WindowClass GetVehicleListWindowClass() const { return WC_ROADVEH_LIST; }
|
2007-04-29 21:24:08 +00:00
|
|
|
};
|
|
|
|
|
2006-09-28 18:42:35 +00:00
|
|
|
#endif /* ROADVEH_H */
|