summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-09-24 13:56:39 +0000
committerpeter1138 <peter1138@openttd.org>2005-09-24 13:56:39 +0000
commitc02b1d555d36dbce487d2fc32fcef6e1cfd32964 (patch)
tree9c3c0f779426eef44c578e5eff9fd77c8efb5830
parent47de27ab69af44444e481bd867ee93ae3fd77eac (diff)
downloadopenttd-c02b1d555d36dbce487d2fc32fcef6e1cfd32964.tar.xz
(svn r2982) Newgrf: Added patch option for wagon speed limits. This is enabled by default.
-rw-r--r--lang/english.txt1
-rw-r--r--newgrf.c3
-rw-r--r--settings.c1
-rw-r--r--settings_gui.c1
-rw-r--r--train_cmd.c5
-rw-r--r--train_gui.c2
-rw-r--r--variables.h1
7 files changed, 10 insertions, 4 deletions
diff --git a/lang/english.txt b/lang/english.txt
index 348365b89..0a9b73049 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -1017,6 +1017,7 @@ STR_CONFIG_PATCHES_SERVINT_AIRCRAFT_DISABLED :{LTBLUE}Default
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}
diff --git a/newgrf.c b/newgrf.c
index 60ade0192..99d9fdc89 100644
--- a/newgrf.c
+++ b/newgrf.c
@@ -2187,7 +2187,8 @@ static void InitializeGRFSpecial(void)
_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)
diff --git a/settings.c b/settings.c
index 8cc0ddd97..9014900af 100644
--- a/settings.c
+++ b/settings.c
@@ -889,6 +889,7 @@ const SettingDesc patch_settings[] = {
{"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},
diff --git a/settings_gui.c b/settings_gui.c
index 228c54a75..b0c5f5011 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -721,6 +721,7 @@ static const PatchEntry _patches_vehicles[] = {
{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[] = {
diff --git a/train_cmd.c b/train_cmd.c
index 3fad0435a..e5b3f2b1b 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -113,8 +113,9 @@ void TrainConsistChanged(Vehicle *v) {
}
// 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;
diff --git a/train_gui.c b/train_gui.c
index 514d52183..3c02fa561 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -111,7 +111,7 @@ void DrawTrainWagonPurchaseInfo(int x, int y, EngineID engine_number)
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;
diff --git a/variables.h b/variables.h
index ec6cb8bfc..0eede15e5 100644
--- a/variables.h
+++ b/variables.h
@@ -115,6 +115,7 @@ typedef struct Patches {
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