(svn r3156) -Fix: removed some cases where autoreplace windows were redrawn when nothing was changed
due to the FOR_ALL_VEHICLES(), redrawing those windows are slow
This commit is contained in:
		@@ -291,6 +291,7 @@ int32 CmdBuildAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
			
		||||
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 | 
			
		||||
		RebuildVehicleLists();
 | 
			
		||||
		InvalidateWindow(WC_COMPANY, v->owner);
 | 
			
		||||
		if (IsLocalPlayer())
 | 
			
		||||
			InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Aircraft); //updates the replace Aircraft window
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -348,6 +349,7 @@ int32 CmdSellAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
			
		||||
		// Invalidate depot
 | 
			
		||||
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 | 
			
		||||
		DoDeleteAircraft(v);
 | 
			
		||||
		if (IsLocalPlayer())
 | 
			
		||||
			InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Aircraft); // updates the replace Aircraft window
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -193,6 +193,7 @@ int32 CmdBuildRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
			
		||||
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 | 
			
		||||
		RebuildVehicleLists();
 | 
			
		||||
		InvalidateWindow(WC_COMPANY, v->owner);
 | 
			
		||||
		if (IsLocalPlayer())
 | 
			
		||||
			InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road); // updates the replace Road window
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -263,8 +264,9 @@ int32 CmdSellRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
			
		||||
		DeleteWindowById(WC_VEHICLE_VIEW, v->index);
 | 
			
		||||
		ClearSlot(v, v->u.road.slot);
 | 
			
		||||
		DeleteVehicle(v);
 | 
			
		||||
	}
 | 
			
		||||
		if (IsLocalPlayer())
 | 
			
		||||
			InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road); // updates the replace Road window
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return -(int32)v->value;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -921,6 +921,7 @@ int32 CmdBuildShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
			
		||||
		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 | 
			
		||||
		RebuildVehicleLists();
 | 
			
		||||
		InvalidateWindow(WC_COMPANY, v->owner);
 | 
			
		||||
		if (IsLocalPlayer())
 | 
			
		||||
			InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Ship); // updates the replace Ship window
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -953,6 +954,7 @@ int32 CmdSellShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
			
		||||
		InvalidateWindow(WC_COMPANY, v->owner);
 | 
			
		||||
		DeleteWindowById(WC_VEHICLE_VIEW, v->index);
 | 
			
		||||
		DeleteVehicle(v);
 | 
			
		||||
		if (IsLocalPlayer())
 | 
			
		||||
			InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Ship); // updates the replace Ship window
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -773,12 +773,13 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
			
		||||
			InvalidateWindow(WC_VEHICLE_DEPOT, tile);
 | 
			
		||||
			RebuildVehicleLists();
 | 
			
		||||
			InvalidateWindow(WC_COMPANY, v->owner);
 | 
			
		||||
			if (IsLocalPlayer()) {
 | 
			
		||||
				InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	_cmd_build_rail_veh_score = _railveh_score[p1];
 | 
			
		||||
 | 
			
		||||
	InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window
 | 
			
		||||
 | 
			
		||||
	return value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1128,6 +1129,8 @@ int32 CmdSellRailWagon(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
			
		||||
	if (flags & DC_EXEC) {
 | 
			
		||||
		if (v == first && first->subtype == TS_Front_Engine) {
 | 
			
		||||
			DeleteWindowById(WC_VEHICLE_VIEW, first->index);
 | 
			
		||||
		}
 | 
			
		||||
		if (IsLocalPlayer() && (p1 == 1 || !(RailVehInfo(v->engine_type)->flags & RVI_WAGON))) {
 | 
			
		||||
			InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train);
 | 
			
		||||
		}
 | 
			
		||||
		InvalidateWindow(WC_VEHICLE_DEPOT, first->tile);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user