Changeset - r6176:e229e61b4324
[Not reviewed]
master
0 6 0
maedhros - 18 years ago 2007-02-28 17:59:05
maedhros@openttd.org
(svn r8946) -Feature: [NewGRF] Add support for vehicle variables 0xFE and 0xFF bit 10,
which is set when a vehicle was built during the exclusive testing phase.
6 files changed with 28 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/aircraft_cmd.cpp
Show inline comments
 
@@ -390,6 +390,9 @@ int32 CmdBuildAircraft(TileIndex tile, u
 
		v->random_bits = VehicleRandomBits();
 
		u->random_bits = VehicleRandomBits();
 

	
 
		v->vehicle_flags = 0;
 
		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SETBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 

	
 
		VehiclePositionChanged(v);
 
		VehiclePositionChanged(u);
 

	
src/newgrf_engine.cpp
Show inline comments
 
@@ -601,6 +601,21 @@ static uint32 VehicleGetVariable(const R
 
			}
 

	
 
		case 0x7F: return GetGRFParameter(v->engine_type, parameter); /* Read GRF parameter */
 

	
 
		case 0xFE:
 
		case 0xFF: {
 
			uint16 modflags = 0;
 

	
 
			/* TODO: There are some other bits that should be implemented:
 
			 *   bit 5: Whether the rail vehicle is powered or not (mostly useful for wagons).
 
			 *   bit 6: This is an electrically powered rail vehicle which is running on normal rail.
 
			 *   bit 8: (Maybe?) Toggled whenever the train reverses.
 
			 */
 

	
 
			if (HASBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE)) SETBIT(modflags, 10);
 

	
 
			return variable == 0xFE ? modflags : GB(modflags, 8, 8);
 
		}
 
	}
 

	
 
	/* General vehicle properties */
src/roadveh_cmd.cpp
Show inline comments
 
@@ -204,6 +204,9 @@ int32 CmdBuildRoadVeh(TileIndex tile, ui
 
		v->cur_image = 0xC15;
 
		v->random_bits = VehicleRandomBits();
 

	
 
		v->vehicle_flags = 0;
 
		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SETBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 

	
 
		VehiclePositionChanged(v);
 

	
 
		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
src/ship_cmd.cpp
Show inline comments
 
@@ -913,6 +913,9 @@ int32 CmdBuildShip(TileIndex tile, uint3
 
		v->type = VEH_Ship;
 
		v->random_bits = VehicleRandomBits();
 

	
 
		v->vehicle_flags = 0;
 
		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SETBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 

	
 
		VehiclePositionChanged(v);
 

	
 
		InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
src/train_cmd.cpp
Show inline comments
 
@@ -785,6 +785,9 @@ int32 CmdBuildRailVehicle(TileIndex tile
 
			v->cur_image = 0xAC2;
 
			v->random_bits = VehicleRandomBits();
 

	
 
			v->vehicle_flags = 0;
 
			if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SETBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 

	
 
			v->subtype = 0;
 
			SetFrontEngine(v);
 
			SetTrainEngine(v);
src/vehicle.h
Show inline comments
 
@@ -86,6 +86,7 @@ enum VehStatus {
 
enum VehicleFlags {
 
	VF_LOADING_FINISHED,
 
	VF_CARGO_UNLOADING,
 
	VF_BUILT_AS_PROTOTYPE,
 
};
 

	
 
/* Effect vehicle types */
0 comments (0 inline, 0 general)