# HG changeset patch # User celestar # Date 1167483345 0 # Node ID 51f241d43769976d6ebc545e8eb154a6005f2ec7 # Parent bac9ab186cab240e0c693d5c293a4402b227047d (svn r7646) [cbh] - Feature: Allow building additional tracks on a (horizontal) bridge ramp using normal building tools diff -r bac9ab186cab -r 51f241d43769 ai/trolly/pathfinder.c --- a/ai/trolly/pathfinder.c Sat Dec 30 12:49:54 2006 +0000 +++ b/ai/trolly/pathfinder.c Sat Dec 30 12:55:45 2006 +0000 @@ -2,7 +2,6 @@ #include "../../stdafx.h" #include "../../openttd.h" -#include "../../bridge_map.h" #include "../../debug.h" #include "../../functions.h" #include "../../map.h" diff -r bac9ab186cab -r 51f241d43769 bridge_cmd.c --- a/bridge_cmd.c Sat Dec 30 12:49:54 2006 +0000 +++ b/bridge_cmd.c Sat Dec 30 12:55:45 2006 +0000 @@ -76,18 +76,6 @@ } } -#define M(x) (1 << (x)) -enum { - // foundation, whole tile is leveled up --> 3 corners raised - BRIDGE_FULL_LEVELED_FOUNDATION = M(SLOPE_WSE) | M(SLOPE_NWS) | M(SLOPE_ENW) | M(SLOPE_SEN), - // foundation, tile is partly leveled up --> 1 corner raised - BRIDGE_PARTLY_LEVELED_FOUNDATION = M(SLOPE_W) | M(SLOPE_S) | M(SLOPE_E) | M(SLOPE_N), - // no foundations (X,Y direction) - BRIDGE_NO_FOUNDATION = M(SLOPE_FLAT) | M(SLOPE_SW) | M(SLOPE_SE) | M(SLOPE_NW) | M(SLOPE_NE), - BRIDGE_HORZ_RAMP = (BRIDGE_PARTLY_LEVELED_FOUNDATION | BRIDGE_NO_FOUNDATION) & ~M(SLOPE_FLAT) -}; -#undef M - static inline const PalSpriteID *GetBridgeSpriteTable(int index, byte table) { const Bridge *bridge = &_bridge[index]; diff -r bac9ab186cab -r 51f241d43769 bridge_map.h --- a/bridge_map.h Sat Dec 30 12:49:54 2006 +0000 +++ b/bridge_map.h Sat Dec 30 12:55:45 2006 +0000 @@ -13,6 +13,18 @@ void DrawBridgeMiddle(const TileInfo* ti); // XXX +#define M(x) (1 << (x)) +enum { + // foundation, whole tile is leveled up --> 3 corners raised + BRIDGE_FULL_LEVELED_FOUNDATION = M(SLOPE_WSE) | M(SLOPE_NWS) | M(SLOPE_ENW) | M(SLOPE_SEN), + // foundation, tile is partly leveled up --> 1 corner raised + BRIDGE_PARTLY_LEVELED_FOUNDATION = M(SLOPE_W) | M(SLOPE_S) | M(SLOPE_E) | M(SLOPE_N), + // no foundations (X,Y direction) + BRIDGE_NO_FOUNDATION = M(SLOPE_FLAT) | M(SLOPE_SW) | M(SLOPE_SE) | M(SLOPE_NW) | M(SLOPE_NE), + BRIDGE_HORZ_RAMP = (BRIDGE_PARTLY_LEVELED_FOUNDATION | BRIDGE_NO_FOUNDATION) & ~M(SLOPE_FLAT) +}; +#undef M + static inline bool IsBridgeTile(TileIndex t) { diff -r bac9ab186cab -r 51f241d43769 rail_cmd.c --- a/rail_cmd.c Sat Dec 30 12:49:54 2006 +0000 +++ b/rail_cmd.c Sat Dec 30 12:55:45 2006 +0000 @@ -247,6 +247,13 @@ SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); switch (GetTileType(tile)) { + case MP_RAILWAY_BRIDGE: + /* We can build custombridgeheads only if we have a horizontal ramp ... */ + if (!HASBIT(BRIDGE_HORZ_RAMP, tileh)) return CMD_ERROR; + + /* In which case we can assume the tile to be flat */ + tileh = 0; + /* FALL THROUGH */ case MP_RAILWAY: if (!CheckTrackCombination(tile, trackbit, flags) || !EnsureNoVehicle(tile)) {