summaryrefslogtreecommitdiff
path: root/tunnelbridge_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-05-20 18:03:22 +0000
committertron <tron@openttd.org>2006-05-20 18:03:22 +0000
commitb95c1faca95706c7e031f7cb59470726f72de7f1 (patch)
treeb71187cde11be0fb6787e8e38ea4f3df457d9598 /tunnelbridge_cmd.c
parentd508e76ada3854bcae784581fe073c26b5d09edc (diff)
downloadopenttd-b95c1faca95706c7e031f7cb59470726f72de7f1.tar.xz
(svn r4927) Replace 3 big ifs (which regard foundations) by a bit less confusing code
Diffstat (limited to 'tunnelbridge_cmd.c')
-rw-r--r--tunnelbridge_cmd.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index cde1d5f0e..858465aaa 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -858,23 +858,20 @@ static void DrawBridgePillars(PalSpriteID image, const TileInfo *ti, int x, int
uint GetBridgeFoundation(Slope tileh, Axis axis)
{
- int i;
+ uint i;
+
if (HASBIT(BRIDGE_FULL_LEVELED_FOUNDATION, tileh)) return tileh;
// inclined sloped building
- if ((
- (i = 0, tileh == SLOPE_W) ||
- (i += 2, tileh == SLOPE_S) ||
- (i += 2, tileh == SLOPE_E) ||
- (i += 2, tileh == SLOPE_N)
- ) && (
- axis == AXIS_X ||
- (i++, axis == AXIS_Y)
- )) {
- return i + 15;
+ switch (tileh) {
+ case SLOPE_W: i = 0; break;
+ case SLOPE_S: i = 2; break;
+ case SLOPE_E: i = 4; break;
+ case SLOPE_N: i = 6; break;
+ default: return 0;
}
-
- return 0;
+ if (axis != AXIS_X) ++i;
+ return i + 15;
}
/**