summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-12-06 17:31:16 +0000
committerDarkvater <Darkvater@openttd.org>2006-12-06 17:31:16 +0000
commitc1a0e2e39ff655790db86240ea1069a9f9fcb746 (patch)
tree830aa89af3e1f98745ef972db14bca5a4100a857
parent3807e914e8c347391d534ffe7661569a3051a7e9 (diff)
downloadopenttd-c1a0e2e39ff655790db86240ea1069a9f9fcb746.tar.xz
(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).
-rw-r--r--depot_gui.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/depot_gui.c b/depot_gui.c
index 6ade0ece7..5dac5cc6d 100644
--- a/depot_gui.c
+++ b/depot_gui.c
@@ -1039,20 +1039,15 @@ void ShowDepotWindow(TileIndex tile, byte type)
*/
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();
}
}