mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r7385) -Fix: FS#418 Deleting Train in depot with autoreplace failes
This turned out to be due to continue to drag the old vehicle, that autoreplace sold This could also be triggered if more than one player used the same company Now deleting a vehicle will remove all depot highlights of that vehicle
This commit is contained in:
parent
a9ea304121
commit
686a0d7750
2
depot.h
2
depot.h
|
@ -107,4 +107,6 @@ Depot *GetDepotByTile(TileIndex tile);
|
|||
void InitializeDepots(void);
|
||||
Depot *AllocateDepot(void);
|
||||
|
||||
void DeleteDepotHighlightOfVehicle(const Vehicle *v);
|
||||
|
||||
#endif /* DEPOT_H */
|
||||
|
|
18
depot_gui.c
18
depot_gui.c
|
@ -1033,3 +1033,21 @@ void ShowDepotWindow(TileIndex tile, byte type)
|
|||
ResizeDepotButtons(w);
|
||||
}
|
||||
}
|
||||
|
||||
/** Removes the highlight of a vehicle in a depot window
|
||||
* @param *v Vehicle to remove all highlights from
|
||||
*/
|
||||
void DeleteDepotHighlightOfVehicle(const Vehicle *v)
|
||||
{
|
||||
Window* const *wz;
|
||||
|
||||
FOR_ALL_WINDOWS(wz) {
|
||||
const Window *w = *wz;
|
||||
if (w->window_class != WC_VEHICLE_DEPOT) continue;
|
||||
if (w->window_number != v->tile) continue;
|
||||
if (WP(w, depot_d).sel == v->index) {
|
||||
WP(w, depot_d).sel = INVALID_VEHICLE;
|
||||
ResetObjectToPlace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue