# HG changeset patch # User Darkvater # Date 1165426276 0 # Node ID a15469628808eb9a8f4d525bf2c3ae721d6c5dd2 # Parent b2b3c60af21012eb3090bda283d911830335a401 (svn r7403) -Codechange (r7386, r7385): Use available functions to find a window instead of doing some cruft yourself (and wrongly typing non-const as const). diff -r b2b3c60af210 -r a15469628808 depot_gui.c --- a/depot_gui.c Wed Dec 06 17:28:14 2006 +0000 +++ b/depot_gui.c Wed Dec 06 17:31:16 2006 +0000 @@ -1039,20 +1039,15 @@ */ void DeleteDepotHighlightOfVehicle(const Vehicle *v) { - Window* const *wz; + Window *w; /* If we haven't got any vehicles on the mouse pointer, we haven't got any highlighted in any depots either * If that is the case, we can skip looping though the windows and save time */ if (_special_mouse_mode != WSM_DRAGDROP) return; - 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(); - } - return; + w = FindWindowById(WC_VEHICLE_DEPOT, v->tile); + if (w != NULL) { + WP(w, depot_d).sel = INVALID_VEHICLE; + ResetObjectToPlace(); } }