|
@@ -317,49 +317,49 @@ int32 CmdBuildSingleRail(int x, int y, u
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
SetTileOwner(tile, _current_player);
|
|
|
_map3_lo[tile] &= ~0x0F;
|
|
|
_map3_lo[tile] |= p1;
|
|
|
_map5[tile] = (m5 & 0xC7) | 0x20; // railroad under bridge
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case 0x20: // rail already there
|
|
|
return_cmd_error(STR_1007_ALREADY_BUILT);
|
|
|
|
|
|
default:
|
|
|
// Get detailed error message
|
|
|
return DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case MP_RAILWAY:
|
|
|
if (!CheckTrackCombination(m5, rail_bit, flags) ||
|
|
|
!EnsureNoVehicle(tile)) {
|
|
|
return CMD_ERROR;
|
|
|
}
|
|
|
if (m5 & RAIL_TYPE_SPECIAL ||
|
|
|
_map_owner[tile] != _current_player ||
|
|
|
!IsTileOwner(tile, _current_player) ||
|
|
|
(_map3_lo[tile] & 0xFU) != p1) {
|
|
|
// Get detailed error message
|
|
|
return DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
|
|
}
|
|
|
|
|
|
ret = CheckRailSlope(tileh, rail_bit, m5 & RAIL_BIT_MASK, tile);
|
|
|
if (CmdFailed(ret)) return ret;
|
|
|
cost += ret;
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
_map2[tile] &= ~RAIL_MAP2LO_GROUND_MASK; // Bare land
|
|
|
_map5[tile] = m5 | rail_bit;
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case MP_STREET:
|
|
|
if (!_valid_tileh_slopes[3][tileh]) // prevent certain slopes
|
|
|
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
|
|
|
if (!EnsureNoVehicle(tile)) return CMD_ERROR;
|
|
|
|
|
|
if ((m5 & 0xF0) == 0 && ( // normal road?
|
|
|
(rail_bit == 1 && m5 == 0x05) ||
|
|
|
(rail_bit == 2 && m5 == 0x0A) // correct direction?
|
|
|
)) {
|