(svn r3353) Simplify the automatic length adjustment algorithm for replacing trains: Use the length of the train before the replacement as reference length

pull/155/head
tron 19 years ago
parent 901068fd6e
commit ed4b89ee36

@ -2759,7 +2759,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Seleccio
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Exibe o tipo de motor que substituirá o que está seleccionado à esquerda, se algum
STR_REPLACE_HELP :{BLACK}Permite a substiuição de um tipo de motor por outro, quando comboios do tipo original entram num depósito
STR_REPLACE_REMOVE_WAGON :{BLACK}Remoção de vagões: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Ativar essa opção fará com que a auto-reposição remova vagões dos trens, para que eles tenham o comprimento da menor estação em sua rota{}Ela removerá quantos vagões forem necessários, começando pelo da frente
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Lista de sinais - {COMMA} Sinais

@ -2757,7 +2757,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Tria el
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Mosyta quin motor dels seleccionats a l'esquerra es reemplaça, si hi ha
STR_REPLACE_HELP :{BLACK}Et permet reemplaçar un tipus de motor amb un altre, quan els trens del tipus original entrin a cotxeres
STR_REPLACE_REMOVE_WAGON :{BLACK}Treure vagons: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Establint aixó a "On" farà que l'automodificació tregui vagons dels trens per evitar que excedeixi la seva llargària de la de l'estació més curta que es trobi a les seves ordres.{}Es treuràn tants vagons com es necessiti començant per davant
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Llista de senyals - {COMMA} Senyals

@ -2812,7 +2812,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Vyber ty
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Tady je zobrazeno, za jakou lokomotivu se ta v levém seznamu vymenuje
STR_REPLACE_HELP :{BLACK}Tato mo¸nost hry ti umoznuje vybrat typ lokomotivy, který nechá vymenit za jiný. To se bude automaticky provadet, kdy¸ lokomotiva zajede do depa.
STR_REPLACE_REMOVE_WAGON :{BLACK}Odebírání vagonu: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Nastavením na "zapnuto" zacne funkce automatického vymenovani odstranovat vagony z vlaku, kdyby se neve¨ly do nejkrat¨í stanice ve svém jízdním radu.{}Bude od zacatku vlaku odstranovat tolik vagonu, kolik potrebuje.
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Seznam popisku - {COMMA} popis{P ek ky ku}

@ -2753,7 +2753,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}V
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Viser hvilket køretøj at det valgte køretøj til venstre bliver udskiftet med, hvis det bliver udskiftet
STR_REPLACE_HELP :{BLACK}Dette giver dig mulighed for at udskifte en køretøjstype med en anden, når et køretøj af den oprindelige type kører i depot
STR_REPLACE_REMOVE_WAGON :{BLACK}Fjern vogn: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Ved at sætte dette til "Til" vil få autoreplace til at fjerne vogne fra tog for at få dem til at beholde deres længde hvis de overskrider længden af den korteste station i deres ordre{}Det vil fjerne så mange vogne som der er behov for, startende med de forreste
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Liste of skilte - {COMMA} Skilte

@ -2756,7 +2756,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Selectee
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Dit geeft weer waarmee de aan de linkerkant geselecteerde locomotief mee vervangen wordt
STR_REPLACE_HELP :{BLACK}Deze optie stelt je in staat om een type locomotief te selecteren en die te vervangen door een andere. Dit zal automatisch gebeuren zodra de voertuigen een depot inrijden
STR_REPLACE_REMOVE_WAGON :{BLACK}Wagons verwijderen: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Deze optie "Aan" zetten zorgt ervoor dat de autoreplace functie wagons van je trein afhaalt zodat ze in je korste station passen in hun orders lijst,{}waarbij wordt begonnen bij de eerste wagons
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Bordjes lijst - {COMMA} Bordjes

@ -2759,7 +2759,7 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Choose t
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Displays which engine the left selected engine is being replaced with, if any
STR_REPLACE_HELP :{BLACK}This allows you to replace one engine type with another type, when trains of the original type enter a depot
STR_REPLACE_REMOVE_WAGON :{BLACK}Wagon removal: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Setting this to "On" will make autoreplace remove wagons from trains to make them keep their length if they exceed length of the shortest station in their orders.{}It will remove as many wagons as needed starting from the front
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Make autoreplace keep the length of a train the same by removing wagons (starting at the front), if replacing the engine would make the train longer.
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Sign List - {COMMA} Sign{P "" s}

