Changeset - r11354:d71f3ebcf3b2
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2009-03-14 15:34:30
rubidium@openttd.org
(svn r15709) -Change [FS#2729]: be a tad more specific about the fact that you're building incompatible tracks when building incompatible track types on the same tile.
1 file changed with 4 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/rail_cmd.cpp
Show inline comments
 
@@ -310,33 +310,32 @@ CommandCost CmdBuildSingleRail(TileIndex
 
	Track track = (Track)p2;
 
	TrackBits trackbit;
 
	CommandCost cost(EXPENSES_CONSTRUCTION);
 
	CommandCost ret;
 

	
 
	if (!ValParamRailtype(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR;
 

	
 
	tileh = GetTileSlope(tile, NULL);
 
	trackbit = TrackToTrackBits(track);
 

	
 
	switch (GetTileType(tile)) {
 
		case MP_RAILWAY:
 
			if (!CheckTileOwnership(tile)) return CMD_ERROR;
 

	
 
			if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error(STR_1001_IMPOSSIBLE_TRACK_COMBINATION);
 

	
 
			if (!CheckTrackCombination(tile, trackbit, flags) ||
 
					!EnsureNoTrainOnTrack(tile, track)) {
 
				return CMD_ERROR;
 
			}
 
			if (!IsTileOwner(tile, _current_company) ||
 
					!IsCompatibleRail(GetRailType(tile), railtype)) {
 
				/* Get detailed error message */
 
				return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 
			}
 

	
 
			ret = CheckRailSlope(tileh, trackbit, GetTrackBits(tile), tile);
 
			if (CmdFailed(ret)) return ret;
 
			cost.AddCost(ret);
 

	
 
			/* If the rail types don't match, try to convert only if engines of
 
			 * the new rail type are not powered on the present rail type and engines of
 
			 * the present rail type are powered on the new rail type. */
 
			if (GetRailType(tile) != railtype && !HasPowerOnRail(railtype, GetRailType(tile))) {
 
				if (HasPowerOnRail(GetRailType(tile), railtype)) {
 
					ret = DoCommand(tile, tile, railtype, flags, CMD_CONVERT_RAIL);
 
					if (CmdFailed(ret)) return ret;
0 comments (0 inline, 0 general)