(svn r14902) -Feature: Advanced setting to keep various building tools active, which are usually closed after placing an object. (planetmaker)

This commit is contained in:
frosch 2009-01-07 17:40:17 +00:00
parent 567b262901
commit eb6df17b1a
10 changed files with 17 additions and 13 deletions

View File

@ -34,7 +34,7 @@ void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2)
{ {
if (success) { if (success) {
SndPlayTileFx(SND_1F_SPLAT, tile); SndPlayTileFx(SND_1F_SPLAT, tile);
ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
} }
} }

View File

@ -35,7 +35,7 @@ void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
{ {
if (success) { if (success) {
SndPlayTileFx(SND_02_SPLAT, tile); SndPlayTileFx(SND_02_SPLAT, tile);
ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
} }
} }
@ -215,7 +215,7 @@ struct BuildDocksToolbarWindow : Window {
if (pt.x != -1) { if (pt.x != -1) {
switch (select_proc) { switch (select_proc) {
case DDSP_BUILD_BRIDGE: case DDSP_BUILD_BRIDGE:
ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
extern void CcBuildBridge(bool success, TileIndex tile, uint32 p1, uint32 p2); extern void CcBuildBridge(bool success, TileIndex tile, uint32 p1, uint32 p2);
DoCommandP(end_tile, start_tile, TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge); DoCommandP(end_tile, start_tile, TRANSPORT_WATER << 15, CMD_BUILD_BRIDGE | CMD_MSG(STR_CAN_T_BUILD_AQUEDUCT_HERE), CcBuildBridge);

View File

@ -375,7 +375,7 @@ public:
} }
/* If an industry has been built, just reset the cursor and the system */ /* If an industry has been built, just reset the cursor and the system */
if (success) ResetObjectToPlace(); if (success && !_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
} }
virtual void OnTick() virtual void OnTick()

View File

@ -1139,6 +1139,7 @@ STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_FIRST :First available
STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_LAST :Last available STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_LAST :Last available
STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_MOST_USED :Most used STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_MOST_USED :Most used
STR_CONFIG_PATCHES_SHOW_TRACK_RESERVATION :{LTBLUE}Show reserved tracks: {ORANGE}{STRING1} STR_CONFIG_PATCHES_SHOW_TRACK_RESERVATION :{LTBLUE}Show reserved tracks: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_PERSISTENT_BUILDINGTOOLS :{LTBLUE}Keep building tools active after usage: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE :{LTBLUE}Show building tools when no suitable vehicles are available: {ORANGE}{STRING1} STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE :{LTBLUE}Show building tools when no suitable vehicles are available: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_MAX_TRAINS :{LTBLUE}Max trains per player: {ORANGE}{STRING1} STR_CONFIG_PATCHES_MAX_TRAINS :{LTBLUE}Max trains per player: {ORANGE}{STRING1}

View File

@ -142,7 +142,7 @@ void CcRailDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
DiagDirection dir = (DiagDirection)p2; DiagDirection dir = (DiagDirection)p2;
SndPlayTileFx(SND_20_SPLAT_2, tile); SndPlayTileFx(SND_20_SPLAT_2, tile);
ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
tile += TileOffsByDiagDir(dir); tile += TileOffsByDiagDir(dir);
@ -174,8 +174,8 @@ void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2)
{ {
if (success) { if (success) {
SndPlayTileFx(SND_20_SPLAT_2, tile); SndPlayTileFx(SND_20_SPLAT_2, tile);
/* Only close the station builder window if the default station is chosen. */ /* Only close the station builder window if the default station and non persistent building is chosen. */
if (_railstation.station_class == STAT_CLASS_DFLT && _railstation.station_type == 0) ResetObjectToPlace(); if (_railstation.station_class == STAT_CLASS_DFLT && _railstation.station_type == 0 && !_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
} }
} }
@ -256,7 +256,7 @@ void CcBuildRailTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2)
{ {
if (success) { if (success) {
SndPlayTileFx(SND_20_SPLAT_2, tile); SndPlayTileFx(SND_20_SPLAT_2, tile);
ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
} else { } else {
SetRedErrorSquare(_build_tunnel_endtile); SetRedErrorSquare(_build_tunnel_endtile);
} }
@ -707,7 +707,7 @@ struct BuildRailToolbarWindow : Window {
switch (select_proc) { switch (select_proc) {
default: NOT_REACHED(); default: NOT_REACHED();
case DDSP_BUILD_BRIDGE: case DDSP_BUILD_BRIDGE:
ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_RAIL, _cur_railtype); ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_RAIL, _cur_railtype);
break; break;

View File

@ -118,7 +118,7 @@ void CcBuildRoadTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2)
{ {
if (success) { if (success) {
SndPlayTileFx(SND_20_SPLAT_2, tile); SndPlayTileFx(SND_20_SPLAT_2, tile);
ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
} else { } else {
SetRedErrorSquare(_build_tunnel_endtile); SetRedErrorSquare(_build_tunnel_endtile);
} }
@ -191,7 +191,7 @@ void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
if (success) { if (success) {
DiagDirection dir = (DiagDirection)GB(p1, 0, 2); DiagDirection dir = (DiagDirection)GB(p1, 0, 2);
SndPlayTileFx(SND_1F_SPLAT, tile); SndPlayTileFx(SND_1F_SPLAT, tile);
ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
BuildRoadOutsideStation(tile, dir); BuildRoadOutsideStation(tile, dir);
/* For a drive-through road stop build connecting road for other entrance */ /* For a drive-through road stop build connecting road for other entrance */
if (HasBit(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir)); if (HasBit(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir));
@ -579,7 +579,7 @@ struct BuildRoadToolbarWindow : Window {
switch (select_proc) { switch (select_proc) {
default: NOT_REACHED(); default: NOT_REACHED();
case DDSP_BUILD_BRIDGE: case DDSP_BUILD_BRIDGE:
ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_ROAD, RoadTypeToRoadTypes(_cur_roadtype)); ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_ROAD, RoadTypeToRoadTypes(_cur_roadtype));
break; break;

View File

@ -1466,6 +1466,7 @@ const SettingDesc _patch_settings[] = {
SDTC_VAR(gui.station_platlength, SLE_UINT8, S, 0, 5, 1, 7, 0, STR_NULL, NULL), SDTC_VAR(gui.station_platlength, SLE_UINT8, S, 0, 5, 1, 7, 0, STR_NULL, NULL),
SDTC_BOOL(gui.station_dragdrop, S, 0, true, STR_NULL, NULL), SDTC_BOOL(gui.station_dragdrop, S, 0, true, STR_NULL, NULL),
SDTC_BOOL(gui.station_show_coverage, S, 0, false, STR_NULL, NULL), SDTC_BOOL(gui.station_show_coverage, S, 0, false, STR_NULL, NULL),
SDTC_BOOL(gui.persistent_buildingtools, S, 0, false, STR_CONFIG_PATCHES_PERSISTENT_BUILDINGTOOLS, NULL),
SDTC_VAR(gui.console_backlog_timeout, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL), SDTC_VAR(gui.console_backlog_timeout, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL),
SDTC_VAR(gui.console_backlog_length, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL), SDTC_VAR(gui.console_backlog_length, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL),

View File

@ -639,6 +639,7 @@ static const char *_patches_ui[] = {
"gui.quick_goto", "gui.quick_goto",
"gui.default_rail_type", "gui.default_rail_type",
"gui.always_build_infrastructure", "gui.always_build_infrastructure",
"gui.persistent_buildingtools",
"gui.show_track_reservation", "gui.show_track_reservation",
"gui.left_mouse_btn_scrolling", "gui.left_mouse_btn_scrolling",
}; };

View File

@ -89,6 +89,7 @@ struct GUISettings {
byte station_platlength; ///< the platform length, in tiles, for rail stations byte station_platlength; ///< the platform length, in tiles, for rail stations
bool station_dragdrop; ///< whether drag and drop is enabled for stations bool station_dragdrop; ///< whether drag and drop is enabled for stations
bool station_show_coverage; ///< whether to highlight coverage area bool station_show_coverage; ///< whether to highlight coverage area
bool persistent_buildingtools; ///< keep the building tools active after usage
uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity. uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity.
uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed. uint16 console_backlog_length; ///< the minimum amount of items in the console backlog before items will be removed.

View File

@ -658,7 +658,7 @@ void CcBuildTown(bool success, TileIndex tile, uint32 p1, uint32 p2)
{ {
if (success) { if (success) {
SndPlayTileFx(SND_1F_SPLAT, tile); SndPlayTileFx(SND_1F_SPLAT, tile);
ResetObjectToPlace(); if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
} }
} }