diff options
author | rubidium <rubidium@openttd.org> | 2007-11-24 09:14:58 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-11-24 09:14:58 +0000 |
commit | 9a70ec1cb2e181c103f821aceed0a54e86132164 (patch) | |
tree | 6ef784ac42524a7c154d6527a0cc9535269746df /src | |
parent | 81c7ba42afd159490d09ada3551e49a04d576c9e (diff) | |
download | openttd-9a70ec1cb2e181c103f821aceed0a54e86132164.tar.xz |
(svn r11506) -Fix [FS#1471]: selling vehicles could cause the window of others to scroll to that location.
Diffstat (limited to 'src')
-rw-r--r-- | src/vehicle.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 960298870..85832a711 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -537,13 +537,10 @@ void Vehicle::PreDestructor() delete this->Next(); } - Window **wp; - FOR_ALL_WINDOWS(wp) { - Window *w = *wp; - if (w->viewport != NULL && WP(w, vp_d).follow_vehicle == this->index) { - ScrollMainWindowTo(this->x_pos, this->y_pos); // lock the main view on the vehicle's last position - WP(w, vp_d).follow_vehicle = INVALID_VEHICLE; - } + Window *w = FindWindowById(WC_VEHICLE_VIEW, this->index); + if (w != NULL && WP(w, vp_d).follow_vehicle == this->index) { + ScrollMainWindowTo(this->x_pos, this->y_pos); // lock the main view on the vehicle's last position + WP(w, vp_d).follow_vehicle = INVALID_VEHICLE; } } |