Changeset - r10901:d21ccd8648fa
[Not reviewed]
master
0 7 0
peter1138 - 16 years ago 2009-01-23 20:53:43
peter1138@openttd.org
(svn r15236) -Codechange: Rename realistic_acceleration patch option to train_acceleration_model, and change from boolean to value. Don't forget to update your settings.
7 files changed with 24 insertions and 17 deletions:
0 comments (0 inline, 0 general)
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -539,7 +539,7 @@ static int DrawRailEnginePurchaseInfo(in
 
	y += 10;
 

	
 
	/* Max tractive effort - not applicable if old acceleration or maglev */
 
	if (_settings_game.vehicle.realistic_acceleration && rvi->railtype != RAILTYPE_MAGLEV) {
 
	if (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && rvi->railtype != RAILTYPE_MAGLEV) {
 
		SetDParam(0, ((weight << multihead) * 10 * GetEngineProperty(engine_number, 0x1F, rvi->tractive_effort)) / 256);
 
		DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING);
 
		y += 10;
src/lang/english.txt
Show inline comments
 
@@ -1025,7 +1025,9 @@ STR_CONFIG_PATCHES_AUTOSLOPE            
 
STR_CONFIG_PATCHES_CATCHMENT                                    :{LTBLUE}Allow more realistically sized catchment areas: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_EXTRADYNAMITE                                :{LTBLUE}Allow removal of more town-owned roads, bridges, etc: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_MAMMOTHTRAINS                                :{LTBLUE}Enable building very long trains: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_REALISTICACCEL                               :{LTBLUE}Enable realistic acceleration for trains: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_TRAIN_ACCELERATION_MODEL                     :{LTBLUE}Train acceleration model: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_TRAIN_ACCELERATION_MODEL_ORIGINAL            :Original
 
STR_CONFIG_PATCHES_TRAIN_ACCELERATION_MODEL_REALISTIC           :Realistic
 
STR_CONFIG_PATCHES_FORBID_90_DEG                                :{LTBLUE}Forbid trains and ships to make 90 deg turns: {ORANGE}{STRING1} {LTBLUE} (not with NTP)
 
STR_CONFIG_PATCHES_JOINSTATIONS                                 :{LTBLUE}Join train stations built next to each other: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_DISTANT_JOIN_STATIONS                        :{LTBLUE}Allow to join stations not directly adjacent: {ORANGE}{STRING1}
src/settings.cpp
Show inline comments
 
@@ -935,7 +935,7 @@ static int32 EngineRenewMoneyUpdate(int3
 
	return 0;
 
}
 

	
 
static int32 RealisticAccelerationChanged(int32 p1)
 
static int32 TrainAccelerationModelChanged(int32 p1)
 
{
 
	Vehicle *v;
 

	
 
@@ -1321,7 +1321,7 @@ const SettingDesc _patch_settings[] = {
 
	    SDT_BOOL(GameSettings, station.always_small_airport,                                        0,NN, false,                    STR_CONFIG_PATCHES_SMALL_AIRPORTS,         NULL),
 
	 SDT_CONDVAR(GameSettings, economy.town_layout,                  SLE_UINT8, 59, SL_MAX_VERSION, 0,MS,TL_ORIGINAL,TL_NO_ROADS,NUM_TLS-1,1, STR_CONFIG_PATCHES_TOWN_LAYOUT,  CheckTownLayout),
 

	
 
	    SDT_BOOL(GameSettings, vehicle.realistic_acceleration,                                      0, 0, false,                    STR_CONFIG_PATCHES_REALISTICACCEL,         RealisticAccelerationChanged),
 
	     SDT_VAR(GameSettings, vehicle.train_acceleration_model,     SLE_UINT8,                     0,MS,     0,     0,       1, 1, STR_CONFIG_PATCHES_TRAIN_ACCELERATION_MODEL, TrainAccelerationModelChanged),
 
	    SDT_BOOL(GameSettings, pf.forbid_90_deg,                                                    0, 0, false,                    STR_CONFIG_PATCHES_FORBID_90_DEG,          NULL),
 
	    SDT_BOOL(GameSettings, vehicle.mammoth_trains,                                              0,NN,  true,                    STR_CONFIG_PATCHES_MAMMOTHTRAINS,          NULL),
 
	    SDT_BOOL(GameSettings, order.gotodepot,                                                     0, 0,  true,                    STR_CONFIG_PATCHES_GOTODEPOT,              NULL),
src/settings_type.h
Show inline comments
 
@@ -283,7 +283,7 @@ struct OrderSettings {
 
/** Settings related to vehicles. */
 
struct VehicleSettings {
 
	bool   mammoth_trains;                   ///< allow very long trains
 
	bool   realistic_acceleration;           ///< realistic acceleration for trains
 
	uint8  train_acceleration_model;         ///< realistic acceleration for trains
 
	bool   wagon_speed_limits;               ///< enable wagon speed limits
 
	bool   disable_elrails;                  ///< when true, the elrails are disabled
 
	UnitID max_trains;                       ///< max trains in game per company
src/train_cmd.cpp
Show inline comments
 
@@ -1965,7 +1965,7 @@ CommandCost CmdReverseTrainDirection(Til
 
		if (v->vehstatus & VS_CRASHED || v->breakdown_ctr != 0) return CMD_ERROR;
 

	
 
		if (flags & DC_EXEC) {
 
			if (_settings_game.vehicle.realistic_acceleration && v->cur_speed != 0) {
 
			if (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && v->cur_speed != 0) {
 
				ToggleBit(v->u.rail.flags, VRF_REVERSING);
 
			} else {
 
				v->cur_speed = 0;
 
@@ -3280,16 +3280,16 @@ static int UpdateTrainSpeed(Vehicle *v)
 
	uint accel;
 

	
 
	if (v->vehstatus & VS_STOPPED || HasBit(v->u.rail.flags, VRF_REVERSING) || HasBit(v->u.rail.flags, VRF_TRAIN_STUCK)) {
 
		if (_settings_game.vehicle.realistic_acceleration) {
 
			accel = GetTrainAcceleration(v, AM_BRAKE) * 2;
 
		} else {
 
			accel = v->acceleration * -2;
 
		switch (_settings_game.vehicle.train_acceleration_model) {
 
			default: NOT_REACHED();
 
			case TAM_ORIGINAL:  accel = v->acceleration * -2; break;
 
			case TAM_REALISTIC: accel = GetTrainAcceleration(v, AM_BRAKE) * 2; break;
 
		}
 
	} else {
 
		if (_settings_game.vehicle.realistic_acceleration) {
 
			accel = GetTrainAcceleration(v, AM_ACCEL);
 
		} else {
 
			accel = v->acceleration;
 
		switch (_settings_game.vehicle.train_acceleration_model) {
 
			default: NOT_REACHED();
 
			case TAM_ORIGINAL:  accel = v->acceleration; break;
 
			case TAM_REALISTIC: accel = GetTrainAcceleration(v, AM_ACCEL); break;
 
		}
 
	}
 

	
 
@@ -3439,7 +3439,7 @@ static const RailtypeSlowdownParams _rai
 
/** Modify the speed of the vehicle due to a turn */
 
static inline void AffectSpeedByDirChange(Vehicle *v, Direction new_dir)
 
{
 
	if (_settings_game.vehicle.realistic_acceleration) return;
 
	if (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL) return;
 

	
 
	DirDiff diff = DirDifference(v->direction, new_dir);
 
	if (diff == DIRDIFF_SAME) return;
 
@@ -3451,7 +3451,7 @@ static inline void AffectSpeedByDirChang
 
/** Modify the speed of the vehicle due to a change in altitude */
 
static inline void AffectSpeedByZChange(Vehicle *v, byte old_z)
 
{
 
	if (old_z == v->z_pos || _settings_game.vehicle.realistic_acceleration) return;
 
	if (old_z == v->z_pos || _settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL) return;
 

	
 
	const RailtypeSlowdownParams *rsp = &_railtype_slowdown[v->u.rail.railtype];
 

	
src/vehicle_gui.cpp
Show inline comments
 
@@ -1425,7 +1425,7 @@ struct VehicleDetailsWindow : Window {
 
				SetDParam(1, v->u.rail.cached_power);
 
				SetDParam(0, v->u.rail.cached_weight);
 
				SetDParam(3, v->u.rail.cached_max_te / 1000);
 
				DrawString(2, 25, (_settings_game.vehicle.realistic_acceleration && v->u.rail.railtype != RAILTYPE_MAGLEV) ?
 
				DrawString(2, 25, (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && v->u.rail.railtype != RAILTYPE_MAGLEV) ?
 
					STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :
 
					STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING);
 
				break;
src/vehicle_type.h
Show inline comments
 
@@ -61,4 +61,9 @@ enum {
 
	MAX_LENGTH_VEHICLE_NAME_PIXELS = 150, ///< The maximum length of a vehicle name in pixels
 
};
 

	
 
enum TrainAccelerationModel {
 
	TAM_ORIGINAL,
 
	TAM_REALISTIC,
 
};
 

	
 
#endif /* VEHICLE_TYPE_H */
0 comments (0 inline, 0 general)