Changeset - r15457:4874828c361b
[Not reviewed]
master
0 2 0
terkhen - 14 years ago 2010-07-10 20:18:59
terkhen@openttd.org
(svn r20116) -Add: Show an specific error message when trying to convert/remove nonexistant signals.
2 files changed with 7 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -3548,12 +3548,13 @@ STR_ERROR_CROSSING_DISALLOWED           
 
STR_ERROR_CAN_T_BUILD_SIGNALS_HERE                              :{WHITE}Can't build signals here...
 
STR_ERROR_CAN_T_BUILD_RAILROAD_TRACK                            :{WHITE}Can't build railway track here...
 
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_THERE_ARE_NO_SIGNALS                                  :{WHITE}...there are no signals
 

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

	
 
# Road construction errors
 
STR_ERROR_MUST_REMOVE_ROAD_FIRST                                :{WHITE}Must remove road first
 
STR_ERROR_ONEWAY_ROADS_CAN_T_HAVE_JUNCTION                      :{WHITE}... one way roads can't have junctions
src/rail_cmd.cpp
Show inline comments
 
@@ -945,13 +945,13 @@ CommandCost CmdBuildSingleSignal(TileInd
 
	}
 

	
 
	/* In case we don't want to change an existing signal, return without error. */
 
	if (HasBit(p1, 17) && HasSignalOnTrack(tile, track)) return CommandCost();
 

	
 
	/* you can not convert a signal if no signal is on track */
 
	if (convert_signal && !HasSignalOnTrack(tile, track)) return CMD_ERROR;
 
	if (convert_signal && !HasSignalOnTrack(tile, track)) return_cmd_error(STR_ERROR_THERE_ARE_NO_SIGNALS);
 

	
 
	CommandCost cost;
 
	if (!HasSignalOnTrack(tile, track)) {
 
		/* build new signals */
 
		cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_SIGNALS]);
 
	} else {
 
@@ -1217,15 +1217,19 @@ static CommandCost CmdSignalTrackHelper(
 

	
 
			/* Be user-friendly and try placing signals as much as possible */
 
			if (ret.Succeeded()) {
 
				had_success = true;
 
				total_cost.AddCost(ret);
 
			} else {
 
				/* The "No railway" error is the least important one. */
 
				if (ret.GetErrorMessage() != STR_ERROR_THERE_IS_NO_RAILROAD_TRACK ||
 
						last_error.GetErrorMessage() == INVALID_STRING_ID) {
 
				last_error = ret;
 
			}
 
		}
 
		}
 

	
 
		if (autofill) {
 
			if (!CheckSignalAutoFill(tile, trackdir, signal_ctr, remove)) break;
 

	
 
			/* Prevent possible loops */
 
			if (tile == start_tile && trackdir == start_trackdir) break;
 
@@ -1285,13 +1289,13 @@ CommandCost CmdRemoveSingleSignal(TileIn
 
	Track track = Extract<Track, 0, 3>(p1);
 

	
 
	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;
 
		return_cmd_error(STR_ERROR_THERE_ARE_NO_SIGNALS);
 
	}
 
	CommandCost ret = EnsureNoTrainOnTrack(tile, track);
 
	if (ret.Failed()) return ret;
 

	
 
	/* Only water can remove signals from anyone */
 
	if (_current_company != OWNER_WATER) {
0 comments (0 inline, 0 general)