Go to the documentation of this file.
35 #include "table/strings.h"
45 std::vector<RailType> _sorted_railtypes;
71 {0,0,0,0,0,0,0,0,0,0,0,0},
75 0,
RAILTYPES_NONE,
RAILTYPES_NONE, 0, 0, 0,
RTFB_NONE, 0, 0, 0, 0, 0,
78 for (; i <
lengthof(_railtypes); i++) _railtypes[i] = empty_railtype;
86 if (cursors_base != 0) {
106 const SpriteID _signal_lookup[2][SIGTYPE_END] = {
107 {SPR_IMG_SIGNAL_ELECTRIC_NORM, SPR_IMG_SIGNAL_ELECTRIC_ENTRY, SPR_IMG_SIGNAL_ELECTRIC_EXIT,
108 SPR_IMG_SIGNAL_ELECTRIC_COMBO, SPR_IMG_SIGNAL_ELECTRIC_PBS, SPR_IMG_SIGNAL_ELECTRIC_PBS_OWAY},
110 {SPR_IMG_SIGNAL_SEMAPHORE_NORM, SPR_IMG_SIGNAL_SEMAPHORE_ENTRY, SPR_IMG_SIGNAL_SEMAPHORE_EXIT,
111 SPR_IMG_SIGNAL_SEMAPHORE_COMBO, SPR_IMG_SIGNAL_SEMAPHORE_PBS, SPR_IMG_SIGNAL_SEMAPHORE_PBS_OWAY},
118 rti->
gui_sprites.
signals[type][var][0] = (red != 0) ? red + SIGNAL_TO_SOUTH : _signal_lookup[var][type];
119 rti->
gui_sprites.
signals[type][var][1] = (green != 0) ? green + SIGNAL_TO_SOUTH : _signal_lookup[var][type] + 1;
142 ResolveRailTypeGUISprites(rti);
146 _sorted_railtypes.clear();
148 if (_railtypes[rt].label != 0 && !
HasBit(_railtypes_hidden_mask, rt)) {
149 _sorted_railtypes.push_back(rt);
152 std::sort(_sorted_railtypes.begin(), _sorted_railtypes.end(),
CompareRailTypes);
163 if (rti->
label == 0) {
190 static const byte _track_sloped_sprites[14] = {
260 if (current == future) {
421 static inline bool ValParamTrackOrientation(
Track track)
439 RailType railtype = Extract<RailType, 0, 6>(p1);
440 Track track = Extract<Track, 0, 3>(p2);
441 bool auto_remove_signals =
HasBit(p2, 3);
452 if (ret.
Failed())
return ret;
460 if (ret.
Failed())
return ret;
463 if (ret.
Failed())
return ret;
468 if (!auto_remove_signals)
return_cmd_error(STR_ERROR_MUST_REMOVE_SIGNALS_FIRST);
473 if (ret_remove_signals.
Failed())
return ret_remove_signals;
474 cost.
AddCost(ret_remove_signals);
485 if (ret.
Failed())
return ret;
514 if (ret.
Failed())
return ret;
523 RoadType roadtype_road = GetRoadTypeRoad(tile);
524 RoadType roadtype_tram = GetRoadTypeTram(tile);
539 if (ret.
Failed())
return ret;
543 if (num_new_road_pieces > 0) {
548 if (num_new_tram_pieces > 0) {
558 Company::Get(road_owner)->infrastructure.road[roadtype_road] += num_new_road_pieces;
562 Company::Get(tram_owner)->infrastructure.road[roadtype_tram] += num_new_tram_pieces;
581 if (ret.
Failed())
return ret;
585 if (ret.
Failed())
return ret;
589 cost.
AddCost(-_price[PR_CLEAR_WATER]);
590 cost.
AddCost(_price[PR_CLEAR_ROUGH]);
627 Track track = Extract<Track, 0, 3>(p2);
629 bool crossing =
false;
631 if (!ValParamTrackOrientation(track))
return CMD_ERROR;
648 if (ret.
Failed())
return ret;
653 if (ret.
Failed())
return ret;
680 if (ret.
Failed())
return ret;
684 if (ret.
Failed())
return ret;
687 if ((present & trackbit) == 0)
return_cmd_error(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK);
775 bool flooded =
false;
784 TrackBits to_remove = lower_track & rail_bits;
785 if (to_remove != 0) {
789 if (!flooded)
return flooded;
790 rail_bits = rail_bits & ~to_remove;
791 if (rail_bits == 0) {
817 { -1, 0 }, { 0, 1 }, { -1, 0 }, { 0, 1 }, { 1, 0 }, { 0, 1 },
820 { 1, 0 }, { 0, -1 }, { 0, -1 }, { 1, 0 }, { 0, -1 }, { -1, 0 },
828 int x =
TileX(start);
829 int y =
TileY(start);
840 int trdx = _trackdelta[*trackdir].
x;
841 int trdy = _trackdelta[*trackdir].
y;
844 trdx += _trackdelta[*trackdir ^ 1].
x;
845 trdy += _trackdelta[*trackdir ^ 1].
y;
849 while ((trdx <= 0 && dx > 0) ||
850 (trdx >= 0 && dx < 0) ||
851 (trdy <= 0 && dy > 0) ||
852 (trdy >= 0 && dy < 0)) {
853 if (!
HasBit(*trackdir, 3)) {
865 trdx = _trackdelta[*trackdir].
x;
866 trdy = _trackdelta[*trackdir].
y;
890 Track track = Extract<Track, 6, 3>(p2);
891 bool remove =
HasBit(p2, 9);
892 bool auto_remove_signals =
HasBit(p2, 11);
893 RailType railtype = Extract<RailType, 0, 6>(p2);
900 CommandCost ret = ValidateAutoDrag(&trackdir, tile, end_tile);
901 if (ret.
Failed())
return ret;
903 bool had_success =
false;
910 if (last_error.
GetErrorMessage() != STR_ERROR_ALREADY_BUILT && !remove) {
911 if (
HasBit(p2, 10))
return last_error;
916 if (last_error.
GetErrorMessage() == STR_ERROR_OWNED_BY && remove)
break;
922 if (tile == end_tile)
break;
930 if (had_success)
return total_cost;
987 RailType railtype = Extract<RailType, 0, 6>(p1);
1007 cost.
AddCost(_price[PR_BUILD_FOUNDATION]);
1011 if (cost.
Failed())
return cost;
1032 cost.
AddCost(_price[PR_BUILD_DEPOT_TRAIN]);
1060 Track track = Extract<Track, 0, 3>(p1);
1061 bool ctrl_pressed =
HasBit(p1, 3);
1063 SignalType sigtype = Extract<SignalType, 5, 3>(p1);
1064 bool convert_signal =
HasBit(p1, 8);
1065 SignalType cycle_start = Extract<SignalType, 9, 3>(p1);
1066 SignalType cycle_stop = Extract<SignalType, 12, 3>(p1);
1067 uint num_dir_cycle =
GB(p1, 15, 2);
1069 if (sigtype > SIGTYPE_LAST)
return CMD_ERROR;
1070 if (cycle_start > cycle_stop || cycle_stop > SIGTYPE_LAST)
return CMD_ERROR;
1081 if (ret.
Failed())
return ret;
1097 if (p2 != 0 && sigvar != GetSignalVariant(tile, track)) {
1101 }
else if (convert_signal) {
1103 if (ctrl_pressed || GetSignalVariant(tile, track) != sigvar) {
1132 SetSignalType(tile, track, sigtype);
1133 SetSignalVariant(tile, track, sigvar);
1143 SetSignalType(tile, track, sigtype);
1144 SetSignalVariant(tile, track, sigvar);
1145 while (num_dir_cycle-- > 0) CycleSignalSide(tile, track);
1147 if (convert_signal) {
1153 sigtype = GetSignalType(tile, track);
1156 SetSignalType(tile, track, sigtype);
1157 SetSignalVariant(tile, track, sigvar);
1163 }
else if (ctrl_pressed) {
1165 sigtype = (
SignalType)(GetSignalType(tile, track) + 1);
1167 if (sigtype < cycle_start || sigtype > cycle_stop) sigtype = cycle_start;
1169 SetSignalType(tile, track, sigtype);
1175 CycleSignalSide(tile, track);
1177 sigtype = GetSignalType(tile, track);
1184 SetSignalVariant(tile, track, sigvar);
1185 SetSignalType(tile, track, sigtype);
1192 if (IsPbsSignal(sigtype)) {
1212 static bool CheckSignalAutoFill(
TileIndex &tile,
Trackdir &trackdir,
int &signal_ctr,
bool remove)
1263 default:
return false;
1289 Track track = Extract<Track, 0, 3>(p2);
1290 bool mode =
HasBit(p2, 3);
1291 bool semaphores =
HasBit(p2, 4);
1292 bool remove =
HasBit(p2, 5);
1293 bool autofill =
HasBit(p2, 6);
1294 bool minimise_gaps =
HasBit(p2, 10);
1295 byte signal_density =
GB(p2, 24, 8);
1299 if (signal_density == 0 || signal_density > 20)
return CMD_ERROR;
1305 signal_density *= 2;
1308 CommandCost ret = ValidateAutoDrag(&trackdir, tile, end_tile);
1309 if (ret.
Failed())
return ret;
1312 Trackdir start_trackdir = trackdir;
1318 if (sigtype > SIGTYPE_LAST)
return CMD_ERROR;
1324 assert(signals != 0);
1327 semaphores = GetSignalVariant(tile, track) !=
SIG_ELECTRIC;
1329 sigtype = GetSignalType(tile, track);
1336 byte signal_dir = 0;
1353 int last_used_ctr = INT_MIN;
1354 int last_suitable_ctr = 0;
1358 bool had_success =
false;
1361 if (remove || minimise_gaps || signal_ctr % signal_density == 0) {
1364 SB(p1, 4, 1, semaphores);
1365 SB(p1, 5, 3, sigtype);
1366 if (!remove && signal_ctr == 0)
SetBit(p1, 17);
1374 bool test_only = !remove && minimise_gaps && signal_ctr < (last_used_ctr + signal_density);
1377 if (ret.Succeeded()) {
1379 last_suitable_ctr = signal_ctr;
1380 last_suitable_tile = tile;
1381 last_suitable_trackdir = trackdir;
1382 }
else if (!test_only && last_suitable_tile !=
INVALID_TILE) {
1398 if (ret.Succeeded()) {
1401 last_used_ctr = last_suitable_ctr;
1405 if (ret.GetErrorMessage() != STR_ERROR_THERE_IS_NO_RAILROAD_TRACK ||
1414 if (!CheckSignalAutoFill(tile, trackdir, signal_ctr, remove))
break;
1417 if (tile == start_tile && trackdir == start_trackdir)
break;
1419 if (tile == end_tile)
break;
1433 return had_success ? total_cost : last_error;
1473 Track track = Extract<Track, 0, 3>(p1);
1485 if (ret.
Failed())
return ret;
1493 }
else if (IsPbsSignal(GetSignalType(tile, track))) {
1496 for (
int i = 0; v ==
nullptr && i < 2; i++, td =
ReverseTrackdir(td)) {
1576 RailType totype = Extract<RailType, 0, 6>(p2);
1579 bool diagonal =
HasBit(p2, 6);
1588 bool found_convertible_track =
false;
1604 error.MakeError(STR_ERROR_CROSSING_DISALLOWED_RAIL);
1627 std::vector<Train *> vehicles_affected;
1647 vehicles_affected.push_back(v);
1684 found_convertible_track =
true;
1696 found_convertible_track =
true;
1707 if (endtile < tile) {
1731 vehicles_affected.push_back(v);
1759 found_convertible_track =
true;
1770 found_convertible_track =
true;
1775 for (uint i = 0; i < vehicles_affected.size(); ++i) {
1782 for (
Train *v : affected_trains) {
1788 return found_convertible_track ? cost :
error;
1795 if (ret.
Failed())
return ret;
1799 if (ret.
Failed())
return ret;
1815 delete Depot::GetByTile(tile);
1816 DoClearSquare(tile);
1852 if (ret.
Failed())
return ret;
1860 if (ret.
Failed())
return ret;
1865 DoClearSquare(tile);
1866 if (remove) RemoveDockingTile(tile);
1868 cost.AddCost(_price[PR_CLEAR_WATER]);
1875 return RemoveTrainDepot(tile, flags);
1895 return GetSlopePixelZ(x, y);
1902 case 0: side =
false;
break;
1903 case 2: side =
true;
break;
1906 static const Point SignalPositions[2][12] = {
1909 { 8, 5}, {14, 1}, { 1, 14}, { 9, 11}, { 1, 0}, { 3, 10},
1911 {11, 4}, {14, 14}, {11, 3}, { 4, 13}, { 3, 4}, {11, 13}
1914 {14, 1}, {12, 10}, { 4, 6}, { 1, 14}, {10, 4}, { 0, 1},
1916 {14, 14}, { 5, 12}, {11, 13}, { 4, 3}, {13, 4}, { 3, 11}
1923 SignalType type = GetSignalType(tile, track);
1932 sprite += type * 16 + variant * 64 + image * 2 + condition + (type > SIGTYPE_LAST_NOPBS ? 64 : 0);
1938 static uint32 _drawtile_track_palette;
1953 { CORNER_INVALID, 0, 1, 16, 1 },
1954 { CORNER_INVALID, 1, 0, 1, 16 },
1955 { CORNER_W, 8, 8, 1, 1 },
1956 { CORNER_N, 8, 8, 1, 1 },
1957 { CORNER_INVALID, 0, 1, 16, 1 },
1958 { CORNER_INVALID, 1, 0, 1, 16 },
1959 { CORNER_INVALID, 0, 1, 16, 1 },
1960 { CORNER_INVALID, 1, 0, 1, 16 },
1961 { CORNER_INVALID, 0, 15, 16, 1 },
1962 { CORNER_INVALID, 15, 0, 1, 16 },
1963 { CORNER_E, 8, 8, 1, 1 },
1964 { CORNER_S, 8, 8, 1, 1 },
1965 { CORNER_INVALID, 0, 15, 16, 1 },
1966 { CORNER_INVALID, 15, 0, 1, 16 },
1967 { CORNER_INVALID, 0, 15, 16, 1 },
1968 { CORNER_INVALID, 15, 0, 1, 16 },
2041 uint num_sprites = 0;
2043 if (base_image == 0) {
2044 base_image = SPR_TRACK_FENCE_FLAT_X;
2048 assert(num_sprites > 0);
2050 switch (GetRailGroundType(ti->
tile)) {
2072 switch (track_corner) {
2077 default: NOT_REACHED();
2086 static const int INF = 1000;
2087 static const SubSprite _halftile_sub_sprite[4] = {
2088 { -INF , -INF , 32 - 33, INF },
2089 { -INF , 0 + 7, INF , INF },
2090 { -31 + 33, -INF , INF , INF },
2091 { -INF , -INF , INF , 30 - 23 }
2103 Corner halftile_corner = CORNER_INVALID;
2120 DrawShoreTile(ti->
tileh);
2131 default: image = SPR_FLAT_GRASS_TILE;
break;
2146 }
else if (no_combine) {
2182 DrawTrackSprite(ground +
RTO_S, PAL_NONE, ti,
SLOPE_S);
break;
2184 DrawTrackSprite(ground +
RTO_W, PAL_NONE, ti,
SLOPE_W);
break;
2234 default: image = SPR_FLAT_GRASS_TILE;
break;
2239 DrawGroundSprite(image, PAL_NONE, &(_halftile_sub_sprite[halftile_corner]));
2245 default: NOT_REACHED();
2252 DrawTrackSprite(ground + offset, PAL_NONE, ti, fake_slope);
2254 DrawTrackSprite(overlay + offset,
PALETTE_CRASH, ti, fake_slope);
2268 if (rti->UsesOverlay()) {
2269 DrawTrackBitsOverlay(ti, track, rti);
2275 Corner halftile_corner = CORNER_INVALID;
2291 bool junction =
false;
2298 DrawShoreTile(ti->
tileh);
2301 image = SPR_FLAT_WATER_TILE;
2307 default: image = SPR_FLAT_GRASS_TILE;
break;
2348 DrawShoreTile(ti->
tileh);
2350 sub = &(_halftile_sub_sprite[track_corner]);
2409 static const byte _corner_to_track_sprite[] = {3, 1, 2, 0};
2417 #define MAYBE_DRAW_SIGNAL(x, y, z, t) if (IsSignalPresent(tile, x)) DrawSingleSignal(tile, rti, t, GetSingleSignalState(tile, x), y, z)
2422 MAYBE_DRAW_SIGNAL(2, SIGNAL_TO_NORTH, 0,
TRACK_LEFT);
2423 MAYBE_DRAW_SIGNAL(3, SIGNAL_TO_SOUTH, 1,
TRACK_LEFT);
2426 MAYBE_DRAW_SIGNAL(0, SIGNAL_TO_NORTH, 2,
TRACK_RIGHT);
2427 MAYBE_DRAW_SIGNAL(1, SIGNAL_TO_SOUTH, 3,
TRACK_RIGHT);
2430 MAYBE_DRAW_SIGNAL(3, SIGNAL_TO_WEST, 4,
TRACK_UPPER);
2431 MAYBE_DRAW_SIGNAL(2, SIGNAL_TO_EAST, 5,
TRACK_UPPER);
2434 MAYBE_DRAW_SIGNAL(1, SIGNAL_TO_WEST, 6,
TRACK_LOWER);
2435 MAYBE_DRAW_SIGNAL(0, SIGNAL_TO_EAST, 7,
TRACK_LOWER);
2438 MAYBE_DRAW_SIGNAL(3, SIGNAL_TO_SOUTHWEST, 8,
TRACK_X);
2439 MAYBE_DRAW_SIGNAL(2, SIGNAL_TO_NORTHEAST, 9,
TRACK_X);
2442 MAYBE_DRAW_SIGNAL(3, SIGNAL_TO_SOUTHEAST, 10,
TRACK_Y);
2443 MAYBE_DRAW_SIGNAL(2, SIGNAL_TO_NORTHWEST, 11,
TRACK_Y);
2447 static void DrawTile_Track(
TileInfo *ti)
2479 if (rti->UsesOverlay()) {
2480 image = SPR_FLAT_GRASS_TILE;
2487 if (IsSnowRailGround(ti->
tile)) {
2488 if (image != SPR_FLAT_GRASS_TILE) {
2491 image = SPR_FLAT_SNOW_DESERT_TILE;
2497 if (rti->UsesOverlay()) {
2568 void DrawTrainDepotSprite(
int x,
int y,
int dir,
RailType railtype)
2575 if (image != SPR_FLAT_GRASS_TILE) image += offset;
2580 if (rti->UsesOverlay()) {
2590 if (depot_sprite != 0) offset = depot_sprite - SPR_RAIL_DEPOT_SE_1;
2595 static int GetSlopePixelZ_Track(
TileIndex tile, uint x, uint y)
2614 static void TileLoop_Track(
TileIndex tile)
2726 default: NOT_REACHED();
2731 if (old_ground != new_ground) {
2732 SetRailGroundType(tile, new_ground);
2744 default: NOT_REACHED();
2759 default: NOT_REACHED();
2800 static bool ClickTile_Track(
TileIndex tile)
2816 td->
str = STR_LAI_RAIL_DESCRIPTION_TRACK;
2820 static const StringID signal_type[6][6] = {
2822 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_SIGNALS,
2823 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_PRESIGNALS,
2824 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_EXITSIGNALS,
2825 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_COMBOSIGNALS,
2826 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_PBSSIGNALS,
2827 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_NOENTRYSIGNALS
2830 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_PRESIGNALS,
2831 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRESIGNALS,
2832 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_EXITSIGNALS,
2833 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_COMBOSIGNALS,
2834 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_PBSSIGNALS,
2835 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_NOENTRYSIGNALS
2838 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_EXITSIGNALS,
2839 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_EXITSIGNALS,
2840 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXITSIGNALS,
2841 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXIT_COMBOSIGNALS,
2842 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXIT_PBSSIGNALS,
2843 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXIT_NOENTRYSIGNALS
2846 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_COMBOSIGNALS,
2847 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_COMBOSIGNALS,
2848 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXIT_COMBOSIGNALS,
2849 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_COMBOSIGNALS,
2850 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_COMBO_PBSSIGNALS,
2851 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_COMBO_NOENTRYSIGNALS
2854 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_PBSSIGNALS,
2855 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_PBSSIGNALS,
2856 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXIT_PBSSIGNALS,
2857 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_COMBO_PBSSIGNALS,
2858 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PBSSIGNALS,
2859 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PBS_NOENTRYSIGNALS
2862 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NORMAL_NOENTRYSIGNALS,
2863 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PRE_NOENTRYSIGNALS,
2864 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_EXIT_NOENTRYSIGNALS,
2865 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_COMBO_NOENTRYSIGNALS,
2866 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_PBS_NOENTRYSIGNALS,
2867 STR_LAI_RAIL_DESCRIPTION_TRACK_WITH_NOENTRYSIGNALS
2874 primary_signal = GetSignalType(tile,
TRACK_UPPER);
2877 secondary_signal = primary_signal = GetSignalType(tile,
TRACK_LOWER);
2880 td->
str = signal_type[secondary_signal][primary_signal];
2885 td->
str = STR_LAI_RAIL_DESCRIPTION_TRAIN_DEPOT;
2907 uint num_pieces = 1;
2914 Company::Get(old_owner)->infrastructure.rail[rt] -= num_pieces;
2915 Company::Get(new_owner)->infrastructure.rail[rt] += num_pieces;
2919 Company::Get(old_owner)->infrastructure.signal -= num_sigs;
2920 Company::Get(new_owner)->infrastructure.signal += num_sigs;
2929 static const byte _fractcoords_behind[4] = { 0x8F, 0x8, 0x80, 0xF8 };
2930 static const byte _fractcoords_enter[4] = { 0x8A, 0x48, 0x84, 0xA8 };
2931 static const int8 _deltacoord_leaveoffset[8] = {
2949 case DIAGDIR_NE:
return ((
int)(v->
x_pos & 0x0F) - ((_fractcoords_enter[dir] & 0x0F) - (length + 1)));
2950 case DIAGDIR_SE:
return -((int)(v->
y_pos & 0x0F) - ((_fractcoords_enter[dir] >> 4) + (length + 1)));
2951 case DIAGDIR_SW:
return -((int)(v->
x_pos & 0x0F) - ((_fractcoords_enter[dir] & 0x0F) + (length + 1)));
2952 case DIAGDIR_NW:
return ((
int)(v->
y_pos & 0x0F) - ((_fractcoords_enter[dir] >> 4) - (length + 1)));
2953 default: NOT_REACHED();
2969 byte fract_coord = (x & 0xF) + ((y & 0xF) << 4);
2981 byte fract_coord_leave =
2982 ((_fractcoords_enter[dir] & 0x0F) +
2983 (length + 1) * _deltacoord_leaveoffset[dir]) +
2984 (((_fractcoords_enter[dir] >> 4) +
2985 ((length + 1) * _deltacoord_leaveoffset[dir + 4])) << 4);
2987 if (fract_coord_leave == fract_coord) {
2989 if ((v = v->
Next()) !=
nullptr) {
2994 }
else if (_fractcoords_enter[dir] == fract_coord) {
3033 switch (rail_bits) {
3041 if (z_old != z_new || tileh_old != tileh_new)
return_cmd_error(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK);
3048 if (z_old != z_new)
return_cmd_error(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK);
3052 if (tileh_old != tileh_new) {
3085 switch (rail_bits) {
3090 default:
return autoslope_result;
3099 for (
Corner corner = (
Corner)0; corner < CORNER_END; corner = (
Corner)(corner + 1)) {
3100 if (allowed_corner == corner)
continue;
3119 GetSlopePixelZ_Track,
3123 GetTileTrackStatus_Track,
3127 ChangeTileOwner_Track,
3130 GetFoundation_Track,
3131 TerraformTile_Track,
static void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence in GUI with railroad specifics.
static Corner OppositeCorner(Corner corner)
Returns the opposite corner.
struct RailtypeInfo::@39 gui_sprites
struct containing the sprites for the rail GUI.
CursorID rail_nwse
Cursor for building rail in Y direction.
static bool RailNoLevelCrossings(RailType rt)
Test if a RailType disallows build of level crossings.
@ MP_HOUSE
A house by a town.
static byte SignalAgainstTrackdir(Trackdir trackdir)
Maps a trackdir to the bit that stores its status in the map arrays, in the direction against the tra...
void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index)
Delete inspect window for a given feature and index.
@ VETSB_CANNOT_ENTER
The vehicle cannot enter the tile.
@ TCX_UPPER_HALFTILE
Querying information about the upper part of a tile with halftile foundation.
uint32 TileIndex
The index/ID of a Tile.
@ RTO_JUNCTION_SE
Ballast for junction 'pointing' SE.
@ TROPICZONE_DESERT
Tile is desert.
static TileIndex AddTileIndexDiffCWrap(TileIndex tile, TileIndexDiffC diff)
Add a TileIndexDiffC to a TileIndex and returns the new one.
static bool HasReservedTracks(TileIndex tile, TrackBits tracks)
Check whether some of tracks is reserved on a tile.
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
SpriteID track_ns
two pieces of rail in North and South corner (East-West direction)
@ RTO_W
Piece of rail in western corner.
SpriteID single_x
single piece of rail in X direction, without ground
@ FOUNDATION_HALFTILE_N
Level north halftile non-continuously.
@ TRACK_BIT_NONE
No track.
Iterator to iterate over a diagonal area of the map.
uint16 max_speed
Maximum speed for vehicles travelling on this rail type.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
bool IsType(OrderType type) const
Check whether this order is of the given type.
@ TRACKDIR_BIT_UPPER_W
Track upper, direction west.
static Titem * Get(size_t index)
Returns Titem with given index.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
static Foundation SpecialRailFoundation(Corner corner)
Returns the special rail foundation for single horizontal/vertical track.
@ TRACK_BIT_3WAY_SW
"Arrow" to the south-west
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
@ RFO_SLOPE_NW_SW
Slope NW, Track Y, Fence SW.
@ RAIL_GROUND_HALF_SNOW
Snow only on higher part of slope (steep or one corner raised)
uint8 train_acceleration_model
realistic acceleration for trains
@ RFO_SLOPE_SW_SE
Slope SW, Track X, Fence SE.
static Trackdir RemoveFirstTrackdir(TrackdirBits *trackdirs)
Removes first Trackdir from TrackdirBits and returns it.
RailFenceOffset
Offsets from base sprite for fence sprites.
TrackdirBits
Enumeration of bitmasks for the TrackDirs.
static FenceOffset _fence_offsets[]
Offsets for drawing fences.
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track)
Use this function to notify YAPF that track layout (or signal configuration) has change.
uint x
X position of the tile in unit coordinates.
SpriteID single_n
single piece of rail in the northern corner
bool forbid_90_deg
forbid trains to make 90 deg turns
static bool HasSignalOnTrack(TileIndex tile, Track track)
Checks for the presence of signals (either way) on the given track on the given rail tile.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
static bool AutoslopeCheckForEntranceEdge(TileIndex tile, int z_new, Slope tileh_new, DiagDirection entrance)
Autoslope check for tiles with an entrance on an edge.
int TicksToLeaveDepot(const Train *v)
Compute number of ticks when next wagon will leave a depot.
@ TO_BUILDINGS
company buildings - depots, stations, HQ, ...
Tile information, used while rendering the tile.
bool HasVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
Checks whether a vehicle is on a specific location.
byte landscape
the landscape we're currently in
Class to backup a specific variable and restore it later.
StringID railtype
Type of rail on the tile.
@ RAIL_GROUND_FENCE_SE
Grass with a fence at the SE edge.
SpriteID build_depot
button for building depots
T * Next() const
Get next vehicle in the chain.
@ TRANSPORT_RAIL
Transport by train.
TrackBits GetReservedTrackbits(TileIndex t)
Get the reserved trackbits for any tile, regardless of type.
Owner owner[4]
Name of the owner(s)
static void SetTrackReservation(TileIndex t, TrackBits b)
Sets the reserved track bits of the tile.
static const uint LEVELCROSSING_TRACKBIT_FACTOR
Multiplier for how many regular track bits a level crossing counts.
CursorID convert
Cursor for converting track.
static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build many signals by dragging; AutoSignals.
static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *u, TileIndex tile, int x, int y)
Tile callback routine when vehicle enters tile.
@ INVALID_ROADTYPE
flag for invalid roadtype
@ TRACK_LOWER
Track in the lower corner of the tile (south)
static Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
@ CMD_REMOVE_SIGNALS
remove a signal
@ RAIL_TILE_SIGNALS
Normal rail tile with signals.
std::vector< RailTypeLabel > RailTypeLabelList
List of rail type labels.
int GetSlopeZInCorner(Slope tileh, Corner corner)
Determine the Z height of a corner relative to TileZ.
@ DIAGDIR_END
Used for iterations.
static Vehicle * UpdateTrainPowerProc(Vehicle *v, void *data)
Update power of train under which is the railtype being converted.
CommandCost CmdRemoveRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build rail on a stretch of track.
@ TRACK_BEGIN
Used for iterations.
Tindex index
Index of this pool item.
static Track GetRailStationTrack(TileIndex t)
Get the rail track of a rail station tile.
static bool HasPowerOnRail(RailType enginetype, RailType tiletype)
Checks if an engine of the given RailType got power on a tile with a given RailType.
CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a single piece of track.
@ TRACK_X
Track along the x-axis (north-east to south-west)
@ RAIL_GROUND_FENCE_NW
Grass with a fence at the NW edge.
bool FloodHalftile(TileIndex t)
Called from water_cmd if a non-flat rail-tile gets flooded and should be converted to shore.
SpriteID sprite
The 'real' sprite.
@ CMD_BUILD_SINGLE_RAIL
build a single rail track
SpriteID single_y
single piece of rail in Y direction, without ground
static T KillFirstBit(T value)
Clear the first bit in an integer.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
static bool IsHalftileSlope(Slope s)
Checks for non-continuous slope on halftile foundations.
CursorID rail_swne
Cursor for building rail in X direction.
@ RTO_SLOPE_SW
Piece of rail on slope with south-west raised.
@ SIGNAL_STATE_GREEN
The signal is green.
This struct contains all the info that is needed to draw and construct tracks.
@ RAIL_GROUND_FENCE_VERT1
Grass with a fence at the eastern side.
@ ROAD_X
Full road along the x-axis (south-west + north-east)
bool include(std::vector< T > &vec, const T &item)
Helper function to append an item to a vector if it is not already contained Consider using std::set,...
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a single piece of rail.
@ VETSB_CONTINUE
Bit sets of the above specified bits.
static bool TracksOverlap(TrackBits bits)
Checks if the given tracks overlap, ie form a crossing.
SpriteID build_tunnel
button for building a tunnel
static const uint BB_HEIGHT_UNDER_BRIDGE
Some values for constructing bounding boxes (BB).
CursorID depot
Cursor for building a depot.
static Slope RemoveHalftileSlope(Slope s)
Removes a halftile slope from a slope.
uint GetPartialPixelZ(int x, int y, Slope corners)
Determines height at given coordinate of a slope.
static const uint TILE_SIZE
Tile size in world coordinates.
SpriteID single_sloped
single piece of rail for slopes
@ RAIL_GROUND_BARREN
Nothing (dirt)
void DrawBridgeMiddle(const TileInfo *ti)
Draw the middle bits of a bridge.
SignalState
These are states in which a signal can be.
static TrackBits GetTrackBits(TileIndex tile)
Gets the track bits of the given tile.
@ RAIL_GROUND_FENCE_SENW
Grass with a fence at the NW and SE edges.
SpriteID auto_rail
button for the autorail construction
uint y
Y position of the tile in unit coordinates.
ClientSettings _settings_client
The current settings for this game.
@ CMD_BUILD_SIGNALS
build a signal
void VehicleEnterDepot(Vehicle *v)
Vehicle entirely entered the depot, update its status, orders, vehicle windows, service it,...
static bool HasSignals(TileIndex t)
Checks if a rail tile has signals.
@ RAIL_GROUND_FENCE_VERT2
Grass with a fence at the western side.
@ MP_INDUSTRY
Part of an industry.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
void InitRailTypes()
Resolve sprites of custom rail types.
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
static const uint32 VALID_LEVEL_CROSSING_SLOPES
Constant bitset with safe slopes for building a level crossing.
@ RFO_SLOPE_SW_NW
Slope SW, Track X, Fence NW.
static int GetSlopePixelZInCorner(Slope tileh, Corner corner)
Determine the Z height of a corner relative to TileZ.
static RoadBits GetCrossingRoadBits(TileIndex tile)
Get the road bits of a level crossing.
byte _display_opt
What do we want to draw/do?
@ SLOPE_EW
east and west corner are raised
byte road_side
the side of the road vehicles drive on
TransportType
Available types of transport.
uint16 cur_speed
current speed
@ RAILTYPES_NONE
No rail types.
SpriteID build_ns_rail
button for building single rail in N-S direction
Represents a diagonal tile area.
Trackdir GetVehicleTrackdir() const
Get the tracks of the train vehicle.
Owner
Enum for all companies/owners.
@ DC_EXEC
execute the given command
static Money RailClearCost(RailType railtype)
Returns the 'cost' of clearing the specified railtype.
Used to only draw a part of the sprite.
@ RFO_SLOPE_SE_SW
Slope SE, Track Y, Fence SW.
@ MP_ROAD
A tile with road (or tram tracks)
StringID GetErrorMessage() const
Returns the error message of a command.
static bool IsRailDepot(TileIndex t)
Is this rail tile a rail depot?
Tile description for the 'land area information' tool.
static bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
Find out if the slope of the tile is suitable to build a depot of given direction.
static Corner GetHighestSlopeCorner(Slope s)
Returns the highest corner of a slope (one corner raised or a steep slope).
static Track GetCrossingRailTrack(TileIndex tile)
Get the rail track of a level crossing.
static TownID GetTownIndex(TileIndex t)
Get the index of which town this house/street is attached to.
DoCommandFlag
List of flags for a command.
@ TRACK_RIGHT
Track in the right corner of the tile (east)
Foundation
Enumeration for Foundations.
byte sorting_order
The sorting order of this railtype for the toolbar dropdown.
static bool IsLevelCrossing(TileIndex t)
Return whether a tile is a level crossing.
CommandCost EnsureNoVehicleOnGround(TileIndex tile)
Ensure there is no vehicle at the ground at the given position.
static DiagDirection GetRailDepotDirection(TileIndex t)
Returns the direction the depot is facing to.
static Track RemoveFirstTrack(TrackBits *tracks)
Removes first Track from TrackBits and returns it.
RailType AllocateRailType(RailTypeLabel label)
Allocate a new rail type label.
static Foundation FlatteningFoundation(Slope s)
Returns the foundation needed to flatten a slope.
@ TRACK_BIT_UPPER
Upper track.
bool Succeeded() const
Did this command succeed?
@ RTO_JUNCTION_NE
Ballast for junction 'pointing' NE.
static TrackBits TrackToTrackBits(Track track)
Maps a Track to the corresponding TrackBits value.
static uint SlopeToSpriteOffset(Slope s)
Returns the Sprite offset for a given Slope.
static uint TileX(TileIndex tile)
Get the X component of a tile.
static TrackBits GetRailReservationTrackBits(TileIndex t)
Returns the reserved track bits of the tile.
static uint CountBits(T value)
Counts the number of set bits in a variable.
GameCreationSettings game_creation
settings used during the creation of a game (map)
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
Returns information about trackdirs and signal states.
@ RAILTYPE_ELECTRIC
Electric rails.
SignalType
Type of signal, i.e.
@ TRACK_BIT_RIGHT
Right track.
static uint GetPresentSignals(TileIndex tile)
Get whether the given signals are present (Along/AgainstTrackDir)
static bool IsInsideMM(const T x, const size_t min, const size_t max)
Checks if a value is in an interval.
@ SLOPE_NW
north and west corner are raised
Slope tileh
Slope of the tile.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
static void DrawTrackFence_SE(const TileInfo *ti, SpriteID base_image, uint num_sprites)
Draw fence at SE border matching the tile slope.
@ RTO_SLOPE_NE
Piece of rail on slope with north-east raised.
static void DrawTrackBits(TileInfo *ti, TrackBits track)
Draw ground sprite and track bits.
StringID name
Name of this rail type.
@ TRACK_BIT_CROSS
X-Y-axis cross.
@ SIG_ELECTRIC
Light signal.
Date build_date
Date of construction of tile contents.
RoadBits
Enumeration for the road parts on a tile.
PalSpriteID ground
Palette and sprite for the ground.
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
bool ValParamRailtype(const RailType rail)
Validate functions for rail building.
@ ROAD_NONE
No road-part is build.
int x_offs
Bounding box X offset.
SpriteID build_x_rail
button for building single rail in X direction
CursorID rail_ns
Cursor for building rail in N-S direction.
static TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
Return the offset between to tiles from a TileIndexDiffC struct.
static RoadBits GetRoadBits(TileIndex t, RoadTramType rtt)
Get the present road bits for a specific road type.
Iterator to iterate over a tile area (rectangle) of the map.
PathfinderSettings pf
settings for all pathfinders
@ TRACK_BIT_VERT
Left and right track.
static void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence on tile with railroad specifics.
static TrackdirBits TrackdirReachesTrackdirs(Trackdir trackdir)
Maps a trackdir to the trackdirs that can be reached from it (ie, when entering the next tile.
int16 y
The y value of the coordinate.
void CheckForDockingTile(TileIndex t)
Mark the supplied tile as a docking tile if it is suitable for docking.
@ VS_HIDDEN
Vehicle is not visible.
std::vector< Train * > TrainList
Helper type for lists/vectors of trains.
@ RAIL_GROUND_GRASS
Grassy.
CommandCost CheckOwnership(Owner owner, TileIndex tile)
Check whether the current owner owns something.
@ FOUNDATION_INCLINED_Y
The tile has an along Y-axis inclined foundation.
static Track TrackBitsToTrack(TrackBits tracks)
Converts TrackBits to Track.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
CommandCost CmdRemoveSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove signals on a stretch of track.
static uint MapSize()
Get the size of the map.
@ RTO_N
Piece of rail in northern corner.
@ TRACKDIR_BIT_X_NE
Track x-axis, direction north-east.
SpriteID single_w
single piece of rail in the western corner
@ EXPENSES_CONSTRUCTION
Construction costs.
RailType
Enumeration for all possible railtypes.
CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a train depot.
static bool IsSteepSlope(Slope s)
Checks if a slope is steep.
SpriteID tunnel
tunnel sprites base
Common return value for all commands.
byte GetSnowLine()
Get the current snow line, either variable or static.
@ TRACK_Y
Track along the y-axis (north-west to south-east)
static const TrackBits _valid_tracks_on_leveled_foundation[15]
Valid TrackBits on a specific (non-steep)-slope with leveled foundation.
@ TRACKDIR_BIT_LOWER_E
Track lower, direction east.
Date _date
Current date in days (day counter)
static bool HasStationRail(TileIndex t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
@ SIGTYPE_NORMAL
normal signal
@ RTSG_GROUND_COMPLETE
Complete ground images.
@ FOUNDATION_STEEP_BOTH
The tile has a steep slope. The lowest corner is raised by a foundation and the upper halftile is lev...
@ SLOPE_ELEVATED
bit mask containing all 'simple' slopes
static bool HasExactlyOneBit(T value)
Test whether value has exactly 1 bit set.
int y_offs
Bounding box Y offset.
@ RTF_HIDDEN
Bit number for hiding from selection.
static bool IsValidTrack(Track track)
Checks if a Track is valid.
void DirtyCompanyInfrastructureWindows(CompanyID company)
Redraw all windows with company infrastructure counts.
@ RTO_CROSSING_XY
Crossing of X and Y rail, with ballast.
Corner height_ref
Corner to use height offset from.
@ DRD_NONE
None of the directions are disallowed.
static TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
Converts TrackBits to TrackdirBits while allowing both directions.
static RailTileType GetRailTileType(TileIndex t)
Returns the RailTileType (normal with or without signals, waypoint or depot).
TileIndex tile
Current tile index.
static bool IsSlopeWithThreeCornersRaised(Slope s)
Tests if a specific slope has exactly three corners raised.
static bool IsNormalRoad(TileIndex t)
Return whether a tile is a normal road.
@ SIGNAL_STATE_RED
The signal is red.
RailTypeLabelList alternate_labels
Rail type labels this type provides in addition to the main label.
Base class for tile iterators.
SpriteID snow_offset
sprite number difference between a piece of track on a snowy ground and the corresponding one on norm...
static DiagDirection TrackdirToExitdir(Trackdir trackdir)
Maps a trackdir to the (4-way) direction the tile is exited when following that trackdir.
@ MP_OBJECT
Contains objects such as transmitters and owned land.
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
@ INVALID_OWNER
An invalid owner.
static void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner rail, Axis roaddir, RailType rat, RoadType road_rt, RoadType tram_rt, uint town)
Make a level crossing.
@ FOUNDATION_INCLINED_X
The tile has an along X-axis inclined foundation.
SpriteID track_y
single piece of rail in Y direction, with ground
@ SIGTYPE_EXIT
presignal block exit
bool Failed() const
Did this command fail?
@ RTO_SLOPE_SE
Piece of rail on slope with south-east raised.
Corner
Enumeration of tile corners.
@ RTSG_FENCES
Fence images.
Order current_order
The current order (+ status, like: loading)
@ TRACK_UPPER
Track in the upper corner of the tile (north)
static TrackBits CornerToTrackBits(Corner corner)
Returns a single horizontal/vertical trackbit that is in a specific tile corner.
static Money RailConvertCost(RailType from, RailType to)
Calculates the cost of rail conversion.
static bool IsInvisibilitySet(TransparencyOption to)
Check if the invisibility option bit is set and if we aren't in the game menu (there's never transpar...
static bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
Checks for the presence of signals along the given trackdir on the given rail tile.
Represents the covered area of e.g.
static void SetHasSignals(TileIndex tile, bool signals)
Add/remove the 'has signal' bit from the RailTileType.
static const uint TUNNELBRIDGE_TRACKBIT_FACTOR
Multiplier for how many regular track bits a tunnel/bridge counts.
Offsets for drawing fences.
static void SetSignalStates(TileIndex tile, uint state)
Set the states of the signals (Along/AgainstTrackDir)
CommandCost CmdBuildRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build rail on a stretch of track.
static bool HasDepotReservation(TileIndex t)
Get the reservation state of the depot.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
CursorID autorail
Cursor for autorail tool.
static Track DiagDirToDiagTrack(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track incidating with that diagdir.
static TropicZone GetTropicZone(TileIndex tile)
Get the tropic zone.
static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build or remove a stretch of railroad tracks.
@ RFO_SLOPE_NE_NW
Slope NE, Track X, Fence NW.
static Money RailBuildCost(RailType railtype)
Returns the cost of building the specified railtype.
@ VS_STOPPED
Vehicle is stopped by the player.
Foundation GetRailFoundation(Slope tileh, TrackBits bits)
Checks if a track combination is valid on a specific slope and returns the needed foundation.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
@ TRACK_BIT_X
X-axis track.
@ RTSG_CURSORS
Cursor and toolbar icon images.
static TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
Builds a TrackStatus.
static bool IsRailDepotTile(TileIndex t)
Is this tile rail tile and a rail depot?
@ TRACKDIR_BIT_LOWER_W
Track lower, direction west.
static void SetDockingTile(TileIndex t, bool b)
Set the docking tile state of a tile.
static void SetTrackBits(TileIndex t, TrackBits b)
Sets the track bits of the given tile.
'Train' is either a loco or a wagon.
static Direction DiagDirToDir(DiagDirection dir)
Convert a DiagDirection to a Direction.
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
@ FOUNDATION_INVALID
Used inside "rail_cmd.cpp" to indicate invalid slope/track combination.
void FreeTrainTrackReservation(const Train *v)
Free the reserved path in front of a vehicle.
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
static TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
@ TRACK_LEFT
Track in the left corner of the tile (west)
static bool IsBridge(TileIndex t)
Checks if this is a bridge, instead of a tunnel.
@ TRACKDIR_BIT_Y_SE
Track y-axis, direction south-east.
static bool IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
@ TRACKDIR_BIT_LEFT_S
Track left, direction south.
static bool IsNonContinuousFoundation(Foundation f)
Tests if a foundation is a non-continuous foundation, i.e.
@ CMD_REMOVE_SINGLE_RAIL
remove a single rail track
bool IsSafeWaitingPosition(const Train *v, TileIndex tile, Trackdir trackdir, bool include_line_end, bool forbid_90deg)
Determine whether a certain track on a tile is a safe position to end a path.
Ground palette sprite of a tile, together with its sprite layout.
@ TRACKDIR_BIT_RIGHT_S
Track right, direction south.
@ TCX_NORMAL
Nothing special.
@ RFO_FLAT_LEFT
Slope FLAT, Track LEFT, Fence E.
static Slope SlopeWithThreeCornersRaised(Corner corner)
Returns the slope with all except one corner raised.
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
@ TRACKDIR_BIT_LEFT_N
Track left, direction north.
static Corner GetHalftileSlopeCorner(Slope s)
Returns the leveled halftile of a halftile slope.
CommandCost CmdBuildSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build signals on a stretch of track.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
@ MP_TUNNELBRIDGE
Tunnel entry/exit and bridge heads.
static bool AutoslopeEnabled()
Tests if autoslope is enabled for _current_company.
void UpdateLevelCrossing(TileIndex tile, bool sound=true)
Sets correct crossing state.
@ RTSG_GROUND
Main group of ground images.
@ INVALID_TRACKDIR
Flag for an invalid trackdir.
Coordinates of a point in 2D.
@ FOUNDATION_NONE
The tile has no foundation, the slope remains unchanged.
@ SLOPE_SW
south and west corner are raised
void MarkBridgeDirty(TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height)
Mark bridge tiles dirty.
Slope
Enumeration for the slope-type.
DiagDirection
Enumeration for diagonal directions.
static void DrawTrackFence_SW(const TileInfo *ti, SpriteID base_image, uint num_sprites)
Draw fence at SW border matching the tile slope.
@ TRACK_BIT_ALL
All possible tracks.
struct RailtypeInfo::@38 base_sprites
Struct containing the main sprites.
static bool IsRailStationTile(TileIndex t)
Is this tile a station tile and a rail station?
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
bool show_track_reservation
highlight reserved tracks.
@ TRACK_BIT_LOWER
Lower track.
@ DO_FULL_DETAIL
Also draw details of track and roads.
static bool IsOnewaySignal(TileIndex t, Track track)
One-way signals can't be passed the 'wrong' way.
RoadType
The different roadtypes we support.
Set of callback functions for performing tile operations of a given tile type.
@ DC_BANKRUPT
company bankrupts, skip money check, skip vehicle on tile check in some cases
static CommandCost CheckRailSlope(Slope tileh, TrackBits rail_bits, TrackBits existing, TileIndex tile)
Tests if a track can be build on a tile.
static void DrawTrackFence_NE(const TileInfo *ti, SpriteID base_image, uint num_sprites)
Draw fence at NE border matching the tile slope.
@ RTSG_OVERLAY
Images for overlaying track.
void TileLoop_Water(TileIndex tile)
Let a water tile floods its diagonal adjoining tiles called from tunnelbridge_cmd,...
RailTypes powered_railtypes
bitmask to the OTHER railtypes on which an engine of THIS railtype generates power
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
static uint GetSaveSlopeZ(uint x, uint y, Track track)
Get surface height in point (x,y) On tiles with halftile foundations move (x,y) to a safe point wrt.
RailGroundType
The ground 'under' the rail.
static DiagDirection GetTunnelBridgeDirection(TileIndex t)
Get the direction pointing to the other end.
static Owner GetTileOwner(TileIndex tile)
Returns the owner of a tile.
void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, int h, int dz, int z, bool transparent, int bb_offset_x, int bb_offset_y, int bb_offset_z, const SubSprite *sub)
Draw a (transparent) sprite at given coordinates with a given bounding box.
static PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite.
@ RAIL_GROUND_WATER
Grass with a fence and shore or water on the free halftile.
Direction direction
facing
@ FOUNDATION_STEEP_LOWER
The tile has a steep slope. The lowest corner is raised by a foundation to allow building railroad on...
static uint ApplyPixelFoundationToSlope(Foundation f, Slope *s)
Applies a foundation to a slope.
@ TRACK_BIT_DEPOT
Bitflag for a depot.
A pair-construct of a TileIndexDiff.
static void DrawTrackDetails(const TileInfo *ti, const RailtypeInfo *rti)
Draw track fences.
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
static const ObjectType OBJECT_OWNED_LAND
Owned land 'flag'.
@ RAILTYPE_RAIL
Standard non-electric rails.
@ TRACK_END
Used for iterations.
FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
Returns the behaviour of a tile during flooding.
static Direction ReverseDir(Direction d)
Return the reverse of a direction.
bool IsStationTileBlocked(TileIndex tile)
Check whether a rail station tile is NOT traversable.
@ TRACK_BIT_HORZ
Upper and lower track.
void MakeDefaultName(T *obj)
Set the default name for a depot/waypoint.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
@ RFO_FLAT_X_NW
Slope FLAT, Track X, Fence NW.
@ RFO_SLOPE_SE_NE
Slope SE, Track Y, Fence NE.
@ TRACKDIR_BIT_NONE
No track build.
static bool IsCompatibleRail(RailType enginetype, RailType tiletype)
Checks if an engine of the given RailType can drive on a tile with a given RailType.
static DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
Gets the disallowed directions.
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
CompanyID _current_company
Company currently doing an action.
@ SLOPE_N
the north corner of the tile is raised
RailTypeFlags flags
Bit mask of rail type flags.
SignalVariant
Variant of the signal, i.e.
static bool IsValidCorner(Corner corner)
Rangecheck for Corner enumeration.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
struct RailtypeInfo::@40 cursor
Cursors associated with the rail type.
static const PaletteID PALETTE_TO_BARE_LAND
sets colour to bare land stuff for rail, road and crossings
CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Convert one rail type to the other.
@ RAIL_GROUND_FENCE_HORIZ1
Grass with a fence at the southern side.
CommandCost EnsureNoTrainOnTrackBits(TileIndex tile, TrackBits track_bits)
Tests if a vehicle interacts with the specified track bits.
static Slope SlopeWithOneCornerRaised(Corner corner)
Returns the slope with a specific corner raised.
@ SIGTYPE_ENTRY
presignal block entry
@ TRACK_BIT_LEFT
Left track.
static uint GetSignalStates(TileIndex tile)
Set the states of the signals (Along/AgainstTrackDir)
static bool IsPlainRail(TileIndex t)
Returns whether this is plain rails, with or without signals.
static void DrawTrackFence_NW(const TileInfo *ti, SpriteID base_image, uint num_sprites)
Draw fence at NW border matching the tile slope.
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
void Restore()
Restore the variable.
@ TRACK_BIT_3WAY_NE
"Arrow" to the north-east
static bool IsSpecialRailFoundation(Foundation f)
Tests if a foundation is a special rail foundation for single horizontal/vertical track.
bool TryPathReserve(Train *v, bool mark_as_stuck=false, bool first_tile_okay=false)
Try to reserve a path to a safe position.
CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove signals.
static CommandCost EnsureNoTrainOnTrack(TileIndex tile, Track track)
Tests if a vehicle interacts with the specified track.
static Train * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
static bool IsSlopeWithOneCornerRaised(Slope s)
Tests if a specific slope has exactly one corner raised.
TileType
The different types of tiles.
@ RFO_FLAT_UPPER
Slope FLAT, Track UPPER, Fence S.
@ TRACKDIR_BIT_Y_NW
Track y-axis, direction north-west.
@ RAILTYPE_END
Used for iterations.
static bool HasTunnelBridgeReservation(TileIndex t)
Get the reservation state of the rail tunnel/bridge.
uint32 PaletteID
The number of the palette.
static bool HasRailCatenaryDrawn(RailType rt)
Test if we should draw rail catenary.
bool build_on_slopes
allow building on slopes
@ RFO_SLOPE_NE_SE
Slope NE, Track X, Fence SE.
static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, int z_old, Slope tileh_old, int z_new, Slope tileh_new, TrackBits rail_bits)
Tests if autoslope is allowed.
@ RTO_X
Piece of rail in X direction.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
@ TRANSPORT_WATER
Transport over water.
void AddSideToSignalBuffer(TileIndex tile, DiagDirection side, Owner owner)
Add side of tile to signal update buffer.
static void MakeShore(TileIndex t)
Helper function to make a coast tile.
@ FOUNDATION_LEVELED
The tile is leveled up to a flat slope.
uint32 rail[RAILTYPE_END]
Count of company owned track bits for each rail type.
static void MakeRoadNormal(TileIndex t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
Make a normal road tile.
@ RTSG_DEPOT
Depot images.
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
@ TRACK_BIT_3WAY_SE
"Arrow" to the south-east
@ WC_VEHICLE_DEPOT
Depot view; Window numbers:
@ MP_STATION
A tile of a station.
@ RTO_JUNCTION_NSEW
Ballast for full junction.
RailTypeLabel label
Unique 32 bit rail type identifier.
@ RTFB_NONE
All flags cleared.
@ ROAD_Y
Full road along the y-axis (north-west + south-east)
byte train_signal_side
show signals on left / driving / right side
void FindVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
Find a vehicle from a specific location.
@ FLOOD_NONE
The tile does not flood neighboured tiles.
@ RTO_Y
Piece of rail in Y direction.
@ RAIL_TILE_NORMAL
Normal rail tile without signals.
static void SetPresentSignals(TileIndex tile, uint signals)
Set whether the given signals are present (Along/AgainstTrackDir)
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
SpriteID GetCustomSignalSprite(const RailtypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui)
Get the sprite to draw for a given signal.
bool disable_elrails
when true, the elrails are disabled
static const RailtypeInfo _original_railtypes[]
Global Railtype definition.
@ DIAGDIR_BEGIN
Used for iterations.
static TrackdirBits TrackStatusToTrackdirBits(TrackStatus ts)
Returns the present-trackdir-information of a TrackStatus.
@ RAIL_GROUND_FENCE_NE
Grass with a fence at the NE edge.
StringID str
Description of the tile.
SpriteID single_e
single piece of rail in the eastern corner
@ RTO_SLOPE_NW
Piece of rail on slope with north-west raised.
@ DC_AUTO
don't allow building on structures
@ SLOPE_S
the south corner of the tile is raised
void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner)
Add track to signal update buffer.
@ RTO_E
Piece of rail in eastern corner.
static Foundation HalftileFoundation(Corner corner)
Returns the halftile foundation for single horizontal/vertical track.
static int GetTileMaxPixelZ(TileIndex tile)
Get top height of the tile.
struct RailtypeInfo::@41 strings
Strings associated with the rail type.
@ RTF_NO_SPRITE_COMBINE
Bit number for using non-combined junctions.
CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build signals, alternate between double/single, signal/semaphore, pre/exit/combo-signals,...
static Track GetRailDepotTrack(TileIndex t)
Returns the track of a depot, ignoring direction.
static bool IsLevelCrossingTile(TileIndex t)
Return whether a tile is a level crossing tile.
static byte SignalOnTrack(Track track)
Maps a Track to the bits that store the status of the two signals that can be present on the given tr...
static T abs(const T a)
Returns the absolute value of (scalar) variable.
@ SLOPE_W
the west corner of the tile is raised
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
SpriteID build_ew_rail
button for building single rail in E-W direction
TrackBits
Bitfield corresponding to Track.
static bool IsDockingTile(TileIndex t)
Checks whether the tile is marked as a dockling tile.
CommandCost CheckTileOwnership(TileIndex tile)
Check whether the current owner owns the stuff on the given tile.
static uint GetTunnelBridgeLength(TileIndex begin, TileIndex end)
Calculates the length of a tunnel or a bridge (without end tiles)
Date build_date
Date of construction.
static T ToggleBit(T &x, const uint8 y)
Toggles a bit in a variable.
@ CMD_CONVERT_RAIL
convert a rail type
@ RFO_SLOPE_NW_NE
Slope NW, Track Y, Fence NE.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
#define lengthof(x)
Return the length of an fixed size array.
uint16 rail_speed
Speed limit of rail (bridges and track)
static TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track bits incidating with that diagdir.
RailTypes compatible_railtypes
bitmask to the OTHER railtypes on which an engine of THIS railtype can physically travel
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_LVL_BASE.
SignalOffsets
Enum holding the signal offset in the sprite sheet according to the side it is representing.
static bool IsPlainRailTile(TileIndex t)
Checks whether the tile is a rail tile or rail tile with signals.
void DrawRailCatenary(const TileInfo *ti)
Draws overhead wires and pylons for electric railways.
static Money RoadBuildCost(RoadType roadtype)
Returns the cost of building the specified roadtype.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
SpriteID single_s
single piece of rail in the southern corner
@ RFO_FLAT_Y_SW
Slope FLAT, Track Y, Fence SW.
static void DrawTrackFence(const TileInfo *ti, SpriteID base_image, uint num_sprites, RailFenceOffset rfo)
Draw a track fence.
static Owner GetRoadOwner(TileIndex t, RoadTramType rtt)
Get the owner of a specific road type.
@ TRACKDIR_BIT_X_SW
Track x-axis, direction south-west.
static TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
Determines type of the wormhole and returns its other end.
static Trackdir ReverseTrackdir(Trackdir trackdir)
Maps a trackdir to the reverse trackdir.
static void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
@ RAIL_GROUND_FENCE_HORIZ2
Grass with a fence at the northern side.
@ TRACK_BIT_Y
Y-axis track.
TileIndex tile
Tile index.
int CalcNextVehicleOffset() const
Calculate the offset from this vehicle's center to the following center taking the vehicle lengths in...
ConstructionSettings construction
construction of things in-game
@ CCF_TRACK
Valid changes while vehicle is driving, and possibly changing tracks.
VehicleSettings vehicle
options for vehicles
static Vehicle * EnsureNoShipProc(Vehicle *v, void *data)
Test-procedure for HasVehicleOnPos to check for a ship.
Trackdir
Enumeration for tracks and directions.
@ RFO_FLAT_X_SE
Slope FLAT, Track X, Fence SE.
@ SLOPE_NS
north and south corner are raised
static const TrackBits _valid_tracks_without_foundation[15]
Valid TrackBits on a specific (non-steep)-slope without foundation.
@ RTO_S
Piece of rail in southern corner.
@ RFO_FLAT_RIGHT
Slope FLAT, Track RIGHT, Fence W.
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
@ VEH_TRAIN
Train vehicle type.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
CursorID rail_ew
Cursor for building rail in E-W direction.
VehicleType type
Type of vehicle.
@ RAIL_TILE_DEPOT
Depot (one entrance)
T * First() const
Get the first vehicle in the chain.
void ResetRailTypes()
Reset all rail type information to its default values.
static bool RoadNoLevelCrossing(RoadType roadtype)
Test if road disallows level crossings.
static Slope GetTilePixelSlope(TileIndex tile, int *h)
Return the slope of a given tile.
Track
These are used to specify a single track.
static CommandCost CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags)
Check that the new track bits may be built.
static bool CompareRailTypes(const RailType &first, const RailType &second)
Compare railtypes based on their sorting order.
uint ApplyFoundationToSlope(Foundation f, Slope *s)
Applies a foundation to a slope.
int x_size
Bounding box X size.
@ TRACKDIR_BIT_RIGHT_N
Track right, direction north.
SpriteID build_y_rail
button for building single rail in Y direction
SpriteID signals[SIGTYPE_END][2][2]
signal GUI sprites (type, variant, state)
void ShowDepotWindow(TileIndex tile, VehicleType type)
Opens a depot window.
static TransportType GetTunnelBridgeTransportType(TileIndex t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
static TrackBits TrackdirBitsToTrackBits(TrackdirBits bits)
Discards all directional information from a TrackdirBits value.
static TrackBits GetCrossingRailBits(TileIndex tile)
Get the rail track bits of a level crossing.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
@ VEH_SHIP
Ship vehicle type.
RailTypes
The different railtypes we support, but then a bitmask of them.
@ TRACK_BIT_3WAY_NW
"Arrow" to the north-west
#define FIND_FIRST_BIT(x)
Returns the first non-zero bit in a 6-bit value (from right).
@ SLOPE_SE
south and east corner are raised
static bool HasTrack(TileIndex tile, Track track)
Returns whether the given track is present on the given tile.
@ TRACKDIR_BIT_UPPER_E
Track upper, direction east.
static bool HasRoadWorks(TileIndex t)
Check if a tile has road works.
@ OWNER_WATER
The tile/execution is done by "water".
@ RTO_JUNCTION_SW
Ballast for junction 'pointing' SW.
@ RFO_FLAT_Y_NE
Slope FLAT, Track Y, Fence NE.
static void SetRailType(TileIndex t, RailType r)
Sets the rail type of the given tile.
int y_size
Bounding box Y size.
@ SLOPE_NE
north and east corner are raised
SpriteID ground
ground sprite for a 3-way switch
static Slope ComplementSlope(Slope s)
Return the complement of a slope.
@ RAIL_GROUND_ICE_DESERT
Icy or sandy.
static Corner GetHalftileFoundationCorner(Foundation f)
Returns the halftile corner of a halftile-foundation.
@ SIG_SEMAPHORE
Old-fashioned semaphore signal.
uint GetRailtypeSpriteOffset() const
Offset between the current railtype and normal rail.
@ SLOPE_E
the east corner of the tile is raised
VehicleEnterTileStatus
The returned bits of VehicleEnterTile.
@ CMD_LANDSCAPE_CLEAR
demolish a tile
static bool IsObjectType(TileIndex t, ObjectType type)
Check whether the object on a tile is of a specific type.
static byte SignalAlongTrackdir(Trackdir trackdir)
Maps a trackdir to the bit that stores its status in the map arrays, in the direction along with the ...
CommandCost TunnelBridgeIsFree(TileIndex tile, TileIndex endtile, const Vehicle *ignore)
Finds vehicle in tunnel / bridge.
@ RAIL_GROUND_FENCE_SW
Grass with a fence at the SW edge.
void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
Draws a ground sprite for the current tile.
static bool IsDiagonalTrackdir(Trackdir trackdir)
Checks if a given Trackdir is diagonal.
static Track TrackdirToTrack(Trackdir trackdir)
Returns the Track that a given Trackdir represents.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
static Trackdir TrackToTrackdir(Track track)
Returns a Trackdir for the given Track.
GUISettings gui
settings related to the GUI
@ RFO_FLAT_LOWER
Slope FLAT, Track LOWER, Fence N.
Train * GetTrainForReservation(TileIndex tile, Track track)
Find the train which has reserved a specific path.
SpriteID convert_rail
button for converting rail
@ VETSB_ENTERED_WORMHOLE
The vehicle either entered a bridge, tunnel or depot tile (this includes the last tile of the bridge/...
static bool IsBridgeAbove(TileIndex t)
checks if a bridge is set above the ground of this tile
@ INVALID_RAILTYPE
Flag for invalid railtype.
RailTypes introduces_railtypes
Bitmask of which other railtypes are introduced when this railtype is introduced.
@ RAILTYPE_BEGIN
Used for iterations.
int16 x
The x value of the coordinate.
@ INVALID_TRACK
Flag for an invalid track.
@ RTO_JUNCTION_NW
Ballast for junction 'pointing' NW.
@ RAIL_GROUND_FENCE_NESW
Grass with a fence at the NE and SW edges.