summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-26 11:19:03 +0000
committerrubidium <rubidium@openttd.org>2007-07-26 11:19:03 +0000
commitd031da78d8271b8d57a0e2cd33b6c7d6e4231421 (patch)
tree052152806b3898f6c69f3f61708b5d992cd06f93
parentfda75ae60368197ab4058b1941fcf0bf06598369 (diff)
downloadopenttd-d031da78d8271b8d57a0e2cd33b6c7d6e4231421.tar.xz
(svn r10695) -Fix [FS#1079]: building single pieces of road over tramtrack or vice versa on slopes did not work as expected.
-rw-r--r--src/road_cmd.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 36336c33c..423086645 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -298,10 +298,11 @@ static CommandCost CheckRoadSlope(Slope tileh, RoadBits* pieces, RoadBits existi
RoadBits road_bits;
if (IsSteepSlope(tileh)) {
- if (existing == 0) {
- /* force full pieces. */
- *pieces |= (RoadBits)((*pieces & 0xC) >> 2);
- *pieces |= (RoadBits)((*pieces & 0x3) << 2);
+ /* force full pieces. */
+ *pieces |= (RoadBits)((*pieces & 0xC) >> 2);
+ *pieces |= (RoadBits)((*pieces & 0x3) << 2);
+
+ if (existing == 0 || existing == *pieces) {
if (*pieces == ROAD_X || *pieces == ROAD_Y) return _price.terraform;
}
return CMD_ERROR;
@@ -320,11 +321,12 @@ static CommandCost CheckRoadSlope(Slope tileh, RoadBits* pieces, RoadBits existi
return CommandCost(existing != 0 ? 0 : _price.terraform);
}
+ *pieces |= (RoadBits)((*pieces & 0xC) >> 2);
+ *pieces |= (RoadBits)((*pieces & 0x3) << 2);
+
/* partly leveled up tile, only if there's no road on that tile */
- if (existing == 0 && (tileh == SLOPE_W || tileh == SLOPE_S || tileh == SLOPE_E || tileh == SLOPE_N)) {
+ if ((existing == 0 || existing == *pieces) && (tileh == SLOPE_W || tileh == SLOPE_S || tileh == SLOPE_E || tileh == SLOPE_N)) {
/* force full pieces. */
- *pieces |= (RoadBits)((*pieces & 0xC) >> 2);
- *pieces |= (RoadBits)((*pieces & 0x3) << 2);
if (*pieces == ROAD_X || *pieces == ROAD_Y) return _price.terraform;
}
return CMD_ERROR;