mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
(svn r7106) -Feature: Allow over-building of compatible railtypes, i.e. normal and
electrified rail. If building electrified rail, normal rail is upgraded for you (for the normal cost).
This commit is contained in:
parent
0b733ac28a
commit
f03125c656
11
rail_cmd.c
11
rail_cmd.c
@ -273,7 +273,7 @@ int32 CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
}
|
}
|
||||||
if (!IsTileOwner(tile, _current_player) ||
|
if (!IsTileOwner(tile, _current_player) ||
|
||||||
GetRailType(tile) != p1) {
|
!IsCompatibleRail(GetRailType(tile), p1)) {
|
||||||
// Get detailed error message
|
// Get detailed error message
|
||||||
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||||
}
|
}
|
||||||
@ -282,6 +282,15 @@ int32 CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
if (CmdFailed(ret)) return ret;
|
if (CmdFailed(ret)) return ret;
|
||||||
cost += ret;
|
cost += ret;
|
||||||
|
|
||||||
|
/* XXX Assume a 'higher' railtype has preference. This means we
|
||||||
|
* will convert from normal rail to electrified rail, but not
|
||||||
|
* the other way around. */
|
||||||
|
if (GetRailType(tile) < p1) {
|
||||||
|
ret = DoCommand(tile, tile, p1, flags, CMD_CONVERT_RAIL);
|
||||||
|
if (CmdFailed(ret)) return ret;
|
||||||
|
cost += ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
SetRailGroundType(tile, RAIL_GROUND_BARREN);
|
SetRailGroundType(tile, RAIL_GROUND_BARREN);
|
||||||
_m[tile].m5 |= trackbit;
|
_m[tile].m5 |= trackbit;
|
||||||
|
Loading…
Reference in New Issue
Block a user