@ -2760,7 +2760,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Choisir
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Ceci affiche par quelle locomotive celle qui est sélectionnée à gauche sera remplacée
STR_REPLACE_HELP :{BLACK}Cette caractéristique permet de choisir un type de locomotive et de le remplacer par un autre. Ceci sera fait automatiquement quand le véhicule rentre dans un dépôt
STR_REPLACE_REMOVE_WAGON :{BLACK}Retrait de wagon: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Activer ce paramètre permettra à l'autoremplacement de retirer des wagons d'un trains, ajustant ainsi sa longueur sur la plus courte station cédulée, advenant le cas d'une longueur excédentaire.{}Autant de wagons que requis seront retirés du train, en commencant par celui de tête.
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Liste des panneaux - {COMMA} panneau{P "" x}

@ -2760,7 +2760,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}W
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Hier wird angezeigt, gegen welches Fahrzeug das auf der linken Seite gewählte ersetzt wird
STR_REPLACE_HELP :{BLACK}Dieses Feature ermöglicht es, einen Fahrzeugtyp auszuwählen und ihn durch einen anderen ersetzen zu lassen. Dies geschieht automatisch, wenn das Fahrzeug regulär das Depot besucht.
STR_REPLACE_REMOVE_WAGON :{BLACK}Waggon-Entfernung: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Diesen Schalter auf "An" schalten bewirkt das Entfernen von Waggons aus dem Zug, damit er nie länger wird als der kürzeste Bahnsteig im Fahrplan.{}Die Waggons werden am Anfang des Zuges entfernt, bis die Länge ausreichend ist.
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Schilderliste - {COMMA} Schild{P "" er}

@ -2758,7 +2758,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Selezion
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Mostra con quale locomotore verrà rimpiazzato il tipo selezionato a sinistra, se alcuno
STR_REPLACE_HELP :{BLACK}Permette di rimpiazzare un locomotere con uno di un'altro tipo, quando il treno entra in un deposito
STR_REPLACE_REMOVE_WAGON :{BLACK}Rimuovi vagoni: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Impostando "SI", quando viene eseguita la sostituzione automatica dei treni verranno rimossi i vagoni fino a raggiungere la lunghezza necessaria al treno per entrare nella stazione più corta presente nella lista ordini. I vagoni verranno rimossi partendo dalla testa del treno.
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Lista dei Cartelli - {COMMA} Cartelli

@ -2754,7 +2754,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Velg jer
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Dette viser hvilket lokomotiv som overtar for det valgte lokomotivet på venstresiden
STR_REPLACE_HELP :{BLACK}Dette verktøyet lar deg bytte ut en type lokomotiv med en annen. Dette blir gjort neste gang lokomotivet er innom et depot.
STR_REPLACE_REMOVE_WAGON :{BLACK}Vognfjerning: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Ved å sette denne til "På" gjør du slik at auto-erstatt fjerner vogner fra tog slik at de beholder lengden hvis det er lenger enn den korteste stasjonen på ruten sin.{}Det vil fjerne så mange stasjoner som nødvending, og starter fra fronten jobber seg bakover
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Skiltliste - {COMMA} Skilt

@ -2759,7 +2759,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Wybierz
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Wyswietla typ pojazdu na jaki bedzie zastapiony pojazd zaznaczony po lewej stronie
STR_REPLACE_HELP :{BLACK}Ta funkcja pozwala wybrac typ pojazdu i zastapic go innym. Bedzie sie to odbywac w momencie gdy pociag zjedzie do zajezdni
STR_REPLACE_REMOVE_WAGON :{BLACK}Usuniecie pojazdu: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Ustawienie na "Wla" spowoduje ze tryb autowymiany usunie wagony z pociagu by utrzymac jego dlugosc jaka jest potrzebna do najkrotszej stacji w swoim rozkladzie.{}Usuniete beda wagony poczawszy od poczatku pociagu
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Lista tablic - {COMMA} Tablice

