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