Index: findversion.sh =================================================================== --- findversion.sh (revision 27396) +++ findversion.sh (working copy) @@ -76,9 +76,9 @@ MODIFIED="2" fi # Find the revision like: rXXXXM-branch - BRANCH=`LC_ALL=C svn info | "$AWK" '/^URL:.*branches/ { split($2, a, "/"); for(i in a) if (a[i]=="branches") { print a[i+1]; break } }'` - TAG=`LC_ALL=C svn info | "$AWK" '/^URL:.*tags/ { split($2, a, "/"); for(i in a) if (a[i]=="tags") { print a[i+1]; break } }'` - REV_NR=`LC_ALL=C svn info | "$AWK" '/^Last Changed Rev:/ { print $4 }'` + BRANCH=`svn info | "$AWK" '/^URL:.*branches/ { split($2, a, "/"); for(i in a) if (a[i]=="branches") { print a[i+1]; break } }'` + TAG=`svn info | "$AWK" '/^URL:.*tags/ { split($2, a, "/"); for(i in a) if (a[i]=="tags") { print a[i+1]; break } }'` + REV_NR=`svn info | "$AWK" '/^Last Changed Rev:/ { print $4 }'` if [ -n "$TAG" ]; then REV=$TAG else Index: src/newgrf_commons.cpp =================================================================== --- src/newgrf_commons.cpp (revision 27396) +++ src/newgrf_commons.cpp (working copy) @@ -364,7 +364,11 @@ /* During map generation the snowstate may not be valid yet, as the tileloop may not have run yet. */ if (_generating_world) goto genworld; // we do not care about foundations here RailGroundType ground = GetRailGroundType(tile); - has_snow = (ground == RAIL_GROUND_ICE_DESERT || (context == TCX_UPPER_HALFTILE && ground == RAIL_GROUND_HALF_SNOW)); + has_snow = ( (ground == RAIL_GROUND_ICE_DESERT || + ground == RAIL_GROUND_ICE_DESERT_FENCE_1 || + ground == RAIL_GROUND_ICE_DESERT_FENCE_2 || + ground == RAIL_GROUND_ICE_DESERT_FENCE_1_2) || + (context == TCX_UPPER_HALFTILE && (ground == RAIL_GROUND_HALF_SNOW || ground == RAIL_GROUND_HALF_SNOW_FENCE))); break; } Index: src/rail_cmd.cpp =================================================================== --- src/rail_cmd.cpp (revision 27396) +++ src/rail_cmd.cpp (working copy) @@ -746,7 +746,7 @@ if (IsNonContinuousFoundation(GetRailFoundation(tileh, rail_bits))) { flooded = true; - SetRailGroundType(t, RAIL_GROUND_WATER); + SetRailGroundType(t, RAIL_GROUND_WATER_FENCE); MarkTileDirtyByTile(t); } } else { @@ -754,7 +754,7 @@ if (ApplyFoundationToSlope(GetRailFoundation(tileh, rail_bits), &tileh) == 0) { if (IsSteepSlope(tileh) || IsSlopeWithThreeCornersRaised(tileh)) { flooded = true; - SetRailGroundType(t, RAIL_GROUND_WATER); + SetRailGroundType(t, RAIL_GROUND_WATER_FENCE); MarkTileDirtyByTile(t); } } @@ -1966,6 +1966,35 @@ } /** + * Determine direction of fence + * @param tile - tile with rails + * @return rail fence direction + */ +static byte DetermineFenceDirection(TileIndex tile) +{ + TrackBits rail = GetTrackBits(tile); + + Owner owner = GetTileOwner(tile); + byte fences = 0; + + for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) { + static const TrackBits dir_to_trackbits[DIAGDIR_END] = {TRACK_BIT_3WAY_NE, TRACK_BIT_3WAY_SE, TRACK_BIT_3WAY_SW, TRACK_BIT_3WAY_NW}; + + // Track bit on this edge => no fence. + if ((rail & dir_to_trackbits[d]) != TRACK_BIT_NONE) continue; + + TileIndex tile2 = tile + TileOffsByDiagDir(d); + + // Show fences if it's a house, industry, object, road, tunnelbridge or not owned by us. + if (!IsValidTile(tile2) || IsTileType(tile2, MP_HOUSE) || IsTileType(tile2, MP_INDUSTRY) || + IsTileType(tile2, MP_ROAD) || (IsTileType(tile2, MP_OBJECT) && !IsObjectType(tile2, OBJECT_OWNED_LAND)) || IsTileType(tile2, MP_TUNNELBRIDGE) || !IsTileOwner(tile2, owner)) { + fences |= 1 << d; + } + } + return fences; +} + +/** * Draw track fences. * @param ti Tile drawing information. * @param rti Rail type information. @@ -1984,19 +2013,108 @@ assert(num_sprites > 0); switch (GetRailGroundType(ti->tile)) { - case RAIL_GROUND_FENCE_NW: DrawTrackFence_NW(ti, base_image, num_sprites); break; - case RAIL_GROUND_FENCE_SE: DrawTrackFence_SE(ti, base_image, num_sprites); break; - case RAIL_GROUND_FENCE_SENW: DrawTrackFence_NW(ti, base_image, num_sprites); - DrawTrackFence_SE(ti, base_image, num_sprites); break; - case RAIL_GROUND_FENCE_NE: DrawTrackFence_NE(ti, base_image, num_sprites); break; - case RAIL_GROUND_FENCE_SW: DrawTrackFence_SW(ti, base_image, num_sprites); break; - case RAIL_GROUND_FENCE_NESW: DrawTrackFence_NE(ti, base_image, num_sprites); - DrawTrackFence_SW(ti, base_image, num_sprites); break; - case RAIL_GROUND_FENCE_VERT1: DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_LEFT); break; - case RAIL_GROUND_FENCE_VERT2: DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_RIGHT); break; - case RAIL_GROUND_FENCE_HORIZ1: DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_UPPER); break; - case RAIL_GROUND_FENCE_HORIZ2: DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_LOWER); break; - case RAIL_GROUND_WATER: { + // No fences on this grounds + case RAIL_GROUND_BARREN: + case RAIL_GROUND_GRASS: + case RAIL_GROUND_ICE_DESERT: + case RAIL_GROUND_HALF_SNOW: + case RAIL_GROUND_WATER: + break; + + // Drawing only fence 1 + case RAIL_GROUND_GRASS_FENCE_1: + case RAIL_GROUND_ICE_DESERT_FENCE_1: { + byte fences = DetermineFenceDirection(ti->tile); + + switch (fences) { + case (1 << DIAGDIR_SE): + DrawTrackFence_SE(ti, base_image, num_sprites); + break; + case (1 << DIAGDIR_SW): + DrawTrackFence_SW(ti, base_image, num_sprites); + break; + case (1 << DIAGDIR_SW) | (1 << DIAGDIR_NW): + DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_RIGHT); + break; + case (1 << DIAGDIR_NE) | (1 << DIAGDIR_NW): + DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_LOWER); + break; + default: + break; + } + break; + } + + //Drawing only fence 2 + case RAIL_GROUND_GRASS_FENCE_2: + case RAIL_GROUND_ICE_DESERT_FENCE_2: { + byte fences = DetermineFenceDirection(ti->tile); + + switch (fences) { + case (1 << DIAGDIR_NE): + DrawTrackFence_NE(ti, base_image, num_sprites); + break; + case (1 << DIAGDIR_NW): + DrawTrackFence_NW(ti, base_image, num_sprites); + break; + case (1 << DIAGDIR_NE) | (1 << DIAGDIR_SE): + DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_LEFT); + break; + case (1 << DIAGDIR_SE) | (1 << DIAGDIR_SW): + DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_UPPER); + break; + default: + break; + } + break; + } + + //Drawing fence 1 and 2 + case RAIL_GROUND_GRASS_FENCE_1_2: + case RAIL_GROUND_ICE_DESERT_FENCE_1_2: + case RAIL_GROUND_HALF_SNOW_FENCE: { + byte fences = DetermineFenceDirection(ti->tile); + + switch (fences) { + case (1 << DIAGDIR_SE): + DrawTrackFence_SE(ti, base_image, num_sprites); + break; + case (1 << DIAGDIR_SW): + DrawTrackFence_SW(ti, base_image, num_sprites); + break; + case (1 << DIAGDIR_SW) | (1 << DIAGDIR_NW): + DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_RIGHT); + break; + case (1 << DIAGDIR_NE) | (1 << DIAGDIR_NW): + DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_LOWER); + break; + case (1 << DIAGDIR_NE): + DrawTrackFence_NE(ti, base_image, num_sprites); + break; + case (1 << DIAGDIR_NW): + DrawTrackFence_NW(ti, base_image, num_sprites); + break; + case (1 << DIAGDIR_NE) | (1 << DIAGDIR_SE): + DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_LEFT); + break; + case (1 << DIAGDIR_SE) | (1 << DIAGDIR_SW): + DrawTrackFence(ti, base_image, num_sprites, RFO_FLAT_UPPER); + break; + case (1 << DIAGDIR_NE) | (1 << DIAGDIR_SW): + DrawTrackFence_NE(ti, base_image, num_sprites); + DrawTrackFence_SW(ti, base_image, num_sprites); + break; + case (1 << DIAGDIR_SE) | (1 << DIAGDIR_NW): + DrawTrackFence_SE(ti, base_image, num_sprites); + DrawTrackFence_NW(ti, base_image, num_sprites); + break; + default: + break; + } + break; + } + + case RAIL_GROUND_WATER_FENCE: { Corner track_corner; if (IsHalftileSlope(ti->tileh)) { /* Steep slope or one-corner-raised slope with halftile foundation */ @@ -2050,7 +2168,7 @@ /* DrawFoundation modifies ti */ /* Draw ground */ - if (rgt == RAIL_GROUND_WATER) { + if (rgt == RAIL_GROUND_WATER || rgt == RAIL_GROUND_WATER_FENCE) { if (track != TRACK_BIT_NONE || IsSteepSlope(ti->tileh)) { /* three-corner-raised slope or steep slope with track on upper part */ DrawShoreTile(ti->tileh); @@ -2063,8 +2181,11 @@ switch (rgt) { case RAIL_GROUND_BARREN: image = SPR_FLAT_BARE_LAND; break; - case RAIL_GROUND_ICE_DESERT: image = SPR_FLAT_SNOW_DESERT_TILE; break; - default: image = SPR_FLAT_GRASS_TILE; break; + case RAIL_GROUND_ICE_DESERT: + case RAIL_GROUND_ICE_DESERT_FENCE_1: + case RAIL_GROUND_ICE_DESERT_FENCE_2: + case RAIL_GROUND_ICE_DESERT_FENCE_1_2: image = SPR_FLAT_SNOW_DESERT_TILE; break; + default: image = SPR_FLAT_GRASS_TILE; break; } image += SlopeToSpriteOffset(ti->tileh); @@ -2153,6 +2274,10 @@ switch (rgt) { case RAIL_GROUND_BARREN: image = SPR_FLAT_BARE_LAND; break; case RAIL_GROUND_ICE_DESERT: + case RAIL_GROUND_ICE_DESERT_FENCE_1: + case RAIL_GROUND_ICE_DESERT_FENCE_2: + case RAIL_GROUND_ICE_DESERT_FENCE_1_2: + case RAIL_GROUND_HALF_SNOW_FENCE: case RAIL_GROUND_HALF_SNOW: image = SPR_FLAT_SNOW_DESERT_TILE; break; default: image = SPR_FLAT_GRASS_TILE; break; } @@ -2216,7 +2341,7 @@ /* Select the sprite to use. */ if (track == 0) { /* Clear ground (only track on halftile foundation) */ - if (rgt == RAIL_GROUND_WATER) { + if (rgt == RAIL_GROUND_WATER || rgt == RAIL_GROUND_WATER_FENCE) { if (IsSteepSlope(ti->tileh)) { DrawShoreTile(ti->tileh); image = 0; @@ -2225,9 +2350,20 @@ } } else { switch (rgt) { - case RAIL_GROUND_BARREN: image = SPR_FLAT_BARE_LAND; break; - case RAIL_GROUND_ICE_DESERT: image = SPR_FLAT_SNOW_DESERT_TILE; break; - default: image = SPR_FLAT_GRASS_TILE; break; + case RAIL_GROUND_BARREN: + image = SPR_FLAT_BARE_LAND; + break; + + case RAIL_GROUND_ICE_DESERT: + case RAIL_GROUND_ICE_DESERT_FENCE_1: + case RAIL_GROUND_ICE_DESERT_FENCE_2: + case RAIL_GROUND_ICE_DESERT_FENCE_1_2: + image = SPR_FLAT_SNOW_DESERT_TILE; + break; + + default: + image = SPR_FLAT_GRASS_TILE; + break; } image += SlopeToSpriteOffset(ti->tileh); } @@ -2258,7 +2394,10 @@ switch (rgt) { case RAIL_GROUND_BARREN: pal = PALETTE_TO_BARE_LAND; break; - case RAIL_GROUND_ICE_DESERT: image += rti->snow_offset; break; + case RAIL_GROUND_ICE_DESERT: + case RAIL_GROUND_ICE_DESERT_FENCE_1: + case RAIL_GROUND_ICE_DESERT_FENCE_2: + case RAIL_GROUND_ICE_DESERT_FENCE_1_2: image += rti->snow_offset; break; case RAIL_GROUND_WATER: { /* three-corner-raised slope */ DrawShoreTile(ti->tileh); @@ -2316,7 +2455,11 @@ switch (rgt) { case RAIL_GROUND_BARREN: pal = PALETTE_TO_BARE_LAND; break; case RAIL_GROUND_ICE_DESERT: - case RAIL_GROUND_HALF_SNOW: image += rti->snow_offset; break; // higher part has snow in this case too + case RAIL_GROUND_ICE_DESERT_FENCE_1: + case RAIL_GROUND_ICE_DESERT_FENCE_2: + case RAIL_GROUND_ICE_DESERT_FENCE_1_2: + case RAIL_GROUND_HALF_SNOW: + case RAIL_GROUND_HALF_SNOW_FENCE: image += rti->snow_offset; break; // higher part has snow in this case too default: break; } DrawGroundSprite(image, pal, &(_halftile_sub_sprite[halftile_corner])); @@ -2560,9 +2703,31 @@ if (z > GetSnowLine()) { if (half && z - GetSnowLine() == 1) { /* track on non-continuous foundation, lower part is not under snow */ - new_ground = RAIL_GROUND_HALF_SNOW; + if (old_ground == RAIL_GROUND_HALF_SNOW) + new_ground = RAIL_GROUND_HALF_SNOW_FENCE; + else + new_ground = RAIL_GROUND_HALF_SNOW; } else { - new_ground = RAIL_GROUND_ICE_DESERT; + switch (old_ground) { + case RAIL_GROUND_ICE_DESERT: + // TODO: + // make to random select _FENCE_1 or _FENCE_2 + new_ground = RAIL_GROUND_ICE_DESERT_FENCE_1; + break; + + case RAIL_GROUND_ICE_DESERT_FENCE_1: + case RAIL_GROUND_ICE_DESERT_FENCE_2: + case RAIL_GROUND_ICE_DESERT_FENCE_1_2: + new_ground = RAIL_GROUND_ICE_DESERT_FENCE_1_2; + break; + + case RAIL_GROUND_BARREN: + new_ground = RAIL_GROUND_ICE_DESERT; + break; + + default: + NOT_REACHED(); + } } goto set_ground; } @@ -2579,42 +2744,29 @@ new_ground = RAIL_GROUND_GRASS; - if (IsPlainRail(tile) && old_ground != RAIL_GROUND_BARREN) { // wait until bottom is green - /* determine direction of fence */ - TrackBits rail = GetTrackBits(tile); - - Owner owner = GetTileOwner(tile); - byte fences = 0; - - for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) { - static const TrackBits dir_to_trackbits[DIAGDIR_END] = {TRACK_BIT_3WAY_NE, TRACK_BIT_3WAY_SE, TRACK_BIT_3WAY_SW, TRACK_BIT_3WAY_NW}; - - /* Track bit on this edge => no fence. */ - if ((rail & dir_to_trackbits[d]) != TRACK_BIT_NONE) continue; - - TileIndex tile2 = tile + TileOffsByDiagDir(d); - - /* Show fences if it's a house, industry, object, road, tunnelbridge or not owned by us. */ - if (!IsValidTile(tile2) || IsTileType(tile2, MP_HOUSE) || IsTileType(tile2, MP_INDUSTRY) || - IsTileType(tile2, MP_ROAD) || (IsTileType(tile2, MP_OBJECT) && !IsObjectType(tile2, OBJECT_OWNED_LAND)) || IsTileType(tile2, MP_TUNNELBRIDGE) || !IsTileOwner(tile2, owner)) { - fences |= 1 << d; - } + if (IsPlainRail(tile)) { + switch (old_ground) { + case RAIL_GROUND_BARREN: + new_ground = RAIL_GROUND_GRASS; + break; + + case RAIL_GROUND_GRASS: + // TODO: + // make randon select of _FENCE_1 or _FENCE_2; + new_ground = RAIL_GROUND_GRASS_FENCE_1; + break; + + case RAIL_GROUND_GRASS_FENCE_1: + case RAIL_GROUND_GRASS_FENCE_2: + case RAIL_GROUND_GRASS_FENCE_1_2: + new_ground = RAIL_GROUND_GRASS_FENCE_1_2; + break; + + default: + NOT_REACHED(); } - - switch (fences) { - case 0: break; - case (1 << DIAGDIR_NE): new_ground = RAIL_GROUND_FENCE_NE; break; - case (1 << DIAGDIR_SE): new_ground = RAIL_GROUND_FENCE_SE; break; - case (1 << DIAGDIR_SW): new_ground = RAIL_GROUND_FENCE_SW; break; - case (1 << DIAGDIR_NW): new_ground = RAIL_GROUND_FENCE_NW; break; - case (1 << DIAGDIR_NE) | (1 << DIAGDIR_SW): new_ground = RAIL_GROUND_FENCE_NESW; break; - case (1 << DIAGDIR_SE) | (1 << DIAGDIR_NW): new_ground = RAIL_GROUND_FENCE_SENW; break; - case (1 << DIAGDIR_NE) | (1 << DIAGDIR_SE): new_ground = RAIL_GROUND_FENCE_VERT1; break; - case (1 << DIAGDIR_NE) | (1 << DIAGDIR_NW): new_ground = RAIL_GROUND_FENCE_HORIZ2; break; - case (1 << DIAGDIR_SE) | (1 << DIAGDIR_SW): new_ground = RAIL_GROUND_FENCE_HORIZ1; break; - case (1 << DIAGDIR_SW) | (1 << DIAGDIR_NW): new_ground = RAIL_GROUND_FENCE_VERT2; break; - default: NOT_REACHED(); - } + } else { + new_ground = RAIL_GROUND_GRASS; } set_ground: Index: src/rail_map.h =================================================================== --- src/rail_map.h (revision 27396) +++ src/rail_map.h (working copy) @@ -484,21 +484,19 @@ /** The ground 'under' the rail */ enum RailGroundType { - RAIL_GROUND_BARREN = 0, ///< Nothing (dirt) - RAIL_GROUND_GRASS = 1, ///< Grassy - RAIL_GROUND_FENCE_NW = 2, ///< Grass with a fence at the NW edge - RAIL_GROUND_FENCE_SE = 3, ///< Grass with a fence at the SE edge - RAIL_GROUND_FENCE_SENW = 4, ///< Grass with a fence at the NW and SE edges - RAIL_GROUND_FENCE_NE = 5, ///< Grass with a fence at the NE edge - RAIL_GROUND_FENCE_SW = 6, ///< Grass with a fence at the SW edge - RAIL_GROUND_FENCE_NESW = 7, ///< Grass with a fence at the NE and SW edges - RAIL_GROUND_FENCE_VERT1 = 8, ///< Grass with a fence at the eastern side - RAIL_GROUND_FENCE_VERT2 = 9, ///< Grass with a fence at the western side - RAIL_GROUND_FENCE_HORIZ1 = 10, ///< Grass with a fence at the southern side - RAIL_GROUND_FENCE_HORIZ2 = 11, ///< Grass with a fence at the northern side - RAIL_GROUND_ICE_DESERT = 12, ///< Icy or sandy - RAIL_GROUND_WATER = 13, ///< Grass with a fence and shore or water on the free halftile - RAIL_GROUND_HALF_SNOW = 14, ///< Snow only on higher part of slope (steep or one corner raised) + RAIL_GROUND_BARREN = 0, ///< Nothing (dirt) + RAIL_GROUND_GRASS = 1, ///< Grassy, no fence + RAIL_GROUND_GRASS_FENCE_1 = 2, ///< Grass with a fence 1 + RAIL_GROUND_GRASS_FENCE_2 = 3, ///< Grass with a fence 2 + RAIL_GROUND_GRASS_FENCE_1_2 = 4, ///< Grass with a fence 1 and 2 + RAIL_GROUND_ICE_DESERT = 5, ///< Snow or desert, no fence + RAIL_GROUND_ICE_DESERT_FENCE_1 = 6, ///< Snow or desert with a fence 1 + RAIL_GROUND_ICE_DESERT_FENCE_2 = 7, ///< Snow or desert with a fence 2 + RAIL_GROUND_ICE_DESERT_FENCE_1_2 = 8, ///< Snow or desert with a fence 1 and 2 + RAIL_GROUND_HALF_SNOW = 9, ///< Half snow tile + RAIL_GROUND_HALF_SNOW_FENCE = 10, ///< Half snow tile with a fence + RAIL_GROUND_WATER = 11, ///< Grass with shore or water on the free halftile + RAIL_GROUND_WATER_FENCE = 12, ///< Grass with a fence and shore or water on the free halftile }; static inline void SetRailGroundType(TileIndex t, RailGroundType rgt) @@ -513,7 +511,10 @@ static inline bool IsSnowRailGround(TileIndex t) { - return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT; + return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT || + GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT_FENCE_1 || + GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT_FENCE_2 || + GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT_FENCE_1_2; } Index: src/saveload/afterload.cpp =================================================================== --- src/saveload/afterload.cpp (revision 27396) +++ src/saveload/afterload.cpp (working copy) @@ -55,6 +55,7 @@ #include "../order_backup.h" #include "../error.h" #include "../disaster_vehicle.h" +#include "../rail_map.h" #include "saveload_internal.h" @@ -2951,6 +2952,28 @@ } } + // Replacing for all rail tiles ground bits + if (IsSavegameVersionBefore(195)) { + TileIndex tile; + RailGroundType rgt; + for (tile = 0; tile < MapSize(); tile++){ + if (IsPlainRailTile(tile)) { + rgt = GetRailGroundType(tile); + + if (rgt >= 1 && rgt <= 11) + rgt = (RailGroundType)1; + else if (rgt == 12) + rgt = (RailGroundType)5; + else if (rgt == 13) + rgt = (RailGroundType)11; + else if (rgt == 14) + rgt = (RailGroundType)9; + + SetRailGroundType(tile, rgt); + } + } + } + /* * Only keep order-backups for network clients (and when replaying). * If we are a network server or not networking, then we just loaded a previously Index: src/saveload/saveload.cpp =================================================================== --- src/saveload/saveload.cpp (revision 27396) +++ src/saveload/saveload.cpp (working copy) @@ -263,7 +263,7 @@ * 193 26802 * 194 26881 1.5.x */ -extern const uint16 SAVEGAME_VERSION = 194; ///< Current savegame version of OpenTTD. +extern const uint16 SAVEGAME_VERSION = 195; ///< Current savegame version of OpenTTD. SavegameType _savegame_type; ///< type of savegame we are loading Index: src/water_cmd.cpp =================================================================== --- src/water_cmd.cpp (revision 27396) +++ src/water_cmd.cpp (working copy) @@ -1113,13 +1113,18 @@ assert(GetRailGroundType(tile) == RAIL_GROUND_WATER); RailGroundType new_ground; - switch (GetTrackBits(tile)) { + if (GetTileZ(tile) > GetSnowLine() || GetTropicZone(tile) == TROPICZONE_DESERT){ + new_ground = RAIL_GROUND_ICE_DESERT_FENCE_1_2; + } else { + new_ground = RAIL_GROUND_GRASS_FENCE_1_2; + } +/* switch (GetTrackBits(tile)) { case TRACK_BIT_UPPER: new_ground = RAIL_GROUND_FENCE_HORIZ1; break; case TRACK_BIT_LOWER: new_ground = RAIL_GROUND_FENCE_HORIZ2; break; case TRACK_BIT_LEFT: new_ground = RAIL_GROUND_FENCE_VERT1; break; case TRACK_BIT_RIGHT: new_ground = RAIL_GROUND_FENCE_VERT2; break; default: NOT_REACHED(); - } + }*/ SetRailGroundType(tile, new_ground); MarkTileDirtyByTile(tile); break;