summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-01-07 02:03:07 +0000
committersmatz <smatz@openttd.org>2009-01-07 02:03:07 +0000
commit1ada1a4ff21c1dcada68540ba9650d33503b8507 (patch)
tree09f4ff3341e81fc4674594653f1402c200146e15 /src
parent828675bf0ead5cac2881e3a5504720c0d336b1f0 (diff)
downloadopenttd-1ada1a4ff21c1dcada68540ba9650d33503b8507.tar.xz
(svn r14884) -Codechange: simplify code responsible for opening vehicle view windows
Diffstat (limited to 'src')
-rw-r--r--src/viewport.cpp26
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);