summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-01-07 17:40:17 +0000
committerfrosch <frosch@openttd.org>2009-01-07 17:40:17 +0000
commitcf1e926e371f91628a6048adc0d62f129a0d84ab (patch)
tree8a7545f4055397f47b4529fff6d0dc744e67dabe /src
parent84dee1e7389aa359ce802f5fca3f167771c44005 (diff)
downloadopenttd-cf1e926e371f91628a6048adc0d62f129a0d84ab.tar.xz
(svn r14902) -Feature: Advanced setting to keep various building tools active, which are usually closed after placing an object. (planetmaker)
Diffstat (limited to 'src')
-rw-r--r--src/airport_gui.cpp2
-rw-r--r--src/dock_gui.cpp4
-rw-r--r--src/industry_gui.cpp2
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/rail_gui.cpp10
-rw-r--r--src/road_gui.cpp6
-rw-r--r--src/settings.cpp1
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/settings_type.h1
-rw-r--r--src/town_gui.cpp2
10 files changed, 17 insertions, 13 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 4e6b7bce4..945d196d6 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -34,7 +34,7 @@ void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
if (success) {
SndPlayTileFx(SND_1F_SPLAT, tile);
- ResetObjectToPlace();
+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
}
}
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 1de5899b0..6c588bebe 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -35,7 +35,7 @@ void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
if (success) {
SndPlayTileFx(SND_02_SPLAT, tile);
- ResetObjectToPlace();
+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
}
}
@@ -215,7 +215,7 @@ struct BuildDocksToolbarWindow : Window {
if (pt.x != -1) {
switch (select_proc) {
case DDSP_BUILD_BRIDGE:
- ResetObjectToPlace();
+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
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);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 06a12febc..93a1121e1 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -375,7 +375,7 @@ public:
}
/* 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()
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 77b1c2493..9c61c1f5e 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -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_MOST_USED :Most used
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_MAX_TRAINS :{LTBLUE}Max trains per player: {ORANGE}{STRING1}
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 9161bf5f2..862707b1a 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -142,7 +142,7 @@ void CcRailDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
DiagDirection dir = (DiagDirection)p2;
SndPlayTileFx(SND_20_SPLAT_2, tile);
- ResetObjectToPlace();
+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
tile += TileOffsByDiagDir(dir);
@@ -174,8 +174,8 @@ void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
if (success) {
SndPlayTileFx(SND_20_SPLAT_2, tile);
- /* Only close the station builder window if the default station is chosen. */
- if (_railstation.station_class == STAT_CLASS_DFLT && _railstation.station_type == 0) ResetObjectToPlace();
+ /* 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 && !_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
}
}
@@ -256,7 +256,7 @@ void CcBuildRailTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
if (success) {
SndPlayTileFx(SND_20_SPLAT_2, tile);
- ResetObjectToPlace();
+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
} else {
SetRedErrorSquare(_build_tunnel_endtile);
}
@@ -707,7 +707,7 @@ struct BuildRailToolbarWindow : Window {
switch (select_proc) {
default: NOT_REACHED();
case DDSP_BUILD_BRIDGE:
- ResetObjectToPlace();
+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_RAIL, _cur_railtype);
break;
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 79a37d723..902649df7 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -118,7 +118,7 @@ void CcBuildRoadTunnel(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
if (success) {
SndPlayTileFx(SND_20_SPLAT_2, tile);
- ResetObjectToPlace();
+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
} else {
SetRedErrorSquare(_build_tunnel_endtile);
}
@@ -191,7 +191,7 @@ void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
if (success) {
DiagDirection dir = (DiagDirection)GB(p1, 0, 2);
SndPlayTileFx(SND_1F_SPLAT, tile);
- ResetObjectToPlace();
+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
BuildRoadOutsideStation(tile, dir);
/* For a drive-through road stop build connecting road for other entrance */
if (HasBit(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir));
@@ -579,7 +579,7 @@ struct BuildRoadToolbarWindow : Window {
switch (select_proc) {
default: NOT_REACHED();
case DDSP_BUILD_BRIDGE:
- ResetObjectToPlace();
+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
ShowBuildBridgeWindow(start_tile, end_tile, TRANSPORT_ROAD, RoadTypeToRoadTypes(_cur_roadtype));
break;
diff --git a/src/settings.cpp b/src/settings.cpp
index 846e3312a..731efa51c 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -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_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.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_length, SLE_UINT16, S, 0, 100, 10, 65500, 0, STR_NULL, NULL),
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 9e3a3f391..94a9891f3 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -639,6 +639,7 @@ static const char *_patches_ui[] = {
"gui.quick_goto",
"gui.default_rail_type",
"gui.always_build_infrastructure",
+ "gui.persistent_buildingtools",
"gui.show_track_reservation",
"gui.left_mouse_btn_scrolling",
};
diff --git a/src/settings_type.h b/src/settings_type.h
index 1adf9c504..c51a5130b 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -89,6 +89,7 @@ struct GUISettings {
byte station_platlength; ///< the platform length, in tiles, for rail stations
bool station_dragdrop; ///< whether drag and drop is enabled for stations
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_length; ///< the minimum amount of items in the console backlog before items will be removed.
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index c76556170..cc6a61724 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -658,7 +658,7 @@ void CcBuildTown(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
if (success) {
SndPlayTileFx(SND_1F_SPLAT, tile);
- ResetObjectToPlace();
+ if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
}
}