From 1ada1a4ff21c1dcada68540ba9650d33503b8507 Mon Sep 17 00:00:00 2001 From: smatz Date: Wed, 7 Jan 2009 02:03:07 +0000 Subject: (svn r14884) -Codechange: simplify code responsible for opening vehicle view windows --- src/viewport.cpp | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/src/viewport.cpp b/src/viewport.cpp index 8d2200f29..60d87b207 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1994,30 +1994,6 @@ static bool CheckClickOnLandscape(const ViewPort *vp, int x, int y) } -static void SafeShowTrainViewWindow(const Vehicle* v) -{ - if (!IsFrontEngine(v)) v = v->First(); - ShowVehicleViewWindow(v); -} - -static void SafeShowRoadVehViewWindow(const Vehicle *v) -{ - if (!IsRoadVehFront(v)) v = v->First(); - ShowVehicleViewWindow(v); -} - -static void Nop(const Vehicle *v) {} - -typedef void OnVehicleClickProc(const Vehicle *v); -static OnVehicleClickProc* const _on_vehicle_click_proc[] = { - SafeShowTrainViewWindow, - SafeShowRoadVehViewWindow, - ShowVehicleViewWindow, - ShowVehicleViewWindow, - Nop, // Special vehicles - Nop // Disaster vehicles -}; - bool HandleViewportClicked(const ViewPort *vp, int x, int y) { const Vehicle *v; @@ -2031,7 +2007,7 @@ bool HandleViewportClicked(const ViewPort *vp, int x, int y) v = CheckClickOnVehicle(vp, x, y); if (v != NULL) { DEBUG(misc, 2, "Vehicle %d (index %d) at %p", v->unitnumber, v->index, v); - _on_vehicle_click_proc[v->type](v); + if (IsCompanyBuildableVehicleType(v)) ShowVehicleViewWindow(v->First()); return true; } return CheckClickOnLandscape(vp, x, y); -- cgit v1.2.3-70-g09d2