summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-03-17 20:19:55 +0000
committerfrosch <frosch@openttd.org>2010-03-17 20:19:55 +0000
commit0f9be95e03262fc8155f0008eb4cd05a6d074a52 (patch)
tree537475c5b20e351fde855120dd99088e17132d27
parent8b8057dce3631d0fbd42bd8633d2bec85f72b64a (diff)
downloadopenttd-0f9be95e03262fc8155f0008eb4cd05a6d074a52.tar.xz
(svn r19445) -Change: No need to drag an area when overbuilding bridges.
-rw-r--r--src/rail_gui.cpp9
-rw-r--r--src/road_gui.cpp10
2 files changed, 17 insertions, 2 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index c30e63017..1d9302872 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -254,7 +254,14 @@ static void GenericPlaceSignals(TileIndex tile)
static void PlaceRail_Bridge(TileIndex tile)
{
- VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE);
+ if (IsBridgeTile(tile)) {
+ TileIndex other_tile = GetOtherTunnelBridgeEnd(tile);
+ Window *w = GetCallbackWnd();
+ Point pt = {0, 0};
+ if (w != NULL) w->OnPlaceMouseUp(VPM_X_OR_Y, DDSP_BUILD_BRIDGE, pt, tile, other_tile);
+ } else {
+ VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE);
+ }
}
/** Command callback for building a tunnel */
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 0fdb7c183..bacf1df85 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -25,6 +25,7 @@
#include "sound_func.h"
#include "company_func.h"
#include "tunnelbridge.h"
+#include "tunnelbridge_map.h"
#include "tilehighlight_func.h"
#include "company_base.h"
@@ -112,7 +113,14 @@ static void PlaceRoad_AutoRoad(TileIndex tile)
static void PlaceRoad_Bridge(TileIndex tile)
{
- VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE);
+ if (IsBridgeTile(tile)) {
+ TileIndex other_tile = GetOtherTunnelBridgeEnd(tile);
+ Window *w = GetCallbackWnd();
+ Point pt = {0, 0};
+ if (w != NULL) w->OnPlaceMouseUp(VPM_X_OR_Y, DDSP_BUILD_BRIDGE, pt, tile, other_tile);
+ } else {
+ VpStartPlaceSizing(tile, VPM_X_OR_Y, DDSP_BUILD_BRIDGE);
+ }
}