Changeset - r15455:028ab2136a1a
[Not reviewed]
master
0 2 0
terkhen - 14 years ago 2010-07-10 20:15:35
terkhen@openttd.org
(svn r20114) -Add: Show an specific error message when trying to remove rail or build/convert/remove signals over nonexistant railways.
2 files changed with 12 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -3549,6 +3549,7 @@ STR_ERROR_CAN_T_BUILD_RAILROAD_TRACK    
 
STR_ERROR_CAN_T_REMOVE_RAILROAD_TRACK                           :{WHITE}Can't remove railway track from here...
 
STR_ERROR_CAN_T_REMOVE_SIGNALS_FROM                             :{WHITE}Can't remove signals from here...
 
STR_ERROR_SIGNAL_CAN_T_CONVERT_SIGNALS_HERE                     :{WHITE}Can't convert signals here...
 
STR_ERROR_THERE_IS_NO_RAILROAD_TRACK                            :{WHITE}...there is no railway track
 

	
 
STR_ERROR_CAN_T_CONVERT_RAIL                                    :{WHITE}Can't convert railtype here...
 

	
src/rail_cmd.cpp
Show inline comments
 
@@ -517,7 +517,7 @@ CommandCost CmdRemoveSingleRail(TileInde
 

	
 
	switch (GetTileType(tile)) {
 
		case MP_ROAD: {
 
			if (!IsLevelCrossing(tile) || GetCrossingRailBits(tile) != trackbit) return CMD_ERROR;
 
			if (!IsLevelCrossing(tile) || GetCrossingRailBits(tile) != trackbit) return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK);
 

	
 
			if (_current_company != OWNER_WATER) {
 
				CommandCost ret = CheckTileOwnership(tile);
 
@@ -545,8 +545,8 @@ CommandCost CmdRemoveSingleRail(TileInde
 

	
 
		case MP_RAILWAY: {
 
			TrackBits present;
 

	
 
			if (!IsPlainRail(tile)) return CMD_ERROR;
 
			/* There are no rails present at depots. */
 
			if (!IsPlainRail(tile)) return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK);
 

	
 
			if (_current_company != OWNER_WATER) {
 
				CommandCost ret = CheckTileOwnership(tile);
 
@@ -557,7 +557,7 @@ CommandCost CmdRemoveSingleRail(TileInde
 
			if (ret.Failed()) return ret;
 

	
 
			present = GetTrackBits(tile);
 
			if ((present & trackbit) == 0) return CMD_ERROR;
 
			if ((present & trackbit) == 0) return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK);
 
			if (present == (TRACK_BIT_X | TRACK_BIT_Y)) crossing = true;
 

	
 
			cost.AddCost(RailClearCost(GetRailType(tile)));
 
@@ -590,7 +590,7 @@ CommandCost CmdRemoveSingleRail(TileInde
 
			break;
 
		}
 

	
 
		default: return CMD_ERROR;
 
		default: return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK);
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
@@ -923,7 +923,7 @@ CommandCost CmdBuildSingleSignal(TileInd
 
	/* You can only build signals on plain rail tiles, and the selected track must exist */
 
	if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) ||
 
			!HasTrack(tile, track)) {
 
		return CMD_ERROR;
 
		return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK);
 
	}
 
	CommandCost ret = EnsureNoTrainOnTrack(tile, track);
 
	if (ret.Failed()) return ret;
 
@@ -1149,7 +1149,7 @@ static CommandCost CmdSignalTrackHelper(
 
	TileIndex end_tile = p1;
 
	if (signal_density == 0 || signal_density > 20) return CMD_ERROR;
 

	
 
	if (!IsPlainRailTile(tile)) return CMD_ERROR;
 
	if (!IsPlainRailTile(tile)) return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK);
 

	
 
	/* for vertical/horizontal tracks, double the given signals density
 
	 * since the original amount will be too dense (shorter tracks) */
 
@@ -1284,10 +1284,10 @@ CommandCost CmdRemoveSingleSignal(TileIn
 
{
 
	Track track = Extract<Track, 0, 3>(p1);
 

	
 
	if (!ValParamTrackOrientation(track) ||
 
			!IsPlainRailTile(tile) ||
 
			!HasTrack(tile, track) ||
 
			!HasSignalOnTrack(tile, track)) {
 
	if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) || !HasTrack(tile, track)) {
 
		return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK);
 
	}
 
	if (!HasSignalOnTrack(tile, track)) {
 
		return CMD_ERROR;
 
	}
 
	CommandCost ret = EnsureNoTrainOnTrack(tile, track);
0 comments (0 inline, 0 general)