summaryrefslogtreecommitdiff
path: root/vehicle.h
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-11-18 23:41:03 +0000
committerbjarni <bjarni@openttd.org>2005-11-18 23:41:03 +0000
commit22a46798378768271af6b90cd41327155a909dd2 (patch)
tree3dd0d12983f0eaa08af460475f1f8b0a2c961d75 /vehicle.h
parent40ec9bb1235a2231f0c883baaae73e106c67f1cf (diff)
downloadopenttd-22a46798378768271af6b90cd41327155a909dd2.tar.xz
(svn r3218) -Feature: Multiheaded train engines will now stay in the same train
This means that any user attempt to remove a rear engine will tell the user to move the front engine instead This fixes the assert when moving multiheaded engines (introduced in r3144) Note: to make old savegames use this feature, some engines might be turned around in order to link engines in pairs -Codechange: train subtype is now a bitmask This allows fast access to info like if it is a wagon or engine and if it is in front and so on Note: savegame version bump
Diffstat (limited to 'vehicle.h')
-rw-r--r--vehicle.h47
1 files changed, 3 insertions, 44 deletions
diff --git a/vehicle.h b/vehicle.h
index 0c0e3dce7..59955de41 100644
--- a/vehicle.h
+++ b/vehicle.h
@@ -27,14 +27,6 @@ enum VehStatus {
VS_CRASHED = 0x80,
};
-// 1 and 3 do not appear to be used
-typedef enum TrainSubtypes {
- TS_Front_Engine = 0, // Leading engine of a train
- TS_Artic_Part = 1, // Articulated part of an engine
- TS_Not_First = 2, // Wagon or additional engine
- TS_Free_Car = 4, // First in a wagon chain (in depot)
-} TrainSubtype;
-
/* Effect vehicle types */
typedef enum EffectVehicle {
EV_CHIMNEY_SMOKE = 0,
@@ -93,6 +85,9 @@ typedef struct VehicleRail {
* skip station and alike by setting it to 0. That way we will ensure that a complete loop is used to find the shortest station
*/
byte shortest_platform[2];
+
+ // Link between the two ends of a multiheaded engine
+ Vehicle *other_multiheaded_part;
} VehicleRail;
enum {
@@ -311,7 +306,6 @@ void DecreaseVehicleValue(Vehicle *v);
void CheckVehicleBreakdown(Vehicle *v);
void AgeVehicle(Vehicle *v);
void VehicleEnteredDepotThisTick(Vehicle *v);
-Vehicle* GetRearEngine(const Vehicle* v);
void BeginVehicleMove(Vehicle *v);
void EndVehicleMove(Vehicle *v);
@@ -399,41 +393,6 @@ static inline bool IsVehicleIndex(uint index)
return index < GetVehiclePoolSize();
}
-/**
- * Get the next real (non-articulated part) vehicle in the consist.
- * @param v Vehicle.
- * @return Next vehicle in the consist.
- */
-static inline Vehicle *GetNextVehicle(const Vehicle *v)
-{
- Vehicle *u = v->next;
- while (u != NULL && u->subtype == TS_Artic_Part) {
- u = u->next;
- }
- return u;
-}
-
-/**
- * Check if an engine has an articulated part.
- * @param v Vehicle.
- * @return True if the engine has an articulated part.
- */
-static inline bool EngineHasArticPart(const Vehicle *v)
-{
- return (v->next != NULL && v->next->subtype == TS_Artic_Part);
-}
-
-/**
- * Get the last part of a multi-part engine.
- * @param v Vehicle.
- * @return Last part of the engine.
- */
-static inline Vehicle *GetLastEnginePart(Vehicle *v)
-{
- while (EngineHasArticPart(v)) v = v->next;
- return v;
-}
-
/* Returns order 'index' of a vehicle or NULL when it doesn't exists */
static inline Order *GetVehicleOrder(const Vehicle *v, int index)
{