@ -2759,7 +2759,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Seleccio
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Exibe o tipo de motor que substituirá o que está seleccionado à esquerda, se algum
STR_REPLACE_HELP :{BLACK}Permite a substiuição de um tipo de motor por outro, quando comboios do tipo original entram num depósito
STR_REPLACE_REMOVE_WAGON :{BLACK}Remover vagões: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Ligar esta opção fará com que a funcionalidade de substituição automática remova vagões aos comboios, obrigando-os a manter o seu comprimento igual ao da menor estação presente nas ordens.{}Serão removidos tantos vagões quantos necessários, a começar pela frente.
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Lista de sinais - {COMMA} Sinais

@ -2756,7 +2756,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Alege un
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Afiseaza cu ce model vor fi inlocuite vehiculele din stanga
STR_REPLACE_HELP :{BLACK}Aceasta functie iti permite sa selectezi un model de vehicul si sa-l inlocuiesti cu altul. Schimbarea se va efectua automat la intrarea vehiculului intr-un depou.
STR_REPLACE_REMOVE_WAGON :{BLACK}Retragere vagoane: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Prin comutarea acestui buton autoinlocuirea va sterge vagoane din componenta unui tren pentru a nu depasi marimea celei mai mici statii de pe traseu.{}Vor fi sterse toate vagoanele necesare incepand de la locomotiva
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Lista de semne - {COMMA} Semne

@ -2758,7 +2758,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Vyber ty
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Tu sa zobrazuje, za ktoru lokomotiva sa lokomotiva v lavom zozname zamenuje
STR_REPLACE_HELP :{BLACK}Umoznuje vybrat typ lokomotivy, ktory automaticky sa zameni za iny typ, ak vlaky s takouto lokomotivou sa zastavia v depe
STR_REPLACE_REMOVE_WAGON :{BLACK}Odstranenie vagonu: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Pri nastaveni na "On" odstani vagony z vlakov, aby sa vosli do najkratsej stanice zo stanic v jeho prikazoch.{}Odstrani to pozadovany pocet vagonov, pocinajuc prvym
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Zoznam popisov - {COMMA} popisov

@ -2756,7 +2756,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Seleccio
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Muestra que locomotora será reemplazada
STR_REPLACE_HELP :{BLACK}Esta función permite seleccionar un tipo de locomotora y reemplazarla por otra. El cambio se realizará cuando el vehículo llegue al depósito
STR_REPLACE_REMOVE_WAGON :{BLACK}Quitar vagón: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Activar esta opción permite eliminar los vagones necesarios para que los trenes entren en las estaciones más cortas que estén marcadas en sus ordenes. Se eliminarán los vagones necesarios empezando por delante
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Lista de señales - {COMMA} Señales

@ -2759,7 +2759,6 @@ STR_REPLACE_HELP_RAILTYPE :{BLACK}Lokomati
STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Soldaki degistiriliyorsa neyle degistirildigini göster
STR_REPLACE_HELP :{BLACK}Tren gara girdiginde seçilen türle degistirilir
STR_REPLACE_REMOVE_WAGON :{BLACK}Vagon kaldirma: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Bu ayari "açik" yaparsaniz araçlari degistirme isleminde eger trenin talimatlarindaki duraklardan birine sigmayacak kadar uzuyorsa tren uzunlugu korunacaktir.{}Fazla vagonlar önden baslayarak satilacaktir
STR_SHORT_DATE :{WHITE}{DATE_TINY}
STR_SIGN_LIST_CAPTION :{WHITE}Tabela Listesi - {COMMA} Tabela

