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;
|
||||
|
||||
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;
|
||||
break;
|
||||
|
||||
|
@@ -465,7 +465,7 @@ struct BuildRoadToolbarWindow : Window {
|
||||
break;
|
||||
|
||||
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;
|
||||
break;
|
||||
|
||||
|
@@ -31,6 +31,7 @@ enum HighLightStyle {
|
||||
HT_POLY = 0x400, ///< polyline mode; connect highlighted track with previous one
|
||||
HT_NEW_POLY = 0xC00, ///< start completly new polyline; implies #HT_POLY
|
||||
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):
|
||||
* (see ASCII art in table/autorail.h for a visual interpretation) */
|
||||
|
@@ -14,6 +14,8 @@
|
||||
#include "window_gui.h"
|
||||
#include "viewport_func.h"
|
||||
#include "strings_func.h"
|
||||
#include "tunnelbridge.h"
|
||||
#include "tilehighlight_func.h"
|
||||
#include "zoom_func.h"
|
||||
#include "window_func.h"
|
||||
#include "gfx_func.h"
|
||||
@@ -197,11 +199,17 @@ void ShowExtraViewPortWindow(TileIndex tile)
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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.
|
||||
* Do this before creating the window, it might appear just below the mouse. */
|
||||
Point pt = GetTileBelowCursor();
|
||||
|
Reference in New Issue
Block a user