Changeset - r6674:a7ef81be17c7
[Not reviewed]
master
0 10 0
maedhros - 17 years ago 2007-05-23 17:33:03
maedhros@openttd.org
(svn r9905) -Feature: Allow building new stations adjacent to existing stations by holding down control. Based on a patch by Wolf01.
10 files changed with 63 insertions and 20 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -34,7 +34,7 @@ void CcBuildAirport(bool success, TileIn
 

	
 
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)
src/dock_gui.cpp
Show inline comments
 
@@ -38,7 +38,7 @@ void CcBuildCanal(bool success, TileInde
 

	
 
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)
src/lang/english.txt
Show inline comments
 
@@ -1048,6 +1048,7 @@ STR_CONFIG_PATCHES_NONUNIFORM_STATIONS  
 
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  
 
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
 

	
 

	
 

	
src/rail_gui.cpp
Show inline comments
 
@@ -157,7 +157,7 @@ static void PlaceRail_Station(TileIndex 
 
		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(TileI
 
	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));
 
}
src/road_gui.cpp
Show inline comments
 
@@ -119,7 +119,7 @@ static void PlaceRoad_BusStation(TileInd
 
	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(TileI
 
	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));
 
	}
 
}
 

	
src/saveload.cpp
Show inline comments
 
@@ -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!
 

	
src/settings.cpp
Show inline comments
 
@@ -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 */
src/settings_gui.cpp
Show inline comments
 
@@ -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[] = {
src/station_cmd.cpp
Show inline comments
 
@@ -794,6 +794,7 @@ static void GetStationLayout(byte *layou
 
 * - 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 
 
	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 
 
 * @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, u
 
	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_secti
 
 * @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, ui
 
	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, 
 
/** 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, uint3
 
	}
 

	
 
	/* 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);
src/variables.h
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general)