(svn r11506) -Fix [FS#1471]: selling vehicles could cause the window of others to scroll to that location.
authorrubidium
Sat, 24 Nov 2007 09:14:58 +0000
changeset 8446 75a7f389a71d
parent 8445 f681905b6f4f
child 8447 286f94800163
(svn r11506) -Fix [FS#1471]: selling vehicles could cause the window of others to scroll to that location.
src/vehicle.cpp
--- a/src/vehicle.cpp	Sat Nov 24 08:56:29 2007 +0000
+++ b/src/vehicle.cpp	Sat Nov 24 09:14:58 2007 +0000
@@ -537,13 +537,10 @@
 		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;
 	}
 }