summaryrefslogtreecommitdiff
path: root/src/train.h
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-07-02 00:17:27 +0000
committersmatz <smatz@openttd.org>2009-07-02 00:17:27 +0000
commit77eaefb61c9d1cbd4e6347e3fc042565a5b7572e (patch)
tree503571b0002d4de1e0f27eb6aca694e692c6a795 /src/train.h
parentd86e17d65adebad6f0213451b99645be3494ea45 (diff)
downloadopenttd-77eaefb61c9d1cbd4e6347e3fc042565a5b7572e.tar.xz
(svn r16720) -Codechange: make Set/ClearFrontEngine(), Set/ClearArticulatedPart(), Set/ClearWagon(), Set/ClearEngine(), Set/ClearFreeWagon() and Set/ClearMultiheaded() members of Train
Diffstat (limited to 'src/train.h')
-rw-r--r--src/train.h171
1 files changed, 63 insertions, 108 deletions
diff --git a/src/train.h b/src/train.h
index ef4b06167..4476bb7ff 100644
--- a/src/train.h
+++ b/src/train.h
@@ -51,114 +51,6 @@ enum TrainSubtype {
TS_MULTIHEADED = 5, ///< Engine is a multiheaded
};
-/** Set front engine state
- * @param v vehicle to change
- */
-static inline void SetFrontEngine(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- SetBit(v->subtype, TS_FRONT);
-}
-
-/** Remove the front engine state
- * @param v vehicle to change
- */
-static inline void ClearFrontEngine(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- ClrBit(v->subtype, TS_FRONT);
-}
-
-/** Set a vehicle to be an articulated part
- * @param v vehicle to change
- */
-static inline void SetArticulatedPart(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- SetBit(v->subtype, TS_ARTICULATED_PART);
-}
-
-/** Clear a vehicle from being an articulated part
- * @param v vehicle to change
- */
-static inline void ClearArticulatedPart(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- ClrBit(v->subtype, TS_ARTICULATED_PART);
-}
-
-/** Set a vehicle to be a wagon
- * @param v vehicle to change
- */
-static inline void SetTrainWagon(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- SetBit(v->subtype, TS_WAGON);
-}
-
-/** Clear wagon property
- * @param v vehicle to change
- */
-static inline void ClearTrainWagon(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- ClrBit(v->subtype, TS_WAGON);
-}
-
-/** Set engine status
- * @param v vehicle to change
- */
-static inline void SetTrainEngine(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- SetBit(v->subtype, TS_ENGINE);
-}
-
-/** Clear engine status
- * @param v vehicle to change
- */
-static inline void ClearTrainEngine(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- ClrBit(v->subtype, TS_ENGINE);
-}
-
-/** Set if a vehicle is a free wagon
- * @param v vehicle to change
- */
-static inline void SetFreeWagon(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- SetBit(v->subtype, TS_FREE_WAGON);
-}
-
-/** Clear a vehicle from being a free wagon
- * @param v vehicle to change
- */
-static inline void ClearFreeWagon(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- ClrBit(v->subtype, TS_FREE_WAGON);
-}
-
-
-/** Set if a vehicle is a multiheaded engine
- * @param v vehicle to change
- */
-static inline void SetMultiheaded(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- SetBit(v->subtype, TS_MULTIHEADED);
-}
-
-/** Clear multiheaded engine property
- * @param v vehicle to change
- */
-static inline void ClearMultiheaded(Vehicle *v)
-{
- assert(v->type == VEH_TRAIN);
- ClrBit(v->subtype, TS_MULTIHEADED);
-}
void CcBuildLoco(bool success, TileIndex tile, uint32 p1, uint32 p2);
void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2);
@@ -258,6 +150,69 @@ struct Train : public SpecializedVehicle<Train, VEH_TRAIN> {
bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
/**
+ * Set front engine state
+ */
+ FORCEINLINE void SetFrontEngine() { SetBit(this->subtype, TS_FRONT); }
+
+ /**
+ * Remove the front engine state
+ */
+ FORCEINLINE void ClearFrontEngine() { ClrBit(this->subtype, TS_FRONT); }
+
+ /**
+ * Set a vehicle to be an articulated part
+ */
+ FORCEINLINE void SetArticulatedPart() { SetBit(this->subtype, TS_ARTICULATED_PART); }
+
+ /**
+ * Clear a vehicle from being an articulated part
+ */
+ FORCEINLINE void ClearArticulatedPart() { ClrBit(this->subtype, TS_ARTICULATED_PART); }
+
+ /**
+ * Set a vehicle to be a wagon
+ */
+ FORCEINLINE void SetWagon() { SetBit(this->subtype, TS_WAGON); }
+
+ /**
+ * Clear wagon property
+ */
+ FORCEINLINE void ClearWagon() { ClrBit(this->subtype, TS_WAGON); }
+
+ /**
+ * Set engine status
+ * @param v vehicle to change
+ */
+ FORCEINLINE void SetEngine() { SetBit(this->subtype, TS_ENGINE); }
+
+ /**
+ * Clear engine status
+ */
+ FORCEINLINE void ClearEngine() { ClrBit(this->subtype, TS_ENGINE); }
+
+ /**
+ * Set if a vehicle is a free wagon
+ */
+ FORCEINLINE void SetFreeWagon() { SetBit(this->subtype, TS_FREE_WAGON); }
+
+ /**
+ * Clear a vehicle from being a free wagon
+ * @param v vehicle to change
+ */
+ FORCEINLINE void ClearFreeWagon() { ClrBit(this->subtype, TS_FREE_WAGON); }
+
+ /**
+ * Set if a vehicle is a multiheaded engine
+ */
+ FORCEINLINE void SetMultiheaded() { SetBit(this->subtype, TS_MULTIHEADED); }
+
+ /**
+ * Clear multiheaded engine property
+ */
+ FORCEINLINE void ClearMultiheaded() { ClrBit(this->subtype, TS_MULTIHEADED); }
+
+
+ /**
* Check if train is a front engine
* @return Returns true if train is a front engine
*/