1
0
Fork 0

(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).
release/0.5
Darkvater 2006-12-06 17:31:16 +00:00
parent 17eeba3245
commit 8c3da77145
1 changed files with 5 additions and 10 deletions

View File

@ -1039,20 +1039,15 @@ void ShowDepotWindow(TileIndex tile, byte type)
*/ */
void DeleteDepotHighlightOfVehicle(const Vehicle *v) 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 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 that is the case, we can skip looping though the windows and save time */
if (_special_mouse_mode != WSM_DRAGDROP) return; if (_special_mouse_mode != WSM_DRAGDROP) return;
FOR_ALL_WINDOWS(wz) { w = FindWindowById(WC_VEHICLE_DEPOT, v->tile);
const Window *w = *wz; if (w != NULL) {
if (w->window_class != WC_VEHICLE_DEPOT) continue; WP(w, depot_d).sel = INVALID_VEHICLE;
if (w->window_number != v->tile) continue; ResetObjectToPlace();
if (WP(w, depot_d).sel == v->index) {
WP(w, depot_d).sel = INVALID_VEHICLE;
ResetObjectToPlace();
}
return;
} }
} }