@ -1263,21 +1263,13 @@ bool AfterLoadGame(uint version)
}
}
/* In version 16.1 of the savegame, trains became aware of station lengths
need to initialized to the invalid state
players needs to set renew_keep_length too */
/* In version 16.1 of the savegame a player can decide if trains, which get
* replaced, shall keep their old length. In all prior versions, just default
* to false */
if (CheckSavegameVersionOldStyle(16, 1)) {
Vehicle *v;
FOR_ALL_PLAYERS(p) {
p->renew_keep_length = false;
}
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_Train) {
v->u.rail.shortest_platform[0] = 255;
v->u.rail.shortest_platform[1] = 0;
}
}
}
/* In version 17, ground type is moved from m2 to m4 for depots and

@ -386,7 +386,6 @@ int32 CmdInsertOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
}
/* Update any possible open window of the vehicle */
InvalidateVehicleOrder(u);
if (u->type == VEH_Train) u->u.rail.shortest_platform[1] = 0; // we changed the orders so we invalidate the station length collector
u = u->next_shared;
}
@ -517,7 +516,6 @@ int32 CmdSkipOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (v->current_order.type == OT_LOADING && HASBIT(v->current_order.flags, OFB_NON_STOP))
v->current_order.flags = 0;
if (v->type == VEH_Train) v->u.rail.shortest_platform[1] = 0; // we changed the orders so we invalidate the station length collector
InvalidateVehicleOrder(v);
}
@ -660,7 +658,6 @@ int32 CmdCloneOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
InvalidateVehicleOrder(src);
RebuildVehicleLists();
if (dst->type == VEH_Train) dst->u.rail.shortest_platform[1] = 0; // we changed the orders so we invalidate the station length collector
}
} break;
@ -720,7 +717,6 @@ int32 CmdCloneOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
InvalidateVehicleOrder(dst);
RebuildVehicleLists();
if (dst->type == VEH_Train) dst->u.rail.shortest_platform[1] = 0; // we changed the orders so we invalidate the station length collector
}
} break;

@ -248,11 +248,6 @@ static inline bool IsBuoyTile(TileIndex tile)
return IsTileType(tile, MP_STATION) && _m[tile].m5 == 0x52;
}
static inline bool TileBelongsToRailStation(const Station *st, TileIndex tile)
{
return IsTileType(tile, MP_STATION) && _m[tile].m2 == st->index && _m[tile].m5 < 8;
}
/* Get's the direction the station exit points towards. Ie, returns 0 for a
* station with the exit NE. */
static inline byte GetRoadStationDir(TileIndex tile)

