src/train.h
changeset 7928 63e18de69e50
parent 7548 3a679b6e8b30
child 7929 6c9b25842b0f
equal deleted inserted replaced
7927:3a3289a049f9 7928:63e18de69e50
    30  * @return Returns true if vehicle is a front engine
    30  * @return Returns true if vehicle is a front engine
    31  */
    31  */
    32 static inline bool IsFrontEngine(const Vehicle *v)
    32 static inline bool IsFrontEngine(const Vehicle *v)
    33 {
    33 {
    34 	assert(v->type == VEH_TRAIN);
    34 	assert(v->type == VEH_TRAIN);
    35 	return HASBIT(v->subtype, Train_Front);
    35 	return HasBit(v->subtype, Train_Front);
    36 }
    36 }
    37 
    37 
    38 /** Set front engine state
    38 /** Set front engine state
    39  * @param v vehicle to change
    39  * @param v vehicle to change
    40  */
    40  */
    58  * @return Returns true if vehicle is an articulated part
    58  * @return Returns true if vehicle is an articulated part
    59  */
    59  */
    60 static inline bool IsArticulatedPart(const Vehicle *v)
    60 static inline bool IsArticulatedPart(const Vehicle *v)
    61 {
    61 {
    62 	assert(v->type == VEH_TRAIN);
    62 	assert(v->type == VEH_TRAIN);
    63 	return HASBIT(v->subtype, Train_Articulated_Part);
    63 	return HasBit(v->subtype, Train_Articulated_Part);
    64 }
    64 }
    65 
    65 
    66 /** Set a vehicle to be an articulated part
    66 /** Set a vehicle to be an articulated part
    67  * @param v vehicle to change
    67  * @param v vehicle to change
    68  */
    68  */
    86  * @return Returns true if vehicle is a wagon
    86  * @return Returns true if vehicle is a wagon
    87  */
    87  */
    88 static inline bool IsTrainWagon(const Vehicle *v)
    88 static inline bool IsTrainWagon(const Vehicle *v)
    89 {
    89 {
    90 	assert(v->type == VEH_TRAIN);
    90 	assert(v->type == VEH_TRAIN);
    91 	return HASBIT(v->subtype, Train_Wagon);
    91 	return HasBit(v->subtype, Train_Wagon);
    92 }
    92 }
    93 
    93 
    94 /** Set a vehicle to be a wagon
    94 /** Set a vehicle to be a wagon
    95  * @param v vehicle to change
    95  * @param v vehicle to change
    96  */
    96  */
   114  * @return Returns true if vehicle is an engine
   114  * @return Returns true if vehicle is an engine
   115  */
   115  */
   116 static inline bool IsTrainEngine(const Vehicle *v)
   116 static inline bool IsTrainEngine(const Vehicle *v)
   117 {
   117 {
   118 	assert(v->type == VEH_TRAIN);
   118 	assert(v->type == VEH_TRAIN);
   119 	return HASBIT(v->subtype, Train_Engine);
   119 	return HasBit(v->subtype, Train_Engine);
   120 }
   120 }
   121 
   121 
   122 /** Set engine status
   122 /** Set engine status
   123  * @param v vehicle to change
   123  * @param v vehicle to change
   124  */
   124  */
   142  * @return Returns true if vehicle is a free wagon
   142  * @return Returns true if vehicle is a free wagon
   143  */
   143  */
   144 static inline bool IsFreeWagon(const Vehicle *v)
   144 static inline bool IsFreeWagon(const Vehicle *v)
   145 {
   145 {
   146 	assert(v->type == VEH_TRAIN);
   146 	assert(v->type == VEH_TRAIN);
   147 	return HASBIT(v->subtype, Train_Free_Wagon);
   147 	return HasBit(v->subtype, Train_Free_Wagon);
   148 }
   148 }
   149 
   149 
   150 /** Set if a vehicle is a free wagon
   150 /** Set if a vehicle is a free wagon
   151  * @param v vehicle to change
   151  * @param v vehicle to change
   152  */
   152  */
   170  * @return Returns true if vehicle is a multiheaded engine
   170  * @return Returns true if vehicle is a multiheaded engine
   171  */
   171  */
   172 static inline bool IsMultiheaded(const Vehicle *v)
   172 static inline bool IsMultiheaded(const Vehicle *v)
   173 {
   173 {
   174 	assert(v->type == VEH_TRAIN);
   174 	assert(v->type == VEH_TRAIN);
   175 	return HASBIT(v->subtype, Train_Multiheaded);
   175 	return HasBit(v->subtype, Train_Multiheaded);
   176 }
   176 }
   177 
   177 
   178 /** Set if a vehicle is a multiheaded engine
   178 /** Set if a vehicle is a multiheaded engine
   179  * @param v vehicle to change
   179  * @param v vehicle to change
   180  */
   180  */