diff options
author | smatz <smatz@openttd.org> | 2009-01-07 02:03:07 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-01-07 02:03:07 +0000 |
commit | a1d3c90af9f2cfedb9562c7676f434677a96df71 (patch) | |
tree | 09f4ff3341e81fc4674594653f1402c200146e15 /src | |
parent | 206c5affcb8514a028eeaf9eab56e4cbbecc9c77 (diff) | |
download | openttd-a1d3c90af9f2cfedb9562c7676f434677a96df71.tar.xz |
(svn r14884) -Codechange: simplify code responsible for opening vehicle view windows
Diffstat (limited to 'src')
-rw-r--r-- | src/viewport.cpp | 26 |
1 files changed, 1 insertions, 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); |