@ -1065,6 +1065,11 @@ int32 CmdBuildRailroadStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
return cost;
}
static bool TileBelongsToRailStation(const Station *st, TileIndex tile)
{
return IsTileType(tile, MP_STATION) && _m[tile].m2 == st->index && _m[tile].m5 < 8;
}
static void MakeRailwayStationAreaSmaller(Station *st)
{
uint w = st->trainst_w;

@ -755,9 +755,6 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
SetFrontEngine(v);
SetTrainEngine(v);
v->u.rail.shortest_platform[0] = 255;
v->u.rail.shortest_platform[1] = 0;
VehiclePositionChanged(v);
if (rvi->flags & RVI_MULTIHEAD) {
@ -2427,27 +2424,6 @@ static bool ProcessTrainOrder(Vehicle *v)
v->dest_tile = 0;
// store the station length if no shorter station was visited this order round
if (v->cur_order_index == 0) {
if (v->u.rail.shortest_platform[1] != 0 && v->u.rail.shortest_platform[1] != 255) {
// we went though a whole round of orders without interruptions, so we store the length of the shortest station
v->u.rail.shortest_platform[0] = v->u.rail.shortest_platform[1];
}
// all platforms are shorter than 255, so now we can find the shortest in the next order round. They might have changed size
v->u.rail.shortest_platform[1] = 255;
}
if (v->last_station_visited != INVALID_STATION) {
Station *st = GetStation(v->last_station_visited);
if (TileBelongsToRailStation(st, v->tile)) {
byte length = GetStationPlatforms(st, v->tile);
if (length < v->u.rail.shortest_platform[1]) {
v->u.rail.shortest_platform[1] = length;
}
}
}
result = false;
switch (order->type) {
case OT_GOTO_STATION:

@ -1656,8 +1656,6 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags)
if (GetNextVehicle(old_v) != NULL) {
DoCommand(0, 0, (new_v->index << 16) | GetNextVehicle(old_v)->index, 1, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
}
new_v->u.rail.shortest_platform[0] = old_v->u.rail.shortest_platform[0];
new_v->u.rail.shortest_platform[1] = old_v->u.rail.shortest_platform[1];
}
}
/* We are done setting up the new vehicle. Now we move the cargo from the old one to the new one */
@ -1701,7 +1699,10 @@ static void MaybeReplaceVehicle(Vehicle *v)
byte flags = 0;
int32 cost, temp_cost = 0;
bool stopped = false;
bool train_fits_in_station = false;
/* Remember the length in case we need to trim train later on
* If it's not a train, the value is unused */
uint16 old_total_length = (v->type == VEH_Train) ? v->u.rail.cached_total_length : -1;
_current_player = v->owner;
@ -1715,11 +1716,6 @@ static void MaybeReplaceVehicle(Vehicle *v)
stopped = true;
}
if (v->type == VEH_Train && v->u.rail.shortest_platform[0]*16 <= v->u.rail.cached_total_length && GetPlayer(v->owner)->renew_keep_length) {
// the train is not too long for the stations it visits. We should try to keep it that way if we change anything
train_fits_in_station = true;
}
for (;;) {
cost = 0;
w = v;
@ -1781,11 +1777,12 @@ static void MaybeReplaceVehicle(Vehicle *v)
flags |= DC_EXEC;
}
if (train_fits_in_station) {
// the train fitted in the stations it got in it's orders, so we should make sure that it still do
/* If setting is on to try not to exceed the old length of the train with the replacement */
if (v->type == VEH_Train && p->renew_keep_length) {
Vehicle *temp;
w = v;
while (v->u.rail.shortest_platform[0]*16 < v->u.rail.cached_total_length) {
while (v->u.rail.cached_total_length > old_total_length) {
// the train is too long. We will remove cars one by one from the start of the train until it's short enough
while (w != NULL && !(RailVehInfo(w->engine_type)->flags&RVI_WAGON) ) {
w = GetNextVehicle(w);
@ -2094,8 +2091,9 @@ static const SaveLoad _train_desc[] = {
SLE_CONDVARX(offsetof(Vehicle,u)+offsetof(VehicleRail,pbs_status), SLE_UINT8, 2, 255),
SLE_CONDVARX(offsetof(Vehicle,u)+offsetof(VehicleRail,pbs_end_tile), SLE_UINT32, 2, 255),
SLE_CONDVARX(offsetof(Vehicle,u)+offsetof(VehicleRail,pbs_end_trackdir), SLE_UINT8, 2, 255),
SLE_CONDVARX(offsetof(Vehicle,u)+offsetof(VehicleRail,shortest_platform[0]), SLE_UINT8, 2, 255), // added with 16.1, but was blank since 2
SLE_CONDVARX(offsetof(Vehicle,u)+offsetof(VehicleRail,shortest_platform[1]), SLE_UINT8, 2, 255), // added with 16.1, but was blank since 2
SLE_CONDARR(NullStruct, null, SLE_FILE_U8 | SLE_VAR_NULL, 2, 2, 255),
SLE_CONDREFX(offsetof(Vehicle,u)+offsetof(VehicleRail,other_multiheaded_part), REF_VEHICLE, 2, 255), // added with 17.1, but was blank since 2
// reserve extra space in savegame here. (currently 3 bytes)
SLE_CONDARR(NullStruct,null,SLE_FILE_U8 | SLE_VAR_NULL, 3, 2, 255),

@ -78,14 +78,6 @@ typedef struct VehicleRail {
TileIndex pbs_end_tile;
Trackdir pbs_end_trackdir;
/**
* stuff to figure out how long a train should be. Used by autoreplace
* first byte holds the length of the shortest station. Updated each time order 0 is reached
* last byte is the shortest station reached this round though the orders. It can be invalidated by
* skip station and alike by setting it to 0. That way we will ensure that a complete loop is used to find the shortest station
*/
byte shortest_platform[2];
// Link between the two ends of a multiheaded engine
Vehicle *other_multiheaded_part;
} VehicleRail;

@ -747,10 +747,10 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
STR_019E_SHIP,
STR_019D_AIRCRAFT
};
const Player *p = GetPlayer(_local_player);
switch (e->event) {
case WE_PAINT: {
const Player *p = GetPlayer(_local_player);
int pos = w->vscroll.pos;
EngineID selected_id[2] = { INVALID_ENGINE, INVALID_ENGINE };
int x = 1;
@ -934,7 +934,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
break;
}
case 17: { /* toggle renew_keep_length */
DoCommandP(0, 5, p->renew_keep_length ? 0 : 1, NULL, CMD_REPLACE_VEHICLE);
DoCommandP(0, 5, GetPlayer(_local_player)->renew_keep_length ? 0 : 1, NULL, CMD_REPLACE_VEHICLE);
} break;
case 4: { /* Start replacing */
EngineID veh_from = WP(w, replaceveh_d).sel_engine[0];

Loading…
Cancel
Save