src/vehicle.h
branchcpp_gui
changeset 6285 187e3ef04cc9
parent 6268 4b5241e5dd10
child 6298 c30fe89622df
equal deleted inserted replaced
6284:45d0233e7d79 6285:187e3ef04cc9
    29 
    29 
    30 /** Road vehicle states */
    30 /** Road vehicle states */
    31 enum RoadVehicleStates {
    31 enum RoadVehicleStates {
    32 	/*
    32 	/*
    33 	 * Lower 4 bits are used for vehicle track direction. (Trackdirs)
    33 	 * Lower 4 bits are used for vehicle track direction. (Trackdirs)
    34 	 * When in a road stop (bit 5 set) these bits give the
    34 	 * When in a road stop (bit 5 or bit 6 set) these bits give the
    35 	 * track direction of the entry to the road stop.
    35 	 * track direction of the entry to the road stop.
    36 	 * As the entry direction will always be a diagonal
    36 	 * As the entry direction will always be a diagonal
    37 	 * direction (X_NE, Y_SE, X_SW or Y_NW) only bits 0 and 3
    37 	 * direction (X_NE, Y_SE, X_SW or Y_NW) only bits 0 and 3
    38 	 * are needed to hold this direction. Bit 1 is then used to show
    38 	 * are needed to hold this direction. Bit 1 is then used to show
    39 	 * that the vehicle is using the second road stop bay.
    39 	 * that the vehicle is using the second road stop bay.
       
    40 	 * Bit 2 is then used for drive-through stops to show the vehicle
       
    41 	 * is stopping at this road stop.
    40 	 */
    42 	 */
    41 
    43 
    42 	/* Numeric values */
    44 	/* Numeric values */
    43 	RVSB_IN_DEPOT                = 0xFE,                      ///< The vehicle is in a depot
    45 	RVSB_IN_DEPOT                = 0xFE,                      ///< The vehicle is in a depot
    44 	RVSB_WORMHOLE                = 0xFF,                      ///< The vehicle is in a tunnel and/or bridge
    46 	RVSB_WORMHOLE                = 0xFF,                      ///< The vehicle is in a tunnel and/or bridge
    45 
    47 
    46 	/* Bit numbers */
    48 	/* Bit numbers */
    47 	RVS_USING_SECOND_BAY         =    1,                      ///< Only used while in a road stop
    49 	RVS_USING_SECOND_BAY         =    1,                      ///< Only used while in a road stop
    48 	RVS_IS_STOPPING              =    2,                      ///< Only used for drive-through stops. Vehicle will stop here
    50 	RVS_IS_STOPPING              =    2,                      ///< Only used for drive-through stops. Vehicle will stop here
    49 	RVS_DRIVE_SIDE               =    4,                      ///< Only used when retrieving move data and for turning vehicles
    51 	RVS_DRIVE_SIDE               =    4,                      ///< Only used when retrieving move data
    50 	RVS_IN_ROAD_STOP             =    5,                      ///< The vehicle is in a road stop
    52 	RVS_IN_ROAD_STOP             =    5,                      ///< The vehicle is in a road stop
    51 	RVS_IN_DT_ROAD_STOP          =    6,                      ///< The vehicle is in a drive-through road stop
    53 	RVS_IN_DT_ROAD_STOP          =    6,                      ///< The vehicle is in a drive-through road stop
    52 
    54 
    53 	/* Bit sets of the above specified bits */
    55 	/* Bit sets of the above specified bits */
    54 	RVSB_USING_SECOND_BAY        = 1 << RVS_USING_SECOND_BAY, ///< Only used while in a road stop
       
    55 	RVSB_DRIVE_SIDE              = 1 << RVS_DRIVE_SIDE,       ///< Only used when retrieving move data and for turning vehicles
       
    56 	RVSB_IN_ROAD_STOP            = 1 << RVS_IN_ROAD_STOP,     ///< The vehicle is in a road stop
    56 	RVSB_IN_ROAD_STOP            = 1 << RVS_IN_ROAD_STOP,     ///< The vehicle is in a road stop
    57 	RVSB_IN_ROAD_STOP_END        = RVSB_IN_ROAD_STOP + TRACKDIR_END,
    57 	RVSB_IN_ROAD_STOP_END        = RVSB_IN_ROAD_STOP + TRACKDIR_END,
    58 	RVSB_IN_DT_ROAD_STOP         = 1 << RVS_IN_DT_ROAD_STOP,  ///< The vehicle is in a drive-through road stop
    58 	RVSB_IN_DT_ROAD_STOP         = 1 << RVS_IN_DT_ROAD_STOP,  ///< The vehicle is in a drive-through road stop
    59 	RVSB_IN_DT_ROAD_STOP_END     = RVSB_IN_DT_ROAD_STOP + TRACKDIR_END,
    59 	RVSB_IN_DT_ROAD_STOP_END     = RVSB_IN_DT_ROAD_STOP + TRACKDIR_END,
    60 
    60 
    81 	VS_SHADOW          = 0x20,
    81 	VS_SHADOW          = 0x20,
    82 	VS_AIRCRAFT_BROKEN = 0x40,
    82 	VS_AIRCRAFT_BROKEN = 0x40,
    83 	VS_CRASHED         = 0x80,
    83 	VS_CRASHED         = 0x80,
    84 };
    84 };
    85 
    85 
    86 enum LoadStatus {
    86 enum VehicleFlags {
    87 	LS_LOADING_FINISHED,
    87 	VF_LOADING_FINISHED,
    88 	LS_CARGO_UNLOADING,
    88 	VF_CARGO_UNLOADING,
    89 	/* LS_CARGO_PAID_FOR was here until savegame version 45. */
    89 	VF_BUILT_AS_PROTOTYPE,
    90 };
    90 };
    91 
    91 
    92 /* Effect vehicle types */
    92 /* Effect vehicle types */
    93 typedef enum EffectVehicle {
    93 typedef enum EffectVehicle {
    94 	EV_CHIMNEY_SMOKE   = 0,
    94 	EV_CHIMNEY_SMOKE   = 0,
   292 
   292 
   293 	bool leave_depot_instantly; // NOSAVE: stores if the vehicle needs to leave the depot it just entered. Used by autoreplace
   293 	bool leave_depot_instantly; // NOSAVE: stores if the vehicle needs to leave the depot it just entered. Used by autoreplace
   294 
   294 
   295 	uint16 load_unload_time_rem;
   295 	uint16 load_unload_time_rem;
   296 	uint16 cargo_paid_for;      // How much of the cargo currently on board has been paid for.
   296 	uint16 cargo_paid_for;      // How much of the cargo currently on board has been paid for.
   297 	byte load_status;
   297 	byte vehicle_flags;         // Used for gradual loading and other miscellaneous things (@see VehicleFlags enum)
   298 
   298 
   299 	int32 profit_this_year;
   299 	int32 profit_this_year;
   300 	int32 profit_last_year;
   300 	int32 profit_last_year;
       
   301 	int32 cargo_feeder_share;      ///< value of feeder pickup to be paid for on delivery of cargo
       
   302 	TileIndex cargo_loaded_at_xy;  ///< tile index where feeder cargo was loaded
   301 	uint32 value;
   303 	uint32 value;
   302 
   304 
   303 	union {
   305 	union {
   304 		VehicleRail rail;
   306 		VehicleRail rail;
   305 		VehicleAir air;
   307 		VehicleAir air;