mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
(svn r7112) -Codechange (r7106): Improve the test for determining if the rail type should be converted
This commit is contained in:
parent
2ebd07ecfc
commit
c73578aae6
@ -285,10 +285,9 @@ 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
|
/* If the rail types don't match, try to convert only if engines of
|
||||||
* will convert from normal rail to electrified rail, but not
|
* the present rail type are powered on the new rail type. */
|
||||||
* the other way around. */
|
if (GetRailType(tile) != railtype && HasPowerOnRail(GetRailType(tile), railtype)) {
|
||||||
if (GetRailType(tile) < railtype) {
|
|
||||||
ret = DoCommand(tile, tile, railtype, flags, CMD_CONVERT_RAIL);
|
ret = DoCommand(tile, tile, railtype, flags, CMD_CONVERT_RAIL);
|
||||||
if (CmdFailed(ret)) return ret;
|
if (CmdFailed(ret)) return ret;
|
||||||
cost += ret;
|
cost += ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user