summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/airport_gui.cpp2
-rw-r--r--src/dock_gui.cpp2
-rw-r--r--src/lang/english.txt2
-rw-r--r--src/rail_gui.cpp4
-rw-r--r--src/road_gui.cpp4
-rw-r--r--src/saveload.cpp2
-rw-r--r--src/settings.cpp1
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/station_cmd.cpp64
-rw-r--r--src/variables.h1
10 files changed, 63 insertions, 20 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 681f9b297..e663b8ffb 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)
static void PlaceAirport(TileIndex tile)
{
- DoCommandP(tile, _selected_airport_type, 0, CcBuildAirport, CMD_BUILD_AIRPORT | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_A001_CAN_T_BUILD_AIRPORT_HERE));
+ DoCommandP(tile, _selected_airport_type, _ctrl_pressed, CcBuildAirport, CMD_BUILD_AIRPORT | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_A001_CAN_T_BUILD_AIRPORT_HERE));
}
static void PlaceAir_DemolishArea(TileIndex tile)
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index 02abcd129..57b3bcb57 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -38,7 +38,7 @@ void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2)
static void PlaceDocks_Dock(TileIndex tile)
{
- DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_DOCK | CMD_AUTO | CMD_MSG(STR_9802_CAN_T_BUILD_DOCK_HERE));
+ DoCommandP(tile, _ctrl_pressed, 0, CcBuildDocks, CMD_BUILD_DOCK | CMD_AUTO | CMD_MSG(STR_9802_CAN_T_BUILD_DOCK_HERE));
}
static void PlaceDocks_Depot(TileIndex tile)
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 7899daaf2..49b46ba28 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1048,6 +1048,7 @@ STR_CONFIG_PATCHES_NONUNIFORM_STATIONS :{LTBLUE}Nonunif
STR_CONFIG_PATCHES_NEW_PATHFINDING_ALL :{LTBLUE}New global pathfinding (NPF, overrides NTP): {ORANGE}{STRING1}
STR_CONFIG_PATCHES_FREIGHT_TRAINS :{LTBLUE}Weight multiplier for freight to simulate heavy trains: {ORANGE}{STRING}
STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD :{LTBLUE}Allow drive-through road stops on town owned roads: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_ADJACENT_STATIONS :{LTBLUE}Allow building adjacent stations: {ORANGE}{STRING}
STR_CONFIG_PATCHES_SMALL_AIRPORTS :{LTBLUE}Always allow small airports: {ORANGE}{STRING1}
@@ -1588,6 +1589,7 @@ STR_RAILROAD_TRACK_WITH_NORMAL_SIGNALS :Railway track w
STR_RAILROAD_TRACK_WITH_PRESIGNALS :Railway track with pre-signals
STR_RAILROAD_TRACK_WITH_EXITSIGNALS :Railway track with exit-signals
STR_RAILROAD_TRACK_WITH_COMBOSIGNALS :Railway track with combo-signals
+STR_MUST_REMOVE_RAILWAY_STATION_FIRST :{WHITE}Must remove railway station first
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 838eeda8c..999c6afd3 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -157,7 +157,7 @@ static void PlaceRail_Station(TileIndex tile)
VpSetPlaceSizingLimit(_patches.station_spread);
} else {
DoCommandP(tile,
- _railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16),
+ _railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16) | (_ctrl_pressed << 24),
_cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CcStation,
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_AUTO | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION));
}
@@ -665,7 +665,7 @@ static void HandleStationPlacement(TileIndex start, TileIndex end)
if (!_railstation.orientation) Swap(w, h);
DoCommandP(TileXY(sx, sy),
- _railstation.orientation | (w << 8) | (h << 16),
+ _railstation.orientation | (w << 8) | (h << 16) | (_ctrl_pressed << 24),
_cur_railtype | (_railstation.station_class << 8) | (_railstation.station_type << 16), CcStation,
CMD_BUILD_RAILROAD_STATION | CMD_NO_WATER | CMD_AUTO | CMD_MSG(STR_100F_CAN_T_BUILD_RAILROAD_STATION));
}
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 217c0618d..047e90c01 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -119,7 +119,7 @@ static void PlaceRoad_BusStation(TileIndex tile)
if (_remove_button_clicked) {
DoCommandP(tile, 0, RoadStop::BUS, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(STR_CAN_T_REMOVE_BUS_STATION));
} else {
- PlaceRoadStop(tile, ROADTYPES_ROAD << 2 | RoadStop::BUS, CMD_BUILD_ROAD_STOP | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1808_CAN_T_BUILD_BUS_STATION));
+ PlaceRoadStop(tile, (_ctrl_pressed << 5) | ROADTYPES_ROAD << 2 | RoadStop::BUS, CMD_BUILD_ROAD_STOP | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1808_CAN_T_BUILD_BUS_STATION));
}
}
@@ -128,7 +128,7 @@ static void PlaceRoad_TruckStation(TileIndex tile)
if (_remove_button_clicked) {
DoCommandP(tile, 0, RoadStop::TRUCK, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(STR_CAN_T_REMOVE_TRUCK_STATION));
} else {
- PlaceRoadStop(tile, ROADTYPES_ROAD << 2 | RoadStop::TRUCK, CMD_BUILD_ROAD_STOP | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1809_CAN_T_BUILD_TRUCK_STATION));
+ PlaceRoadStop(tile, (_ctrl_pressed << 5) | ROADTYPES_ROAD << 2 | RoadStop::TRUCK, CMD_BUILD_ROAD_STOP | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1809_CAN_T_BUILD_TRUCK_STATION));
}
}
diff --git a/src/saveload.cpp b/src/saveload.cpp
index 971b0eb4f..4ffc00a6a 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -29,7 +29,7 @@
#include <setjmp.h>
#include <list>
-extern const uint16 SAVEGAME_VERSION = 61;
+extern const uint16 SAVEGAME_VERSION = 62;
uint16 _sl_version; ///< the major savegame version identifier
byte _sl_minor_version; ///< the minor savegame version, DO NOT USE!
diff --git a/src/settings.cpp b/src/settings.cpp
index f71bc862f..230d5758d 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1402,6 +1402,7 @@ const SettingDesc _patch_settings[] = {
SDT_BOOL(Patches, modified_catchment, 0, 0, true, STR_CONFIG_PATCHES_CATCHMENT, NULL),
SDT_CONDBOOL(Patches, gradual_loading, 40, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_GRADUAL_LOADING, NULL),
SDT_CONDBOOL(Patches, road_stop_on_town_road, 47, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD, NULL),
+ SDT_CONDBOOL(Patches, adjacent_stations, 62, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_ADJACENT_STATIONS, NULL),
/***************************************************************************/
/* Economy section of the GUI-configure patches window */
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 140337f76..f24ef10ed 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -625,6 +625,7 @@ static const char *_patches_stations[] = {
"modified_catchment",
"gradual_loading",
"road_stop_on_town_road",
+ "adjacent_stations",
};
static const char *_patches_economy[] = {
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 84780a4ce..79805859a 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -794,6 +794,7 @@ static void GetStationLayout(byte *layout, int numtracks, int plat_len, const St
* - p1 = (bit 0) - orientation (Axis)
* - p1 = (bit 8-15) - number of tracks
* - p1 = (bit 16-23) - platform length
+ * - p1 = (bit 24) - allow stations directly adjacent to other stations.
* @param p2 various bitstuffed elements
* - p2 = (bit 0- 3) - railtype (p2 & 0xF)
* - p2 = (bit 8-15) - custom station class
@@ -838,9 +839,33 @@ int32 CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1, uint3
if (CmdFailed(ret)) return ret;
int32 cost = ret + (numtracks * _price.train_station_track + _price.train_station_length) * plat_len;
- // Make sure there are no similar stations around us.
- Station *st = GetStationAround(tile_org, w_org, h_org, est);
- if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
+ Station *st = NULL;
+ bool check_surrounding = true;
+
+ if (_patches.adjacent_stations) {
+ if (est != INVALID_STATION) {
+ if (HASBIT(p1, 24)) {
+ /* You can't build an adjacent station over the top of one that
+ * already exists. */
+ return_cmd_error(STR_MUST_REMOVE_RAILWAY_STATION_FIRST);
+ } else {
+ /* Extend the current station, and don't check whether it will
+ * be near any other stations. */
+ st = GetStation(est);
+ check_surrounding = false;
+ }
+ } else {
+ /* There's no station here. Don't check the tiles surrounding this
+ * one if the player wanted to build an adjacent station. */
+ if (HASBIT(p1, 24)) check_surrounding = false;
+ }
+ }
+
+ if (check_surrounding) {
+ // Make sure there are no similar stations around us.
+ st = GetStationAround(tile_org, w_org, h_org, est);
+ if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
+ }
// See if there is a deleted station close to us.
if (st == NULL) st = GetClosestStationFromTile(tile_org);
@@ -1215,6 +1240,7 @@ static RoadStop **FindRoadStopSpot(bool truck_station, Station* st)
* @param p2 bit 0: 0 for Bus stops, 1 for truck stops
* bit 1: 0 for normal, 1 for drive-through
* bit 2..4: the roadtypes
+ * bit 5: allow stations directly adjacent to other stations.
*/
int32 CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
@@ -1255,8 +1281,12 @@ int32 CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (CmdFailed(ret)) return ret;
int32 cost = build_over_road ? 0 : ret; // Don't add cost of clearing road when overbuilding
- Station *st = GetStationAround(tile, 1, 1, INVALID_STATION);
- if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
+ Station *st = NULL;
+
+ if (!_patches.adjacent_stations || !HASBIT(p2, 5)) {
+ st = GetStationAround(tile, 1, 1, INVALID_STATION);
+ if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
+ }
/* Find a station close to us */
if (st == NULL) st = GetClosestStationFromTile(tile);
@@ -1521,7 +1551,7 @@ static const byte * const _airport_sections[] = {
* @param tile tile where airport will be built
* @param flags operation to perform
* @param p1 airport type, @see airport.h
- * @param p2 unused
+ * @param p2 (bit 0) - allow airports directly adjacent to other airports.
*/
int32 CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
@@ -1559,8 +1589,12 @@ int32 CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (CmdFailed(ret)) return ret;
int32 cost = ret;
- Station *st = GetStationAround(tile, w, h, INVALID_STATION);
- if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
+ Station *st = NULL;
+
+ if (!_patches.adjacent_stations || !HASBIT(p2, 0)) {
+ st = GetStationAround(tile, w, h, INVALID_STATION);
+ if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
+ }
/* Find a station close to us */
if (st == NULL) st = GetClosestStationFromTile(tile);
@@ -1805,7 +1839,7 @@ static const byte _dock_h_chk[4] = { 1, 2, 1, 2 };
/** Build a dock/haven.
* @param tile tile where dock will be built
* @param flags operation to perform
- * @param p1 unused
+ * @param p1 (bit 0) - allow docks directly adjacent to other docks.
* @param p2 unused
*/
int32 CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
@@ -1847,10 +1881,14 @@ int32 CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
/* middle */
- Station *st = GetStationAround(
- tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
- _dock_w_chk[direction], _dock_h_chk[direction], INVALID_STATION);
- if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
+ Station *st = NULL;
+
+ if (!_patches.adjacent_stations || !HASBIT(p1, 0)) {
+ st = GetStationAround(
+ tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
+ _dock_w_chk[direction], _dock_h_chk[direction], INVALID_STATION);
+ if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
+ }
/* Find a station close to us */
if (st == NULL) st = GetClosestStationFromTile(tile);
diff --git a/src/variables.h b/src/variables.h
index 6b79367d1..4c5aaf8e5 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -118,6 +118,7 @@ struct Patches {
byte se_flat_world_height; // land height a flat world gets in SE
bool bribe; // enable bribing the local authority
bool nonuniform_stations; // allow nonuniform train stations
+ bool adjacent_stations; // allow stations to be built directly adjacent to other stations
bool always_small_airport; // always allow small airports
bool realistic_acceleration; // realistic acceleration for trains
bool wagon_speed_limits; // enable wagon speed limits