diff options
author | smatz <smatz@openttd.org> | 2010-09-06 14:14:09 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2010-09-06 14:14:09 +0000 |
commit | fd54943c7a0dfa421eaa403b1cd18f06ccc4c6b9 (patch) | |
tree | 28bbfab27e7cc9042011a294c6fa49f5800ea8bd /src/viewport.cpp | |
parent | d2572f94d229ede57a9d5887c3f5de981d30ab43 (diff) | |
download | openttd-fd54943c7a0dfa421eaa403b1cd18f06ccc4c6b9.tar.xz |
(svn r20753) -Feature [FS#3999]: make it possible to select vehicle to clone and vehicle to clone orders from directly from vehicle lists and depot window
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r-- | src/viewport.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index f904e6756..ef6a2761d 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1805,14 +1805,19 @@ static bool CheckClickOnLandscape(const ViewPort *vp, int x, int y) bool HandleViewportClicked(const ViewPort *vp, int x, int y) { - const Vehicle *v; + const Vehicle *v = CheckClickOnVehicle(vp, x, y); + + if (_thd.place_mode & HT_VEHICLE) { + if (v != NULL && VehicleClicked(v)) return true; + } + + if (_thd.place_mode & HT_DRAG_MASK) return false; if (CheckClickOnTown(vp, x, y)) return true; if (CheckClickOnStation(vp, x, y)) return true; if (CheckClickOnSign(vp, x, y)) return true; CheckClickOnLandscape(vp, x, y); - v = CheckClickOnVehicle(vp, x, y); if (v != NULL) { DEBUG(misc, 2, "Vehicle %d (index %d) at %p", v->unitnumber, v->index, v); if (IsCompanyBuildableVehicleType(v)) { @@ -1971,7 +1976,7 @@ void UpdateTileSelection() _thd.new_size.y = y2 - y1 + TILE_SIZE; _thd.new_drawstyle = _thd.next_drawstyle; } - } else if (_thd.place_mode != HT_NONE) { + } else if ((_thd.place_mode & HT_DRAG_MASK) != HT_NONE) { Point pt = GetTileBelowCursor(); x1 = pt.x; y1 = pt.y; |