(svn r2982) Newgrf: Added patch option for wagon speed limits. This is enabled by default.
authorpeter1138
Sat, 24 Sep 2005 13:56:39 +0000
changeset 2456 93041d70867b
parent 2455 8d6d990d55f8
child 2457 faff3e4bf4bf
(svn r2982) Newgrf: Added patch option for wagon speed limits. This is enabled by default.
lang/english.txt
newgrf.c
settings.c
settings_gui.c
train_cmd.c
train_gui.c
variables.h
--- a/lang/english.txt	Sat Sep 24 06:43:26 2005 +0000
+++ b/lang/english.txt	Sat Sep 24 13:56:39 2005 +0000
@@ -1017,6 +1017,7 @@
 STR_CONFIG_PATCHES_SERVINT_SHIPS                                :{LTBLUE}Default service interval for ships: {ORANGE}{STRING1} days/%
 STR_CONFIG_PATCHES_SERVINT_SHIPS_DISABLED                       :{LTBLUE}Default service interval for ships: {ORANGE}disabled
 STR_CONFIG_PATCHES_NOSERVICE                                    :{LTBLUE}Disable servicing when breakdowns set to none: {ORANGE}{STRING1}
+STR_CONFIG_PATCHES_WAGONSPEEDLIMITS                             :{LTBLUE}Enable wagon speed limits: {ORANGE}{STRING1}
 
 STR_CONFIG_PATCHES_COLORED_NEWS_DATE                            :{LTBLUE}Coloured news appears in: {ORANGE}{STRING1}
 STR_CONFIG_PATCHES_STARTING_DATE                                :{LTBLUE}Starting date: {ORANGE}{STRING1}
--- a/newgrf.c	Sat Sep 24 06:43:26 2005 +0000
+++ b/newgrf.c	Sat Sep 24 13:56:39 2005 +0000
@@ -2187,7 +2187,8 @@
 
 	_ttdpatch_flags[2] = (1 << 0x0D)  /* buildonslopes */
 	                   | (1 << 0x16)  /* canals */
-	                   | (1 << 0x17); /* newstartyear */
+	                   | (1 << 0x17)  /* newstartyear */
+	                   | (_patches.wagon_speed_limits ? (1 << 0x1D) : 0); /* wagonspeedlimits */
 }
 
 static void InitNewGRFFile(const char* filename, int sprite_offset)
--- a/settings.c	Sat Sep 24 06:43:26 2005 +0000
+++ b/settings.c	Sat Sep 24 13:56:39 2005 +0000
@@ -889,6 +889,7 @@
 	{"nonuniform_stations",	SDT_BOOL,		(void*)true,	&_patches.nonuniform_stations,	NULL},
 	{"always_small_airport",SDT_BOOL,		(void*)false,	&_patches.always_small_airport,	NULL},
 	{"realistic_acceleration",SDT_BOOL, (void*)false,	&_patches.realistic_acceleration,	NULL},
+	{"wagon_speed_limits",  SDT_BOOL,   (void*)true,  &_patches.wagon_speed_limits,   NULL},
 	{"forbid_90_deg",				SDT_BOOL, 	(void*)false, &_patches.forbid_90_deg,					NULL},
 	{"improved_load",				SDT_BOOL,		(void*)false,	&_patches.improved_load,				NULL},
 
--- a/settings_gui.c	Sat Sep 24 06:43:26 2005 +0000
+++ b/settings_gui.c	Sat Sep 24 13:56:39 2005 +0000
@@ -721,6 +721,7 @@
 	{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, "servint_aircraft", &_patches.servint_aircraft, 5,800,  5, &InValidateDetailsWindow},
 	{PE_UINT16, PF_0ISDIS, STR_CONFIG_PATCHES_SERVINT_SHIPS,		"servint_ships",    &_patches.servint_ships,		5,800,  5, &InValidateDetailsWindow},
 	{PE_BOOL,   0,         STR_CONFIG_PATCHES_NOSERVICE,        "no_servicing_if_no_breakdowns", &_patches.no_servicing_if_no_breakdowns, 0, 0, 0, NULL},
+	{PE_BOOL,   0, STR_CONFIG_PATCHES_WAGONSPEEDLIMITS, "wagon_speed_limits", &_patches.wagon_speed_limits, 0, 0, 0, NULL},
 };
 
 static const PatchEntry _patches_stations[] = {
--- a/train_cmd.c	Sat Sep 24 06:43:26 2005 +0000
+++ b/train_cmd.c	Sat Sep 24 13:56:39 2005 +0000
@@ -113,8 +113,9 @@
 		}
 
 		// max speed is the minimum of the speed limits of all vehicles in the consist
-		if (rvi_u->max_speed != 0 && !UsesWagonOverride(u))
-			max_speed = min(rvi_u->max_speed, max_speed);
+		if (!(rvi_u->flags & RVI_WAGON) || _patches.wagon_speed_limits)
+			if (rvi_u->max_speed != 0 && !UsesWagonOverride(u))
+				max_speed = min(rvi_u->max_speed, max_speed);
 
 		// check the vehicle length (callback)
 		veh_len = CALLBACK_FAILED;
--- a/train_gui.c	Sat Sep 24 06:43:26 2005 +0000
+++ b/train_gui.c	Sat Sep 24 13:56:39 2005 +0000
@@ -111,7 +111,7 @@
 	y += 10;
 
 	/* Wagon speed limit, displayed if above zero */
-	if (rvi->max_speed > 0) {
+	if (rvi->max_speed > 0 && _patches.wagon_speed_limits) {
 		SetDParam(0, rvi->max_speed * 10 >> 4);
 		DrawString(x,y, STR_PURCHASE_INFO_SPEED, 0);
 		y += 10;
--- a/variables.h	Sat Sep 24 06:43:26 2005 +0000
+++ b/variables.h	Sat Sep 24 13:56:39 2005 +0000
@@ -115,6 +115,7 @@
 	bool nonuniform_stations;// allow nonuniform train stations
 	bool always_small_airport; // always allow small airports
 	bool realistic_acceleration; // realistic acceleration for trains
+	bool wagon_speed_limits; // enable wagon speed limits
 	bool forbid_90_deg; // forbid trains to make 90 deg turns
 	bool invisible_trees; // don't show trees when buildings are transparent
 	bool no_servicing_if_no_breakdowns; // dont send vehicles to depot when breakdowns are disabled