File diff r15351:fe3041e6c4c3 → r15352:61cc54bb72c5
src/train.h
Show inline comments
 
@@ -34,24 +34,32 @@ enum VehicleRailFlags {
 
	VRF_NO_PATH_TO_DESTINATION = 5,
 

	
 
	/* used to mark that electric train engine is allowed to run on normal rail */
 
	VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL = 6,
 

	
 
	/* used for vehicle var 0xFE bit 8 (toggled each time the train is reversed, accurate for first vehicle only) */
 
	VRF_TOGGLE_REVERSE = 7,
 

	
 
	/* used to mark a train that can't get a path reservation */
 
	VRF_TRAIN_STUCK    = 8,
 
};
 

	
 
/** Modes for ignoring signals. */
 
enum TrainForceProceeding {
 
	TFP_NONE   = 0,    ///< Normal operation.
 
	TFP_STUCK  = 1,    ///< Proceed till next signal, but ignore being stuck till then. This includes force leaving depots.
 
	TFP_SIGNAL = 2,    ///< Ignore next signal, after the signal ignore being stucked.
 
};
 
typedef SimpleTinyEnumT<TrainForceProceeding, byte> TrainForceProceedingByte;
 

	
 
byte FreightWagonMult(CargoID cargo);
 

	
 
void CheckTrainsLengths();
 

	
 
void FreeTrainTrackReservation(const Train *v, TileIndex origin = INVALID_TILE, Trackdir orig_td = INVALID_TRACKDIR);
 
bool TryPathReserve(Train *v, bool mark_as_stuck = false, bool first_tile_okay = false);
 

	
 
int GetTrainStopLocation(StationID station_id, TileIndex tile, const Train *v, int *station_ahead, int *station_length);
 

	
 
/** Variables that are cached to improve performance and such */
 
struct TrainCache {
 
	/* Cached wagon override spritegroup */
 
@@ -85,25 +93,25 @@ struct TrainCache {
 
 * 'Train' is either a loco or a wagon.
 
 */
 
struct Train : public GroundVehicle<Train, VEH_TRAIN> {
 
	TrainCache tcache;
 

	
 
	/* Link between the two ends of a multiheaded engine */
 
	Train *other_multiheaded_part;
 

	
 
	uint16 crash_anim_pos;
 

	
 
	uint16 flags;
 
	TrackBitsByte track;
 
	byte force_proceed;
 
	TrainForceProceedingByte force_proceed;
 
	RailTypeByte railtype;
 
	RailTypes compatible_railtypes;
 

	
 
	/** Ticks waiting in front of a signal, ticks being stuck or a counter for forced proceeding through signals. */
 
	uint16 wait_counter;
 

	
 
	/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
 
	Train() : GroundVehicle<Train, VEH_TRAIN>() {}
 
	/** We want to 'destruct' the right class. */
 
	virtual ~Train() { this->PreDestructor(); }
 

	
 
	friend struct GroundVehicle<Train, VEH_TRAIN>; // GroundVehicle needs to use the acceleration functions defined at Train.