When building tunnels, open new viewports at the far end of the tunnel.
Loosely based on https://www.tt-forums.net/viewtopic.php?f=33&t=72639
This commit is contained in:
@@ -695,7 +695,7 @@ struct BuildRailToolbarWindow : Window {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_RAT_BUILD_TUNNEL:
|
case WID_RAT_BUILD_TUNNEL:
|
||||||
HandlePlacePushButton(this, WID_RAT_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, HT_SPECIAL);
|
HandlePlacePushButton(this, WID_RAT_BUILD_TUNNEL, GetRailTypeInfo(_cur_railtype)->cursor.tunnel, HT_SPECIAL | HT_TUNNEL);
|
||||||
this->last_user_action = widget;
|
this->last_user_action = widget;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -465,7 +465,7 @@ struct BuildRoadToolbarWindow : Window {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_ROT_BUILD_TUNNEL:
|
case WID_ROT_BUILD_TUNNEL:
|
||||||
HandlePlacePushButton(this, WID_ROT_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, HT_SPECIAL);
|
HandlePlacePushButton(this, WID_ROT_BUILD_TUNNEL, SPR_CURSOR_ROAD_TUNNEL, HT_SPECIAL | HT_TUNNEL);
|
||||||
this->last_started_action = widget;
|
this->last_started_action = widget;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@ enum HighLightStyle {
|
|||||||
HT_POLY = 0x400, ///< polyline mode; connect highlighted track with previous one
|
HT_POLY = 0x400, ///< polyline mode; connect highlighted track with previous one
|
||||||
HT_NEW_POLY = 0xC00, ///< start completly new polyline; implies #HT_POLY
|
HT_NEW_POLY = 0xC00, ///< start completly new polyline; implies #HT_POLY
|
||||||
HT_DRAG_MASK = 0x0F8, ///< Mask for the tile drag-type modes.
|
HT_DRAG_MASK = 0x0F8, ///< Mask for the tile drag-type modes.
|
||||||
|
HT_TUNNEL = 0x1000,///< tunnel highlight hint
|
||||||
|
|
||||||
/* lower bits (used with HT_LINE and HT_RAIL):
|
/* lower bits (used with HT_LINE and HT_RAIL):
|
||||||
* (see ASCII art in table/autorail.h for a visual interpretation) */
|
* (see ASCII art in table/autorail.h for a visual interpretation) */
|
||||||
|
@@ -14,6 +14,8 @@
|
|||||||
#include "window_gui.h"
|
#include "window_gui.h"
|
||||||
#include "viewport_func.h"
|
#include "viewport_func.h"
|
||||||
#include "strings_func.h"
|
#include "strings_func.h"
|
||||||
|
#include "tunnelbridge.h"
|
||||||
|
#include "tilehighlight_func.h"
|
||||||
#include "zoom_func.h"
|
#include "zoom_func.h"
|
||||||
#include "window_func.h"
|
#include "window_func.h"
|
||||||
#include "gfx_func.h"
|
#include "gfx_func.h"
|
||||||
@@ -150,7 +152,7 @@ public:
|
|||||||
ZoomInOrOutToCursorWindow(wheel < 0, this);
|
ZoomInOrOutToCursorWindow(wheel < 0, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnMouseOver(Point pt, int widget)
|
virtual void OnMouseOver(Point pt, int widget)
|
||||||
{
|
{
|
||||||
if (pt.x != -1) {
|
if (pt.x != -1) {
|
||||||
@@ -197,11 +199,17 @@ void ShowExtraViewPortWindow(TileIndex tile)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show a new Extra Viewport window.
|
* Show a new Extra Viewport window.
|
||||||
* Center it on the tile under the cursor, if the cursor is inside a viewport.
|
* When building a tunnel, the tunnel end-tile is used as center for new viewport.
|
||||||
|
* Otherwise center it on the tile under the cursor, if the cursor is inside a viewport.
|
||||||
* If that fails, center it on main viewport center.
|
* If that fails, center it on main viewport center.
|
||||||
*/
|
*/
|
||||||
void ShowExtraViewPortWindowForTileUnderCursor()
|
void ShowExtraViewPortWindowForTileUnderCursor()
|
||||||
{
|
{
|
||||||
|
if (_build_tunnel_endtile != 0 && _thd.place_mode & HT_TUNNEL) {
|
||||||
|
ShowExtraViewPortWindow(_build_tunnel_endtile);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Use tile under mouse as center for new viewport.
|
/* Use tile under mouse as center for new viewport.
|
||||||
* Do this before creating the window, it might appear just below the mouse. */
|
* Do this before creating the window, it might appear just below the mouse. */
|
||||||
Point pt = GetTileBelowCursor();
|
Point pt = GetTileBelowCursor();
|
||||||
@@ -241,4 +249,4 @@ void ShowTooltipForTile(Window *w, const TileIndex tile)
|
|||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user