Changeset - r18303:3e17bd9b946b
[Not reviewed]
master
0 4 0
frosch - 13 years ago 2011-11-08 17:27:46
frosch@openttd.org
(svn r23149) -Add: [NewGRF] Road vehicle property 23 to shorten vehicles without callback usage.
4 files changed with 9 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/engine_type.h
Show inline comments
 
@@ -121,6 +121,7 @@ struct RoadVehicleInfo {
 
	uint8 tractive_effort;   ///< Coefficient of tractive effort
 
	uint8 air_drag;          ///< Coefficient of air drag
 
	byte visual_effect;      ///< Bitstuffed NewGRF visual effect data
 
	byte shorten_factor;     ///< length on main map for this type is 8 - shorten_factor
 
};
 

	
 
/**
src/newgrf.cpp
Show inline comments
 
@@ -1319,6 +1319,10 @@ static ChangeInfoResult RoadVehicleChang
 
				ei->cargo_age_period = buf->ReadWord();
 
				break;
 

	
 
			case 0x23: // Shorter vehicle
 
				rvi->shorten_factor = buf->ReadByte();
 
				break;
 

	
 
			default:
 
				ret = CommonVehicleChangeInfo(ei, prop, buf);
 
				break;
src/roadveh_cmd.cpp
Show inline comments
 
@@ -161,11 +161,12 @@ void DrawRoadVehEngine(int left, int rig
 
 */
 
static uint GetRoadVehLength(const RoadVehicle *v)
 
{
 
	uint length = VEHICLE_LENGTH;
 
	const Engine *e = v->GetEngine();
 
	uint length = e->u.road.shorten_factor;
 

	
 
	uint16 veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, v->engine_type, v);
 
	if (veh_len != CALLBACK_FAILED) {
 
		if (veh_len >= VEHICLE_LENGTH) ErrorUnknownCallbackResult(v->GetGRFID(), CBID_VEHICLE_LENGTH, veh_len);
 
		if (veh_len >= VEHICLE_LENGTH) ErrorUnknownCallbackResult(e->GetGRFID(), CBID_VEHICLE_LENGTH, veh_len);
 
		length -= Clamp(veh_len, 0, VEHICLE_LENGTH - 1);
 
	}
 

	
src/table/engines.h
Show inline comments
 
@@ -656,7 +656,7 @@ static const AircraftVehicleInfo _orig_a
 
 * Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76
 
 * Air drag value depends on the top speed of the vehicle.
 
 */
 
#define ROV(a, b, c, d, e, f, g, h) { a, b, c, PR_RUNNING_ROADVEH, d, e, f, g, h, 76, 0, VE_DEFAULT }
 
#define ROV(a, b, c, d, e, f, g, h) { a, b, c, PR_RUNNING_ROADVEH, d, e, f, g, h, 76, 0, VE_DEFAULT, 0 }
 
static const RoadVehicleInfo _orig_road_vehicle_info[] = {
 
	/*    image_index       sfx                                 max_speed    power
 
	 *    |    cost_factor  |                                   |   capacity |
0 comments (0 inline, 0 general)