mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r7195) -Feature: [FS#297, optional elrails] New patches/vehicles option 'disable electrified railways'.
(original patch by maedhros, ideas: peter1138, Darkvater, Rubidium, Patrick, Eddi|zuHause, ..)
This commit is contained in:
parent
532271ba65
commit
f2cda44d2e
57
elrail.c
57
elrail.c
|
@ -61,6 +61,9 @@
|
|||
#include "rail_map.h"
|
||||
#include "table/sprites.h"
|
||||
#include "table/elrail_data.h"
|
||||
#include "vehicle.h"
|
||||
#include "train.h"
|
||||
#include "gui.h"
|
||||
|
||||
static inline TLG GetTLG(TileIndex t)
|
||||
{
|
||||
|
@ -360,6 +363,8 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
|
|||
|
||||
void DrawCatenary(const TileInfo *ti)
|
||||
{
|
||||
if (_patches.disable_elrails) return;
|
||||
|
||||
switch (GetTileType(ti->tile)) {
|
||||
case MP_RAILWAY:
|
||||
if (IsRailDepot(ti->tile)) {
|
||||
|
@ -385,3 +390,55 @@ void DrawCatenary(const TileInfo *ti)
|
|||
}
|
||||
DrawCatenaryRailway(ti);
|
||||
}
|
||||
|
||||
int32 SettingsDisableElrail(int32 p1)
|
||||
{
|
||||
EngineID e_id;
|
||||
Vehicle* v;
|
||||
Player *p;
|
||||
bool disable = (p1 != 0);
|
||||
|
||||
/* we will now walk through all electric train engines and change their railtypes if it is the wrong one*/
|
||||
const RailType old_railtype = disable ? RAILTYPE_ELECTRIC : RAILTYPE_RAIL;
|
||||
const RailType new_railtype = disable ? RAILTYPE_RAIL : RAILTYPE_ELECTRIC;
|
||||
|
||||
/* walk through all train engines */
|
||||
for (e_id = 0; e_id < NUM_TRAIN_ENGINES; e_id++)
|
||||
{
|
||||
const RailVehicleInfo *rv_info = RailVehInfo(e_id);
|
||||
Engine *e = GetEngine(e_id);
|
||||
/* if it is an electric rail engine and its railtype is the wrong one */
|
||||
if (rv_info->engclass == 2 && e->railtype == old_railtype) {
|
||||
/* change it to the proper one */
|
||||
e->railtype = new_railtype;
|
||||
}
|
||||
}
|
||||
|
||||
/* when disabling elrails, make sure that all existing trains can run on
|
||||
* normal rail too */
|
||||
if (disable) {
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (v->type == VEH_Train && v->u.rail.railtype == RAILTYPE_ELECTRIC) {
|
||||
/* this railroad vehicle is now compatible only with elrail,
|
||||
* so add there also normal rail compatibility */
|
||||
v->u.rail.compatible_railtypes |= (1 << RAILTYPE_RAIL);
|
||||
v->u.rail.railtype = RAILTYPE_RAIL;
|
||||
SETBIT(v->u.rail.flags, VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* setup total power for trains */
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
/* power is cached only for front engines */
|
||||
if (v->type == VEH_Train && IsFrontEngine(v)) TrainPowerChanged(v);
|
||||
}
|
||||
|
||||
FOR_ALL_PLAYERS(p) p->avail_railtypes = GetPlayerRailtypes(p->index);
|
||||
|
||||
/* This resets the _last_built_railtype, which will be invalid for electric
|
||||
* rails. It may have unintended consequences if that function is ever
|
||||
* extended, though. */
|
||||
ReinitGuiAfterToggleElrail(disable);
|
||||
return 0;
|
||||
}
|
||||
|
|
3
gui.h
3
gui.h
|
@ -35,9 +35,10 @@ void ShowLastNewsMessage(void);
|
|||
void ShowMessageOptions(void);
|
||||
void ShowMessageHistory(void);
|
||||
|
||||
/* traintoolb_gui.c */
|
||||
/* rail_gui.c */
|
||||
void ShowBuildRailToolbar(RailType railtype, int button);
|
||||
void PlaceProc_BuyLand(TileIndex tile);
|
||||
void ReinitGuiAfterToggleElrail(bool disable);
|
||||
|
||||
/* train_gui.c */
|
||||
void ShowTrainViewWindow(const Vehicle *v);
|
||||
|
|
|
@ -1140,7 +1140,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Jetplan
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Switch climate: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Change date: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Enable modifying production values: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Allow electric engines to run on normal rail
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Heading for {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Heading for {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1140,7 +1140,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Aviões
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Mudar de clima: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Alterar data: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Ativar modificação de valores de produção: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Permite Trens elétricos em trilho normal
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Dirigindo-se para {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Dirigindo-se para {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1140,7 +1140,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Els avi
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Canviar clima: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Canviar data: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Activar modificació de valors de producció: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Deixar que els trens elèctrics circulin per rails normals
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Cap a {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Cap a {WAYPOINT}, a {VELOCITY}
|
||||
|
|
|
@ -1197,7 +1197,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Letadla
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Zmenit podnebí: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Zmenit datum: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Povolit zmenu produkce prumyslu: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Povolit elektrickým lokomotivám vyjet na normální koleje
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Mirim do {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Mirim do {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1140,7 +1140,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Jetfly
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Skift klima: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Ændre dato: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Aktiver modifikation af produktion: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Tillad elektriske tog at køre på almindelige skinner
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Retning mod {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Retning mod {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1142,7 +1142,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Jetvlie
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Verander klimaat: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Verander datum: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Sta aanpassen productiewaarden toe: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Sta elektrische locomotieven toe op normale rails
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Op weg naar {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Op weg naar {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1095,6 +1095,7 @@ STR_CONFIG_PATCHES_SERVINT_SHIPS :{LTBLUE}Default
|
|||
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_DISABLE_ELRAILS :{LTBLUE}Disable electric rails: {ORANGE}{STRING1}
|
||||
|
||||
STR_CONFIG_PATCHES_COLORED_NEWS_YEAR :{LTBLUE}Coloured news appears in: {ORANGE}{STRING1}
|
||||
STR_CONFIG_PATCHES_STARTING_YEAR :{LTBLUE}Starting year: {ORANGE}{STRING1}
|
||||
|
@ -1143,7 +1144,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Jetplan
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Switch climate: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Change date: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Enable modifying production values: {ORANGE}{STRING1}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Allow electric engines to run on normal rail
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Heading for {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Heading for {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1197,7 +1197,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Reaktii
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Vaheta kliimat: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Muuda kuupäeva: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Luba muutuvad tootmisväärtused: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Luba elektrirongidel sõita tavalisel raudteel
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Suudub kontrollpunti: {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Suundub {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1140,7 +1140,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Suihkuk
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Vaihda ilmastoa: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Muuta päiväystä: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Muuntuvat tuotantoarvot: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Salli sähköveturien kulkeminen tavallisella rautatiellä.
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Kohde: {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Kohde: {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1141,7 +1141,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Les jet
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Changer de climat : {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Changer la date: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Permettre la modification des valeurs de production : {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Autoriser les locomotives électriques à circuler sur des voies non-électrifiées
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}En route pour {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}En route pour {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1141,7 +1141,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Flugzeu
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Wechsle Klima: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Ändere Datum: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Aktiviere Veränderung der Produktionswerte: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Erlaube E-Loks auf normalen Gleisen zu fahren
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Fahre zu {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Fahre zu {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1206,7 +1206,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Jet-rep
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Klíma változtatás: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Dátum módosítás: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}A nyersanyagüzemek termelése változtatható: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Közlekedhessenek elektromos mozdonyok hagyományos síneken
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Úton {WAYPOINT} felé
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Úton {WAYPOINT} felé, {VELOCITY}
|
||||
|
|
|
@ -1110,7 +1110,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Þotur
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Skipta um loftslag: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Breyta dagsetningu: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Leyfa breytingar á verðmæti framleiðslu: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Leyfa rafdrifnum lestum að nota venjuleg spor
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Á leiðinni til {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Á leiðinni til {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1142,7 +1142,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}I jet n
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Cambia paesaggio: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Cambia data: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Permetti la modifica dei valori di produzione: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Permetti l'uso di locomotori elettrici sui binari normali
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Direzione {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Direzione {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1137,7 +1137,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Jetfly
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Bytt klima: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Bytt dato: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Tillat endring av produksjonsmengder: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Tillat elektriske lokomotiv å kjøre på vanlige skinner
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Har kurs mot {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Har kurs mot {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1227,7 +1227,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Odrzuto
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Zmien klimat: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Zmien date: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Pozwol modyfikowac wielkosc produkcji przedsiebiorstw: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Pozwol lokomotywom elektrycznym pracowac na zwyklych torach
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Zmierza do {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Zmierza do {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1140,7 +1140,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Aviões
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Mudar de clima: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Alterar data: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Activar modificação de valores de produção: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Permitir comboios eléctricos em carris normais
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Dirige-se a {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Dirige-se a {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1106,7 +1106,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Avioane
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Schimbã peisajul: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Schimbã data: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Activeaza accesul la valorile de productie: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Permite motoarealor electrice sã ruleze pe sine normale
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Merge spre {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Merge spre {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1206,7 +1206,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Prudove
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Zmenit klimu: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Zmenit datum: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Povolit zmenu objemu vyroby: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Umoznit pouzitie el. rusnov na normalnych tratiach
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Smeruje do {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Smeruje do {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1141,7 +1141,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Los Jet
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Cambiar clima: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Cambiar fecha: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Activar modificación de los valores de producción: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Permitir locomotoras eléctricas sobre railes normales
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Hacia {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Hacia {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1140,7 +1140,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Jetplan
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}Byt klimat: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Byt datum: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Aktivera modifierande produceringsvärden: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Tillåt elektriska lok att använda vanlig räls
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}På väg mot {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}På väg mot {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -1139,7 +1139,6 @@ STR_CHEAT_NO_JETCRASH :{LTBLUE}Jetler
|
|||
STR_CHEAT_SWITCH_CLIMATE :{LTBLUE}iklimi degistir: {ORANGE} {STRING}
|
||||
STR_CHEAT_CHANGE_DATE :{LTBLUE}Tarihi degistir: {ORANGE} {DATE_SHORT}
|
||||
STR_CHEAT_SETUP_PROD :{LTBLUE}Üretim degerlerini degistir: {ORANGE}{STRING}
|
||||
STR_CHEAT_ALLOW_CONVRAIL :{LTBLUE}Elektrikli trenler normal raylarda da gidebilsin
|
||||
|
||||
STR_HEADING_FOR_WAYPOINT :{LTBLUE}Gidiyor -> {WAYPOINT}
|
||||
STR_HEADING_FOR_WAYPOINT_VEL :{LTBLUE}Gidiyor -> {WAYPOINT}, {VELOCITY}
|
||||
|
|
|
@ -46,7 +46,7 @@ static int _rename_id;
|
|||
static int _rename_what;
|
||||
|
||||
static byte _terraform_size = 1;
|
||||
static RailType _last_built_railtype;
|
||||
RailType _last_built_railtype;
|
||||
static int _scengen_town_size = 2; // depress medium-sized towns per default
|
||||
|
||||
extern void GenerateIndustries(void);
|
||||
|
@ -2448,3 +2448,4 @@ void InitializeMainGui(void)
|
|||
/* Clean old GUI values */
|
||||
_last_built_railtype = 0;
|
||||
}
|
||||
|
||||
|
|
13
misc_gui.c
13
misc_gui.c
|
@ -1682,18 +1682,6 @@ static int32 ClickChangeDateCheat(int32 p1, int32 p2)
|
|||
return _cur_year;
|
||||
}
|
||||
|
||||
static int32 ClickAllowConvrail(int32 p1, int32 p2)
|
||||
{
|
||||
Vehicle *v;
|
||||
SB(_railtypes[RAILTYPE_ELECTRIC].powered_railtypes, RAILTYPE_RAIL, 1, p1);
|
||||
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (v->type == VEH_Train && IsFrontEngine(v)) TrainConsistChanged(v);
|
||||
}
|
||||
return p1;
|
||||
}
|
||||
|
||||
|
||||
typedef int32 CheckButtonClick(int32, int32);
|
||||
|
||||
enum ce_flags {CE_CLICK = 1 << 0};
|
||||
|
@ -1720,7 +1708,6 @@ static const CheatEntry _cheats_ui[] = {
|
|||
{SLE_BOOL, 0, STR_CHEAT_SETUP_PROD, &_cheats.setup_prod.value, &_cheats.setup_prod.been_used, NULL, 0, 0},
|
||||
{SLE_UINT8, 0, STR_CHEAT_SWITCH_CLIMATE, &_opt.landscape, &_cheats.switch_climate.been_used, &ClickChangeClimateCheat,-1, 4},
|
||||
{SLE_INT32, 0, STR_CHEAT_CHANGE_DATE, &_cur_year, &_cheats.change_date.been_used, &ClickChangeDateCheat, -1, 1},
|
||||
{SLE_BOOL, 0, STR_CHEAT_ALLOW_CONVRAIL, &_cheats.elrail.value, &_cheats.elrail.been_used, &ClickAllowConvrail, 0, 0},
|
||||
};
|
||||
|
||||
|
||||
|
|
16
openttd.c
16
openttd.c
|
@ -606,6 +606,8 @@ static void MakeNewGameDone(void)
|
|||
_current_player = _local_player;
|
||||
DoCommandP(0, (_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
|
||||
|
||||
SettingsDisableElrail(_patches.disable_elrails);
|
||||
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
|
||||
|
@ -1536,5 +1538,19 @@ bool AfterLoadGame(void)
|
|||
ConvertNameArray();
|
||||
}
|
||||
|
||||
/* from version 38 we have optional elrails */
|
||||
if (CheckSavegameVersion(38)) {
|
||||
/* old game - before elrails made optional */
|
||||
if (CheckSavegameVersion(24)) {
|
||||
/* very old game - before elrail was introduced */
|
||||
_patches.disable_elrails = true; // disable elrails
|
||||
} else {
|
||||
/* game with mandatory elrails (r4150+) */
|
||||
_patches.disable_elrails = false; // enable elrails
|
||||
}
|
||||
}
|
||||
/* do the same as when elrails were enabled/disabled manually just now */
|
||||
SettingsDisableElrail(_patches.disable_elrails);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
3
rail.h
3
rail.h
|
@ -465,4 +465,7 @@ void DrawDefaultWaypointSprite(int x, int y, RailType railtype);
|
|||
void DrawCatenary(const TileInfo *ti);
|
||||
|
||||
uint GetRailFoundation(Slope tileh, TrackBits bits);
|
||||
|
||||
int32 SettingsDisableElrail(int32 p1); ///< _patches.disable_elrail callback
|
||||
|
||||
#endif /* RAIL_H */
|
||||
|
|
|
@ -883,6 +883,9 @@ static int32 DoConvertRail(TileIndex tile, RailType totype, bool exec)
|
|||
// tile is already of requested type?
|
||||
if (GetRailType(tile) == totype) return CMD_ERROR;
|
||||
|
||||
// 'hidden' elrails can't be downgraded to normal rail when elrails are disabled
|
||||
if (_patches.disable_elrails && totype == RAILTYPE_RAIL && GetRailType(tile) == RAILTYPE_ELECTRIC) return CMD_ERROR;
|
||||
|
||||
// change type.
|
||||
if (exec) {
|
||||
TrackBits tracks;
|
||||
|
|
18
rail_gui.c
18
rail_gui.c
|
@ -22,6 +22,7 @@
|
|||
#include "variables.h"
|
||||
#include "newgrf_callbacks.h"
|
||||
#include "newgrf_station.h"
|
||||
#include "train.h"
|
||||
|
||||
static RailType _cur_railtype;
|
||||
static bool _remove_button_clicked;
|
||||
|
@ -1150,3 +1151,20 @@ void InitializeRailGui(void)
|
|||
_railstation.platlength = 1;
|
||||
_railstation.dragdrop = true;
|
||||
}
|
||||
|
||||
void ReinitGuiAfterToggleElrail(bool disable)
|
||||
{
|
||||
extern RailType _last_built_railtype;
|
||||
if (disable && _last_built_railtype == RAILTYPE_ELECTRIC) {
|
||||
Window *w;
|
||||
_last_built_railtype = _cur_railtype = RAILTYPE_RAIL;
|
||||
w = FindWindowById(WC_BUILD_TOOLBAR, 0);
|
||||
if (w != NULL && w->wndproc == BuildRailToolbWndProc) {
|
||||
SetupRailToolbar(_cur_railtype, w);
|
||||
SetWindowDirty(w);
|
||||
}
|
||||
}
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -430,6 +430,9 @@ int32 DoConvertStreetRail(TileIndex tile, RailType totype, bool exec)
|
|||
|
||||
if (GetRailTypeCrossing(tile) == totype) return CMD_ERROR;
|
||||
|
||||
// 'hidden' elrails can't be downgraded to normal rail when elrails are disabled
|
||||
if (_patches.disable_elrails && totype == RAILTYPE_RAIL && GetRailTypeCrossing(tile) == RAILTYPE_ELECTRIC) return CMD_ERROR;
|
||||
|
||||
if (exec) {
|
||||
SetRailTypeCrossing(tile, totype);
|
||||
MarkTileDirtyByTile(tile);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "variables.h"
|
||||
#include <setjmp.h>
|
||||
|
||||
const uint16 SAVEGAME_VERSION = 37;
|
||||
const uint16 SAVEGAME_VERSION = 38;
|
||||
uint16 _sl_version; /// the major savegame version identifier
|
||||
byte _sl_minor_version; /// the minor savegame version, DO NOT USE!
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "newgrf.h"
|
||||
#include "genworld.h"
|
||||
#include "date.h"
|
||||
#include "rail.h"
|
||||
#ifdef WITH_FREETYPE
|
||||
#include "gfx.h"
|
||||
#include "fontcache.h"
|
||||
|
@ -1320,6 +1321,7 @@ const SettingDesc _patch_settings[] = {
|
|||
SDT_VAR(Patches, servint_aircraft, SLE_UINT16, 0,D0, 100, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, InValidateDetailsWindow),
|
||||
SDT_BOOL(Patches, no_servicing_if_no_breakdowns, 0, 0, false, STR_CONFIG_PATCHES_NOSERVICE, NULL),
|
||||
SDT_BOOL(Patches, wagon_speed_limits, 0, 0, true, STR_CONFIG_PATCHES_WAGONSPEEDLIMITS, NULL),
|
||||
SDT_CONDBOOL(Patches, disable_elrails, 38, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_PATCHES_DISABLE_ELRAILS, SettingsDisableElrail),
|
||||
|
||||
/***************************************************************************/
|
||||
/* Station section of the GUI-configure patches window */
|
||||
|
|
|
@ -646,6 +646,7 @@ static const char *_patches_vehicles[] = {
|
|||
"servint_aircraft",
|
||||
"no_servicing_if_no_breakdowns",
|
||||
"wagon_speed_limits",
|
||||
"disable_elrails",
|
||||
};
|
||||
|
||||
typedef struct PatchEntry {
|
||||
|
|
|
@ -1358,6 +1358,9 @@ int32 DoConvertStationRail(TileIndex tile, RailType totype, bool exec)
|
|||
|
||||
if (GetRailType(tile) == totype) return CMD_ERROR;
|
||||
|
||||
// 'hidden' elrails can't be downgraded to normal rail when elrails are disabled
|
||||
if (_patches.disable_elrails && totype == RAILTYPE_RAIL && GetRailType(tile) == RAILTYPE_ELECTRIC) return CMD_ERROR;
|
||||
|
||||
if (exec) {
|
||||
SetRailType(tile, totype);
|
||||
MarkTileDirtyByTile(tile);
|
||||
|
|
|
@ -192,6 +192,13 @@ void TrainConsistChanged(Vehicle* v)
|
|||
v->u.rail.compatible_railtypes |= GetRailTypeInfo(u->u.rail.railtype)->powered_railtypes;
|
||||
}
|
||||
|
||||
/* Some electric engines can be allowed to run on normal rail. It happens to all
|
||||
* existing electric engines when elrails are disabled and then re-enabled */
|
||||
if (HASBIT(u->u.rail.flags, VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL)) {
|
||||
u->u.rail.railtype = RAILTYPE_RAIL;
|
||||
u->u.rail.compatible_railtypes |= (1 << RAILTYPE_RAIL);
|
||||
}
|
||||
|
||||
// max speed is the minimum of the speed limits of all vehicles in the consist
|
||||
if (!(rvi_u->flags & RVI_WAGON) || _patches.wagon_speed_limits)
|
||||
if (rvi_u->max_speed != 0 && !UsesWagonOverride(u))
|
||||
|
|
|
@ -772,6 +772,9 @@ int32 DoConvertTunnelBridgeRail(TileIndex tile, RailType totype, bool exec)
|
|||
|
||||
if (GetRailType(tile) == totype) return CMD_ERROR;
|
||||
|
||||
// 'hidden' elrails can't be downgraded to normal rail when elrails are disabled
|
||||
if (_patches.disable_elrails && totype == RAILTYPE_RAIL && GetRailType(tile) == RAILTYPE_ELECTRIC) return CMD_ERROR;
|
||||
|
||||
endtile = CheckTunnelBusy(tile, &length);
|
||||
if (endtile == INVALID_TILE) return CMD_ERROR;
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ typedef struct Patches {
|
|||
bool no_servicing_if_no_breakdowns; // dont send vehicles to depot when breakdowns are disabled
|
||||
bool link_terraform_toolbar; // display terraform toolbar when displaying rail, road, water and airport toolbars
|
||||
bool reverse_scroll; // Right-Click-Scrolling scrolls in the opposite direction
|
||||
bool disable_elrails; // when true, the elrails are disabled
|
||||
bool measure_tooltip; // Show a permanent tooltip when dragging tools
|
||||
byte liveries; // Options for displaying company liveries, 0=none, 1=self, 2=all
|
||||
bool prefer_teamchat; // Choose the chat message target with <ENTER>, true=all players, false=your team
|
||||
|
@ -240,7 +241,7 @@ typedef struct Cheats {
|
|||
Cheat switch_climate;
|
||||
Cheat change_date; // changes date ingame
|
||||
Cheat setup_prod; // setup raw-material production in game
|
||||
Cheat elrail; // allow electric engines to be powered on conventional rail
|
||||
Cheat dummy; // empty cheat (enable running el-engines on normal rail)
|
||||
} Cheats;
|
||||
|
||||
VARDEF Cheats _cheats;
|
||||
|
|
Loading…
Reference in New Issue