57 #include "table/strings.h" 110 if (!T::IsValidID(t) ||
Station::Get(t)->owner != company)
continue;
111 if (closest_station == INVALID_STATION) {
113 }
else if (closest_station != t) {
118 *st = (closest_station == INVALID_STATION) ? NULL : T::Get(closest_station);
139 for (
int dx = -3; dx <= 3; dx++) {
140 for (
int dy = -3; dy <= 3; dy++) {
196 #define M(x) ((x) - STR_SV_STNAME) 201 STATIONNAMING_AIRPORT,
202 STATIONNAMING_OILRIG,
204 STATIONNAMING_HELIPORT,
229 if (
GetIndustrySpec(indtype)->station_name == STR_UNDEFINED)
return false;
233 sni->
free_names &= ~(1 << M(STR_SV_STNAME_OILFIELD) | 1 << M(STR_SV_STNAME_MINES));
239 static const uint32 _gen_station_name_bits[] = {
242 1U << M(STR_SV_STNAME_AIRPORT),
243 1U << M(STR_SV_STNAME_OILFIELD),
244 1U << M(STR_SV_STNAME_DOCKS),
245 1U << M(STR_SV_STNAME_HELIPORT),
252 memset(indtypes, 0,
sizeof(indtypes));
255 FOR_ALL_STATIONS(s) {
256 if (s != st && s->
town == t) {
257 if (s->
indtype != IT_INVALID) {
260 if (name != STR_UNDEFINED) {
271 if (str == M(STR_SV_STNAME_FOREST)) {
272 str = M(STR_SV_STNAME_WOODS);
288 return STR_SV_STNAME_FALLBACK;
296 uint32 tmp = free_names & _gen_station_name_bits[name_class];
300 if (
HasBit(free_names, M(STR_SV_STNAME_MINES))) {
302 return STR_SV_STNAME_MINES;
308 if (
HasBit(free_names, M(STR_SV_STNAME)))
return STR_SV_STNAME;
310 if (
HasBit(free_names, M(STR_SV_STNAME_CENTRAL)))
return STR_SV_STNAME_CENTRAL;
314 if (
HasBit(free_names, M(STR_SV_STNAME_LAKESIDE)) &&
317 return STR_SV_STNAME_LAKESIDE;
321 if (
HasBit(free_names, M(STR_SV_STNAME_WOODS)) && (
332 if (
HasBit(free_names, M(STR_SV_STNAME_VALLEY)))
return STR_SV_STNAME_VALLEY;
334 if (
HasBit(free_names, M(STR_SV_STNAME_HEIGHTS)))
return STR_SV_STNAME_HEIGHTS;
338 static const int8 _direction_and_table[] = {
339 ~( (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
340 ~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
341 ~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_EAST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
342 ~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) ),
345 free_names &= _direction_and_table[
349 tmp = free_names & ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 6) | (1 << 7) | (1 << 12) | (1 << 26) | (1 << 27) | (1 << 28) | (1 << 29) | (1 << 30));
350 return (tmp == 0) ? STR_SV_STNAME_FALLBACK : (STR_SV_STNAME +
FindFirstBit(tmp));
365 FOR_ALL_STATIONS(st) {
369 if (cur_dist < threshold) {
370 threshold = cur_dist;
384 *ta = this->train_station;
387 case STATION_AIRPORT:
392 *ta = this->truck_station;
396 *ta = this->bus_station;
401 ta->
tile = this->dock_tile;
404 default: NOT_REACHED();
418 pt.y -= 32 * ZOOM_LVL_BASE;
423 this->sign.UpdatePosition(pt.x, pt.y, STR_VIEWPORT_STATION);
433 FOR_ALL_BASE_STATIONS(st) {
459 for (uint i = 0; i < num_items; i++) {
484 int x1 =
max(x - rad, 0);
487 int y1 =
max(y - rad, 0);
507 FOR_ALL_INDUSTRIES(i) {
530 if (always_accepted != NULL) *always_accepted = 0;
539 int x1 =
max(x - rad, 0);
540 int y1 =
max(y - rad, 0);
547 for (
int yc = y1; yc != y2; yc++) {
548 for (
int xc = x1; xc != x2; xc++) {
550 AddAcceptedCargo(tile, acceptance, always_accepted);
569 if (!st->
rect.IsEmpty()) {
581 uint amt = acceptance[i];
599 if (old_acc == new_acc)
return;
605 static const StringID accept_msg[] = {
606 STR_NEWS_STATION_NOW_ACCEPTS_CARGO,
607 STR_NEWS_STATION_NOW_ACCEPTS_CARGO_AND_CARGO,
609 static const StringID reject_msg[] = {
610 STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO,
611 STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_OR_CARGO,
625 accepts[num_acc++] = i;
630 rejects[num_rej++] = i;
644 static void UpdateStationSignCoord(
BaseStation *st)
648 if (r->IsEmpty())
return;
682 CommandCost ret = (*st)->rect.BeforeAddRect(area.
tile, area.
w, area.
h, StationRect::ADD_TEST);
683 if (ret.
Failed())
return ret;
692 (*st)->string_id = GenerateStationName(*st, area.
tile, name_class);
715 UpdateStationSignCoord(st);
725 this->UpdateVirtCoord();
726 this->RecomputeIndustriesNear();
734 case STATION_AIRPORT:
743 default: NOT_REACHED();
773 if (ret.
Failed())
return ret;
796 cost.
AddCost(_price[PR_BUILD_FOUNDATION]);
803 }
else if (allowed_z != flat_z) {
823 if (ret.
Failed())
return ret;
827 if (ret.
Failed())
return ret;
848 static CommandCost CheckFlatLandRailStation(
TileArea tile_area,
DoCommandFlag flags,
Axis axis, StationID *station,
RailType rt,
SmallVector<Train *, 4> &affected_vehicles,
StationClassID spec_class, byte spec_index, byte plat_len, byte numtracks)
852 uint invalid_dirs = 5 << axis;
859 if (ret.
Failed())
return ret;
865 if (ret.
Failed())
return ret;
876 if (*station == INVALID_STATION) {
878 }
else if (*station != st) {
903 *affected_vehicles.
Append() = v;
907 if (ret.
Failed())
return ret;
914 if (ret.
Failed())
return ret;
941 if (ret.
Failed())
return ret;
960 if (*station == INVALID_STATION) {
962 }
else if (*station != st) {
986 uint num_roadbits = 0;
987 if (build_over_road) {
995 if (ret.
Failed())
return ret;
1011 if (ret.
Failed())
return ret;
1020 if (ret.
Failed())
return ret;
1024 uint roadbits_to_build =
CountBits(rts) * 2 - num_roadbits;
1025 cost.
AddCost(_price[PR_BUILD_ROAD] * roadbits_to_build);
1058 static inline byte *CreateSingle(byte *layout,
int n)
1061 do *layout++ = 0;
while (--i);
1062 layout[((n - 1) >> 1) - n] = 2;
1066 static inline byte *CreateMulti(byte *layout,
int n, byte b)
1069 do *layout++ = b;
while (--i);
1072 layout[n - 1 - n] = 0;
1086 if (statspec != NULL && statspec->lengths >= plat_len &&
1087 statspec->platforms[plat_len - 1] >= numtracks &&
1088 statspec->layouts[plat_len - 1][numtracks - 1]) {
1090 memcpy(layout, statspec->layouts[plat_len - 1][numtracks - 1],
1091 plat_len * numtracks);
1095 if (plat_len == 1) {
1096 CreateSingle(layout, numtracks);
1098 if (numtracks & 1) layout = CreateSingle(layout, plat_len);
1101 while (--numtracks >= 0) {
1102 layout = CreateMulti(layout, plat_len, 4);
1103 layout = CreateMulti(layout, plat_len, 6);
1119 template <
class T, StringID error_message>
1122 assert(*st == NULL);
1123 bool check_surrounding =
true;
1126 if (existing_station != INVALID_STATION) {
1127 if (adjacent && existing_station != station_to_join) {
1134 *st = T::GetIfValid(existing_station);
1135 check_surrounding = (*st == NULL);
1140 if (adjacent) check_surrounding =
false;
1144 if (check_surrounding) {
1147 if (ret.
Failed())
return ret;
1151 if (*st == NULL && station_to_join != INVALID_STATION) *st = T::GetIfValid(station_to_join);
1167 return FindJoiningBaseStation<Station, STR_ERROR_MUST_REMOVE_RAILWAY_STATION_FIRST>(existing_station, station_to_join, adjacent, ta, st);
1181 return FindJoiningBaseStation<Waypoint, STR_ERROR_MUST_REMOVE_RAILWAYPOINT_FIRST>(existing_waypoint, waypoint_to_join, adjacent, ta, wp);
1228 RailType rt = Extract<RailType, 0, 6>(p1);
1229 Axis axis = Extract<Axis, 6, 1>(p1);
1230 byte numtracks =
GB(p1, 8, 8);
1231 byte plat_len =
GB(p1, 16, 8);
1232 bool adjacent =
HasBit(p1, 24);
1235 byte spec_index =
GB(p2, 8, 8);
1236 StationID station_to_join =
GB(p2, 16, 16);
1240 if (ret.
Failed())
return ret;
1247 if (plat_len == 0 || numtracks == 0)
return CMD_ERROR;
1258 bool reuse = (station_to_join != NEW_STATION);
1259 if (!reuse) station_to_join = INVALID_STATION;
1260 bool distant_join = (station_to_join != INVALID_STATION);
1267 TileArea new_location(tile_org, w_org, h_org);
1270 StationID est = INVALID_STATION;
1274 if (cost.
Failed())
return cost;
1276 cost.
AddCost((numtracks * _price[PR_BUILD_STATION_RAIL] + _price[PR_BUILD_STATION_RAIL_LENGTH]) * plat_len);
1281 if (ret.
Failed())
return ret;
1283 ret =
BuildStationPart(&st, flags, reuse, new_location, STATIONNAMING_RAIL);
1284 if (ret.
Failed())
return ret;
1288 if (ret.
Failed())
return ret;
1296 if (statspec != NULL) {
1311 if (flags & DC_EXEC) {
1314 byte numtracks_orig;
1320 st->
rect.BeforeAddRect(tile_org, w_org, h_org, StationRect::ADD_TRY);
1322 if (statspec != NULL) {
1331 layout_ptr =
AllocaM(byte, numtracks * plat_len);
1334 numtracks_orig = numtracks;
1342 byte layout = *layout_ptr++;
1347 *affected_vehicles.
Append() = v;
1372 if (statspec != NULL) {
1387 TriggerStationAnimation(st, tile,
SAT_BUILT);
1395 }
while (--numtracks);
1397 for (uint i = 0; i < affected_vehicles.
Length(); ++i) {
1405 update_reservation_area =
TileArea(tile_org, 1, numtracks_orig);
1407 update_reservation_area =
TileArea(tile_org, numtracks_orig, 1);
1421 platform_begin = next_tile;
1424 platform_end = next_tile;
1428 bool reservation =
false;
1429 for (
TileIndex t = platform_begin; !reservation && t <= platform_end; t += tile_offset) {
1445 static void MakeRailStationAreaSmaller(
BaseStation *st)
1452 if (ta.
w != 0 && ta.
h != 0) {
1526 if (ret.
Failed())
continue;
1529 T *st = T::GetByTile(tile);
1530 if (st == NULL)
continue;
1535 if (ret.
Failed())
continue;
1544 total_cost.
AddCost(-_price[PR_CLEAR_RAIL]);
1563 DoClearSquare(tile);
1569 st->rect.AfterRemoveTile(st, tile);
1575 affected_stations.
Include(st);
1583 for (T **stp = affected_stations.
Begin(); stp != affected_stations.
End(); stp++) {
1589 MakeRailStationAreaSmaller(st);
1590 UpdateStationSignCoord(st);
1596 st->UpdateVirtCoord();
1601 total_cost.
AddCost(quantity * removal_cost);
1625 if (ret.
Failed())
return ret;
1628 for (
Station **stp = affected_stations.
Begin(); stp != affected_stations.
End(); stp++) {
1677 if (ret.
Failed())
return ret;
1683 assert(ta.
w != 0 && ta.
h != 0);
1689 if (st->TileBelongsToRailStation(tile)) {
1692 if (ret.
Failed())
return ret;
1747 if (*primary_stop == NULL) {
1749 return primary_stop;
1753 while (stop->
next != NULL) stop = stop->
next;
1771 return FindJoiningBaseStation<Station, STR_ERROR_MUST_REMOVE_ROAD_STOP_FIRST>(existing_stop, station_to_join, adjacent, ta, st);
1792 bool type =
HasBit(p2, 0);
1793 bool is_drive_through =
HasBit(p2, 1);
1794 RoadTypes rts = Extract<RoadTypes, 2, 2>(p2);
1795 StationID station_to_join =
GB(p2, 16, 16);
1796 bool reuse = (station_to_join != NEW_STATION);
1797 if (!reuse) station_to_join = INVALID_STATION;
1798 bool distant_join = (station_to_join != INVALID_STATION);
1800 uint8 width = (uint8)
GB(p1, 0, 8);
1801 uint8 length = (uint8)
GB(p1, 8, 8);
1806 if (width == 0 || length == 0)
return CMD_ERROR;
1810 TileArea roadstop_area(tile, width, length);
1821 if (is_drive_through) {
1823 axis = Extract<Axis, 6, 1>(p2);
1827 ddir = Extract<DiagDirection, 6, 2>(p2);
1832 if (ret.
Failed())
return ret;
1836 StationID est = INVALID_STATION;
1837 ret =
CheckFlatLandRoadStop(roadstop_area, flags, is_drive_through ? 5 << axis : 1 << ddir, is_drive_through, type, axis, &est, rts);
1838 if (ret.
Failed())
return ret;
1843 if (ret.
Failed())
return ret;
1848 ret =
BuildStationPart(&st, flags, reuse, roadstop_area, STATIONNAMING_ROAD);
1849 if (ret.
Failed())
return ret;
1865 *currstop = road_stop;
1876 st->
rect.BeforeAddTile(cur_tile, StationRect::ADD_TRY);
1879 if (is_drive_through) {
1940 if (ret.
Failed())
return ret;
1955 assert(cur_stop != NULL);
1963 if (ret.
Failed())
return ret;
1967 if (*primary_stop == cur_stop) {
1969 *primary_stop = cur_stop->
next;
1971 if (*primary_stop == NULL) {
1977 while (pred->
next != cur_stop) pred = pred->
next;
1997 DoClearSquare(tile);
2004 FOR_ALL_ROADVEHICLES(v) {
2011 st->
rect.AfterRemoveTile(st, tile);
2041 uint8 width = (uint8)
GB(p1, 0, 8);
2042 uint8 height = (uint8)
GB(p1, 8, 8);
2043 bool keep_drive_through_roads = !
HasBit(p2, 1);
2046 if (width == 0 || height == 0)
return CMD_ERROR;
2052 TileArea roadstop_area(tile, width, height);
2055 CommandCost last_error(STR_ERROR_THERE_IS_NO_STATION);
2056 bool had_success =
false;
2102 return had_success ? cost : last_error;
2113 uint mindist = UINT_MAX;
2147 uint noise_reduction = distance / town_tolerance_distance;
2163 Town *t, *nearest = NULL;
2165 uint mindist = UINT_MAX - add;
2171 if (dist < mindist) {
2190 FOR_ALL_STATIONS(st) {
2215 StationID station_to_join =
GB(p2, 16, 16);
2216 bool reuse = (station_to_join != NEW_STATION);
2217 if (!reuse) station_to_join = INVALID_STATION;
2218 bool distant_join = (station_to_join != INVALID_STATION);
2219 byte airport_type =
GB(p1, 0, 8);
2220 byte layout =
GB(p1, 8, 8);
2227 if (ret.
Failed())
return ret;
2245 if (cost.
Failed())
return cost;
2252 StringID authority_refuse_message = STR_NULL;
2253 Town *authority_refuse_town = NULL;
2258 authority_refuse_message = STR_ERROR_LOCAL_AUTHORITY_REFUSES_NOISE;
2259 authority_refuse_town = nearest;
2265 FOR_ALL_STATIONS(st) {
2269 authority_refuse_message = STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT;
2270 authority_refuse_town = t;
2274 if (authority_refuse_message != STR_NULL) {
2281 if (ret.
Failed())
return ret;
2287 if (ret.
Failed())
return ret;
2294 cost.
AddCost(_price[PR_BUILD_STATION_AIRPORT]);
2307 st->
rect.BeforeAddRect(tile, w, h, StationRect::ADD_TRY);
2319 AirportTileAnimationTrigger(st, iter,
AAT_BUILT);
2349 if (ret.
Failed())
return ret;
2373 if (!st->TileBelongsToAirport(tile_cur))
continue;
2376 if (ret.
Failed())
return ret;
2378 cost.
AddCost(_price[PR_CLEAR_STATION_AIRPORT]);
2380 if (flags & DC_EXEC) {
2383 DoClearSquare(tile_cur);
2388 if (flags & DC_EXEC) {
2436 if (ret.
Failed())
return ret;
2455 if ((v->
owner == company) == include_company) {
2457 FOR_VEHICLE_ORDERS(v, order) {
2473 static const byte _dock_w_chk[4] = { 2, 1, 2, 1 };
2474 static const byte _dock_h_chk[4] = { 1, 2, 1, 2 };
2487 StationID station_to_join =
GB(p2, 16, 16);
2488 bool reuse = (station_to_join != NEW_STATION);
2489 if (!reuse) station_to_join = INVALID_STATION;
2490 bool distant_join = (station_to_join != INVALID_STATION);
2502 if (ret.
Failed())
return ret;
2507 if (ret.
Failed())
return ret;
2521 if (ret.
Failed())
return ret;
2529 _dock_w_chk[direction], _dock_h_chk[direction]);
2534 if (ret.
Failed())
return ret;
2540 if (ret.
Failed())
return ret;
2548 st->
rect.BeforeAddRect(dock_area.
tile, dock_area.
w, dock_area.
h, StationRect::ADD_TRY);
2575 if (ret.
Failed())
return ret;
2584 if (ret.
Failed())
return ret;
2587 DoClearSquare(tile1);
2589 MakeWaterKeepingClass(tile2, st->
owner);
2591 st->
rect.AfterRemoveTile(st, tile1);
2592 st->
rect.AfterRemoveTile(st, tile2);
2625 return &_station_display_datas[st][gfx];
2641 case SPR_RAIL_TRACK_X:
2642 snow_desert =
false;
2643 *overlay_offset =
RTO_X;
2646 case SPR_RAIL_TRACK_Y:
2647 snow_desert =
false;
2648 *overlay_offset =
RTO_Y;
2651 case SPR_RAIL_TRACK_X_SNOW:
2653 *overlay_offset =
RTO_X;
2656 case SPR_RAIL_TRACK_Y_SNOW:
2658 *overlay_offset =
RTO_Y;
2681 *ground = snow_desert ? SPR_FLAT_SNOW_DESERT_TILE : SPR_FLAT_GRASS_TILE;
2685 static void DrawTile_Station(
TileInfo *ti)
2693 uint32 relocation = 0;
2694 uint32 ground_relocation = 0;
2697 uint tile_layout = 0;
2709 if (statspec != NULL) {
2746 case APT_RADAR_GRASS_FENCE_SW:
2749 case APT_GRASS_FENCE_NE_FLAG:
2752 case APT_RADAR_FENCE_SW:
2755 case APT_RADAR_FENCE_NE:
2758 case APT_GRASS_FENCE_NE_FLAG_2:
2768 palette = COMPANY_SPRITE_COLOUR(owner);
2771 palette = PALETTE_TO_GREY;
2774 if (layout == NULL && (t == NULL || t->
seq == NULL)) t = GetStationTileLayout(
GetStationType(ti->
tile), gfx);
2784 if (!HasFoundationNW(ti->
tile, slope, z))
SetBit(edge_info, 0);
2785 if (!HasFoundationNE(ti->
tile, slope, z))
SetBit(edge_info, 1);
2787 if (image == 0)
goto draw_default_foundation;
2792 static const uint8 foundation_parts[] = {
2805 static const uint8 composite_foundation_parts[] = {
2807 0x00, 0xD1, 0xE4, 0xE0,
2809 0xCA, 0xC9, 0xC4, 0xC0,
2811 0xD2, 0x91, 0xE4, 0xA0,
2816 uint8 parts = composite_foundation_parts[ti->
tileh];
2827 goto draw_default_foundation;
2831 for (
int i = 0; i < 8; i++) {
2842 draw_default_foundation:
2848 DrawWaterClassGround(ti);
2850 if (sprite != 0) total_offset = sprite - SPR_IMG_BUOY;
2853 DrawWaterClassGround(ti);
2859 DrawShoreTile(ti->
tileh);
2861 DrawClearLandTile(ti, 3);
2865 if (layout != NULL) {
2875 t = &tmp_rail_layout;
2877 }
else if (statspec != NULL) {
2929 int32 total_offset = 0;
2944 DrawSprite(ground + overlay_offset, PAL_NONE, x, y);
2957 static int GetSlopePixelZ_Station(
TileIndex tile, uint x, uint y)
2982 td->
owner_type[i] = STR_LAND_AREA_INFORMATION_ROAD_OWNER;
2983 td->
owner[i] = road_owner;
2987 td->
owner_type[i] = STR_LAND_AREA_INFORMATION_TRAM_OWNER;
2988 td->
owner[i] = tram_owner;
3031 default: NOT_REACHED();
3032 case STATION_RAIL: str = STR_LAI_STATION_DESCRIPTION_RAILROAD_STATION;
break;
3033 case STATION_AIRPORT:
3034 str = (
IsHangar(tile) ? STR_LAI_STATION_DESCRIPTION_AIRCRAFT_HANGAR : STR_LAI_STATION_DESCRIPTION_AIRPORT);
3036 case STATION_TRUCK: str = STR_LAI_STATION_DESCRIPTION_TRUCK_LOADING_AREA;
break;
3037 case STATION_BUS: str = STR_LAI_STATION_DESCRIPTION_BUS_STATION;
break;
3038 case STATION_OILRIG: str = STR_INDUSTRY_NAME_OIL_RIG;
break;
3039 case STATION_DOCK: str = STR_LAI_STATION_DESCRIPTION_SHIP_DOCK;
break;
3040 case STATION_BUOY: str = STR_LAI_STATION_DESCRIPTION_BUOY;
break;
3041 case STATION_WAYPOINT: str = STR_LAI_STATION_DESCRIPTION_WAYPOINT;
break;
3090 static void TileLoop_Station(
TileIndex tile)
3095 case STATION_AIRPORT:
3103 case STATION_OILRIG:
3113 static void AnimateTile_Station(
TileIndex tile)
3116 AnimateStationTile(tile);
3121 AnimateAirportTile(tile);
3126 static bool ClickTile_Station(
TileIndex tile)
3170 }
else if (x < stop) {
3172 uint16 spd =
max(0, (stop - x) * 20 - 15);
3173 if (spd < v->cur_speed) v->
cur_speed = spd;
3196 CargoTypes cargoes = 0;
3202 if (cargoes == 0)
return;
3241 static inline void byte_inc_sat(byte *p)
3258 StationCargoAmountMap waiting_per_source;
3260 for (StationCargoAmountMap::iterator i(waiting_per_source.begin()); i != waiting_per_source.end(); ++i) {
3262 if (source_station == NULL)
continue;
3269 static void UpdateStationRating(
Station *st)
3271 bool waiting_changed =
false;
3273 byte_inc_sat(&st->time_since_load);
3274 byte_inc_sat(&st->time_since_unload);
3277 FOR_ALL_CARGOSPECS(cs) {
3293 waiting_changed =
true;
3312 uint waiting_avg = waiting / (num_dests + 1);
3323 uint32 var10 = (st->last_vehicle_type ==
VEH_INVALID) ? 0x0 : (st->last_vehicle_type + 0x10);
3327 rating =
GB(callback, 0, 14);
3330 if (
HasBit(callback, 14)) rating -= 0x4000;
3336 if (b >= 0) rating += b >> 2;
3339 if (st->last_vehicle_type ==
VEH_SHIP) waittime >>= 2;
3341 (rating += 25, waittime > 12) ||
3342 (rating += 25, waittime > 6) ||
3343 (rating += 45, waittime > 3) ||
3344 (rating += 35,
true);
3351 (rating += 10,
true);
3358 (rating += 10, age >= 2) ||
3359 (rating += 10, age >= 1) ||
3360 (rating += 13,
true);
3370 if (rating <= 64 && waiting_avg >= 100) {
3371 int dec = Random() & 0x1F;
3372 if (waiting_avg < 200) dec &= 7;
3373 waiting -= (dec + 1) * num_dests;
3374 waiting_changed =
true;
3378 if (rating <= 127 && waiting != 0) {
3379 uint32 r = Random();
3380 if (rating <= (
int)
GB(r, 0, 7)) {
3382 waiting =
max((
int)waiting - (
int)((
GB(r, 8, 2) - 1) * num_dests), 0);
3383 waiting_changed =
true;
3390 static const uint WAITING_CARGO_THRESHOLD = 1 << 12;
3391 static const uint WAITING_CARGO_CUT_FACTOR = 1 << 6;
3392 static const uint MAX_WAITING_CARGO = 1 << 15;
3394 if (waiting > WAITING_CARGO_THRESHOLD) {
3395 uint difference = waiting - WAITING_CARGO_THRESHOLD;
3396 waiting -= (difference / WAITING_CARGO_CUT_FACTOR);
3398 waiting =
min(waiting, MAX_WAITING_CARGO);
3399 waiting_changed =
true;
3404 if (waiting_changed && waiting < ge->cargo.AvailableCount()) {
3418 StationID index = st->
index;
3419 if (waiting_changed) {
3442 for (std::list<Vehicle *>::iterator it(st->loading_vehicles.begin()); it != st->loading_vehicles.end(); ++it) {
3443 for (
Vehicle *v = *it; v != NULL; v = v->
Next()) {
3464 if (lg == NULL)
continue;
3467 Edge edge = it->second;
3474 bool updated =
false;
3476 if (auto_distributed) {
3481 FOR_ALL_ORDER_LISTS(l) {
3482 bool found_from =
false;
3483 bool found_to =
false;
3485 if (!order->IsType(OT_GOTO_STATION) && !order->IsType(OT_IMPLICIT))
continue;
3486 if (order->GetDestination() == from->
index) {
3488 if (found_to)
break;
3489 }
else if (order->GetDestination() == to->
index) {
3491 if (found_from)
break;
3494 if (!found_to || !found_from)
continue;
3499 while (iter != vehicles.
End()) {
3510 *iter = next_shared;
3513 vehicles.
Erase(iter);
3516 if (iter == vehicles.
End()) iter = vehicles.
Begin();
3564 DEBUG(misc, 0,
"Can't allocate link graph");
3573 }
else if (ge2.
link_graph == INVALID_LINK_GRAPH) {
3592 (*lg)[ge1.
node].UpdateEdge(ge2.
node, capacity, usage, mode);
3604 for (
const Vehicle *v = front; v != NULL; v = v->
Next()) {
3619 static void StationHandleSmallTick(
BaseStation *st)
3630 void OnTick_Station()
3632 if (_game_mode == GM_EDITOR)
return;
3635 FOR_ALL_BASE_STATIONS(st) {
3636 StationHandleSmallTick(st);
3660 FOR_ALL_STATIONS(st) {
3670 void ModifyStationRatingAround(
TileIndex tile,
Owner owner,
int amount, uint radius)
3674 FOR_ALL_STATIONS(st) {
3675 if (st->
owner == owner &&
3700 if (amount == 0)
return 0;
3712 DEBUG(misc, 0,
"Can't allocate link graph");
3717 if (lg != NULL) (*lg)[ge.
node].UpdateSupply(amount);
3733 static bool IsUniqueStationName(
const char *name)
3737 FOR_ALL_STATIONS(st) {
3738 if (st->
name != NULL && strcmp(st->
name, name) == 0)
return false;
3759 if (ret.
Failed())
return ret;
3765 if (!IsUniqueStationName(text))
return_cmd_error(STR_ERROR_NAME_MUST_BE_UNIQUE);
3793 uint min_x = (x > max_rad) ? x - max_rad : 0;
3794 uint max_x = x + location.
w + max_rad;
3795 uint min_y = (y > max_rad) ? y - max_rad : 0;
3796 uint max_y = y + location.
h + max_rad;
3803 for (uint cy = min_y; cy < max_y; cy++) {
3804 for (uint cx = min_x; cx < max_x; cx++) {
3810 if (st == NULL)
continue;
3817 if (rad_x < -rad || rad_x >= rad + location.
w)
continue;
3818 if (rad_y < -rad || rad_y >= rad + location.
h)
continue;
3839 return &this->stations;
3845 if (amount == 0)
return 0;
3849 uint best_rating1 = 0;
3850 uint best_rating2 = 0;
3852 for (
Station *
const *st_iter = all_stations->
Begin(); st_iter != all_stations->
End(); ++st_iter) {
3869 if (st1 == NULL || st->
goods[type].
rating >= best_rating1) {
3870 st2 = st1; best_rating2 = best_rating1; st1 = st; best_rating1 = st->
goods[type].
rating;
3871 }
else if (st2 == NULL || st->
goods[type].
rating >= best_rating2) {
3877 if (st1 == NULL)
return 0;
3881 amount *= best_rating1 + 1;
3885 return UpdateStationWaiting(st1, type, amount, source_type, source_id);
3889 assert(st1 != NULL);
3890 assert(st2 != NULL);
3891 assert(best_rating1 != 0 || best_rating2 != 0);
3898 uint worst_cargo = amount * best_rating2 / (best_rating1 + best_rating2);
3899 assert(worst_cargo <= (amount - worst_cargo));
3902 uint moved = UpdateStationWaiting(st1, type, amount - worst_cargo, source_type, source_id);
3905 return moved + UpdateStationWaiting(st2, type, worst_cargo, source_type, source_id);
3911 DEBUG(misc, 0,
"Can't allocate station for oilrig at 0x%X, reverting to oilrig only", tile);
3918 st->
string_id = GenerateStationName(st, tile, STATIONNAMING_OILRIG);
3931 st->
rect.BeforeAddTile(tile, StationRect::ADD_FORCE);
3949 st->
rect.AfterRemoveTile(st, tile);
3953 if (!st->
IsInUse())
delete st;
3985 case STATION_WAYPOINT:
4077 case STATION_WAYPOINT:
return_cmd_error(STR_ERROR_BUILDING_MUST_BE_DEMOLISHED);
4078 case STATION_AIRPORT:
return_cmd_error(STR_ERROR_MUST_DEMOLISH_AIRPORT_FIRST);
4083 case STATION_OILRIG:
4084 SetDParam(1, STR_INDUSTRY_NAME_OIL_RIG);
4103 case STATION_BUOY:
return RemoveBuoy(tile, flags);
4104 case STATION_DOCK:
return RemoveDock(tile, flags);
4119 case STATION_WAYPOINT:
4120 case STATION_RAIL: {
4127 case STATION_AIRPORT:
4155 for (SharesMap::const_iterator it = this->shares.begin(); it != this->shares.end(); ++it) {
4156 if (it->second == st) {
4157 return it->first - prev;
4173 if (this->unrestricted == 0)
return INVALID_STATION;
4174 assert(!this->shares.empty());
4175 SharesMap::const_iterator it = this->shares.upper_bound(
RandomRange(this->unrestricted));
4176 assert(it != this->shares.end() && it->first <= this->unrestricted);
4177 if (it->second != excluded && it->second != excluded2)
return it->second;
4182 uint end = it->first;
4183 uint begin = (it == this->shares.begin() ? 0 : (--it)->first);
4184 uint interval = end - begin;
4185 if (interval >= this->unrestricted)
return INVALID_STATION;
4186 uint new_max = this->unrestricted - interval;
4188 SharesMap::const_iterator it2 = (rand < begin) ? this->shares.upper_bound(rand) :
4189 this->shares.upper_bound(rand + interval);
4190 assert(it2 != this->shares.end() && it2->first <= this->unrestricted);
4191 if (it2->second != excluded && it2->second != excluded2)
return it2->second;
4196 uint end2 = it2->first;
4197 uint begin2 = (it2 == this->shares.begin() ? 0 : (--it2)->first);
4198 uint interval2 = end2 - begin2;
4199 if (interval2 >= new_max)
return INVALID_STATION;
4200 new_max -= interval2;
4201 if (begin > begin2) {
4202 Swap(begin, begin2);
4204 Swap(interval, interval2);
4207 SharesMap::const_iterator it3 = this->shares.upper_bound(this->unrestricted);
4209 it3 = this->shares.upper_bound(rand);
4210 }
else if (rand < begin2 - interval) {
4211 it3 = this->shares.upper_bound(rand + interval);
4213 it3 = this->shares.upper_bound(rand + interval + interval2);
4215 assert(it3 != this->shares.end() && it3->first <= this->unrestricted);
4226 assert(!this->shares.empty());
4227 SharesMap new_shares;
4229 for (SharesMap::iterator it(this->shares.begin()); it != this->shares.end(); ++it) {
4230 new_shares[++i] = it->second;
4231 if (it->first == this->unrestricted) this->unrestricted = i;
4233 this->shares.swap(new_shares);
4234 assert(!this->shares.empty() && this->unrestricted <= (--this->shares.end())->first);
4247 assert(!this->shares.empty());
4249 uint removed_shares = 0;
4250 uint added_shares = 0;
4251 uint last_share = 0;
4252 SharesMap new_shares;
4253 for (SharesMap::iterator it(this->shares.begin()); it != this->shares.end(); ++it) {
4254 if (it->second == st) {
4256 uint share = it->first - last_share;
4257 if (flow == INT_MIN || (uint)(-flow) >= share) {
4258 removed_shares += share;
4259 if (it->first <= this->unrestricted) this->unrestricted -= share;
4260 if (flow != INT_MIN) flow += share;
4261 last_share = it->first;
4264 removed_shares += (uint)(-flow);
4266 added_shares += (uint)(flow);
4268 if (it->first <= this->unrestricted) this->unrestricted += flow;
4274 new_shares[it->first + added_shares - removed_shares] = it->second;
4275 last_share = it->first;
4278 new_shares[last_share + (uint)flow] = st;
4279 if (this->unrestricted < last_share) {
4280 this->ReleaseShare(st);
4282 this->unrestricted += flow;
4285 this->shares.swap(new_shares);
4295 assert(!this->shares.empty());
4297 uint last_share = 0;
4298 SharesMap new_shares;
4299 for (SharesMap::iterator it(this->shares.begin()); it != this->shares.end(); ++it) {
4301 if (it->first > this->unrestricted)
return;
4302 if (it->second == st) {
4303 flow = it->first - last_share;
4304 this->unrestricted -= flow;
4306 new_shares[it->first] = it->second;
4309 new_shares[it->first - flow] = it->second;
4311 last_share = it->first;
4313 if (flow == 0)
return;
4314 new_shares[last_share + flow] = st;
4315 this->shares.swap(new_shares);
4316 assert(!this->shares.empty());
4326 assert(!this->shares.empty());
4328 uint next_share = 0;
4330 for (SharesMap::reverse_iterator it(this->shares.rbegin()); it != this->shares.rend(); ++it) {
4331 if (it->first < this->unrestricted)
return;
4333 flow = next_share - it->first;
4334 this->unrestricted += flow;
4337 if (it->first == this->unrestricted)
return;
4338 if (it->second == st) found =
true;
4340 next_share = it->first;
4342 if (flow == 0)
return;
4343 SharesMap new_shares;
4344 new_shares[flow] = st;
4345 for (SharesMap::iterator it(this->shares.begin()); it != this->shares.end(); ++it) {
4346 if (it->second != st) {
4347 new_shares[flow + it->first] = it->second;
4352 this->shares.swap(new_shares);
4353 assert(!this->shares.empty());
4363 assert(runtime > 0);
4364 SharesMap new_shares;
4366 for (SharesMap::iterator i = this->shares.begin(); i != this->shares.end(); ++i) {
4367 share =
max(share + 1, i->first * 30 / runtime);
4368 new_shares[share] = i->second;
4369 if (this->unrestricted == i->first) this->unrestricted = share;
4371 this->shares.swap(new_shares);
4382 FlowStatMap::iterator origin_it = this->find(origin);
4383 if (origin_it == this->end()) {
4384 this->insert(std::make_pair(origin,
FlowStat(via, flow)));
4386 origin_it->second.ChangeShare(via, flow);
4387 assert(!origin_it->second.GetShares()->empty());
4401 FlowStatMap::iterator prev_it = this->find(origin);
4402 if (prev_it == this->end()) {
4405 this->insert(std::make_pair(origin, fs));
4407 prev_it->second.ChangeShare(via, flow);
4408 prev_it->second.ChangeShare(INVALID_STATION, flow);
4409 assert(!prev_it->second.GetShares()->empty());
4419 for (FlowStatMap::iterator i = this->begin(); i != this->end(); ++i) {
4421 uint local = fs.
GetShare(INVALID_STATION);
4422 if (local > INT_MAX) {
4445 for (FlowStatMap::iterator f_it = this->begin(); f_it != this->end();) {
4449 ret.
Push(f_it->first);
4450 this->erase(f_it++);
4464 for (FlowStatMap::iterator it = this->begin(); it != this->end(); ++it) {
4465 it->second.RestrictShare(via);
4475 for (FlowStatMap::iterator it = this->begin(); it != this->end(); ++it) {
4476 it->second.ReleaseShare(via);
4487 for (FlowStatMap::const_iterator i = this->begin(); i != this->end(); ++i) {
4488 ret += (--(i->second.GetShares()->end()))->first;
4501 for (FlowStatMap::const_iterator i = this->begin(); i != this->end(); ++i) {
4502 ret += i->second.GetShare(via);
4514 FlowStatMap::const_iterator i = this->find(from);
4515 if (i == this->end())
return 0;
4516 return (--(i->second.GetShares()->end()))->first;
4527 FlowStatMap::const_iterator i = this->find(from);
4528 if (i == this->end())
return 0;
4529 return i->second.GetShare(via);
4534 GetSlopePixelZ_Station,
4537 GetTileDesc_Station,
4538 GetTileTrackStatus_Station,
4540 AnimateTile_Station,
4542 ChangeTileOwner_Station,
4544 VehicleEnter_Station,
4545 GetFoundation_Station,
4546 TerraformTile_Station,
Functions related to OTTD's strings.
void TriggerStationRandomisation(Station *st, TileIndex tile, StationRandomTrigger trigger, CargoID cargo_type)
Trigger station randomisation.
don't allow building on structures
static void MakeRailStation(TileIndex t, Owner o, StationID sid, Axis a, byte section, RailType rt)
Make the given tile a rail station tile.
EdgeIterator Begin()
Get an iterator pointing to the start of the edges array.
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner)
Change the owner of a 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.
Functions/types related to NewGRF debugging.
static void Swap(T &a, T &b)
Type safe swap operation.
byte type
Type of this airport,.
uint32 PaletteID
The number of the palette.
static void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
Make the given tile a dock tile.
void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner)
Add track to signal update buffer.
VehicleCargoList cargo
The cargo this vehicle is carrying.
static uint MapSizeX()
Get the size of the map along the X.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition of stuff that is very close to a company, like the company struct itself.
CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z, bool allow_steep, bool check_bridge=true)
Checks if the given tile is buildable, flat and has a certain height.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
NodeID AddNode(const Station *st)
Add a node to the component and create empty edges associated with it.
void ShowWaypointWindow(const Waypoint *wp)
Show the window for the given waypoint.
Use callback to select a sprite layout to use.
static void SetCustomStationSpecIndex(TileIndex t, byte specindex)
Set the custom station spec for this tile.
bool enabled
entity still available (by default true).newgrf can disable it, though
bool IsAvailable() const
Check whether this airport is available to build.
static bool FindNearIndustryName(TileIndex tile, void *user_data)
Find a station action 0 property 24 station name, or reduce the free_names if needed.
NewGRF handling of rail types.
static const RailtypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
static TropicZone GetTropicZone(TileIndex tile)
Get the tropic zone.
Select station (when joining stations); Window numbers:
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
static void SetAnimationFrame(TileIndex t, byte frame)
Set a new animation frame.
A standard stop for trucks.
static const uint COMPRESSION_INTERVAL
Minimum number of days between subsequent compressions of a LG.
static uint MapSizeY()
Get the size of the map along the Y.
static bool IsCustomStationSpecIndex(TileIndex t)
Is there a custom rail station spec on this tile?
Rect GetCatchmentRect() const
Determines catchment rectangle of this station.
const AirportSpec * GetSpec() const
Get the AirportSpec that from the airport type of this airport.
static void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
Tile information, used while rendering the tile.
TileArea bus_station
Tile area the bus 'station' part covers.
CompanyMask statues
which companies have a statue?
Definition of link refreshing utility.
StationID targetairport
Airport to go to next.
Minimal stack that uses a pool to avoid pointers.
void DeallocateSpecFromStation(BaseStation *st, byte specindex)
Deallocate a StationSpec from a Station.
Some typedefs for the main game.
CommandCost CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadType rt, DoCommandFlag flags, bool town_check)
Is it allowed to remove the given road bits from the given tile?
const AirportFTAClass * GetAirport(const byte airport_type)
Get the finite state machine of an airport type.
void TileLoop_Water(TileIndex tile)
Let a water tile floods its diagonal adjoining tiles called from tunnelbridge_cmd, and by TileLoop_Industry() and TileLoop_Track()
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
static DiagDirection DirToDiagDir(Direction dir)
Convert a Direction to a DiagDirection.
byte landscape
the landscape we're currently in
Reference station. Scroll to station when clicking on the news. Delete news when station is deleted...
void AddAnimatedTile(TileIndex tile)
Add the given tile to the animated tile table (if it does not exist on that table yet)...
DirectionByte direction
facing
byte size_y
size of airport in y direction
Iterator to iterate over all tiles belonging to an airport.
company buildings - depots, stations, HQ, ...
RailType
Enumeration for all possible railtypes.
Base class for roadstops.
Non-existing type of vehicle.
static bool IsReversingRoadTrackdir(Trackdir dir)
Checks whether the trackdir means that we are reversing.
void Queue(LinkGraph *lg)
Queue a link graph for execution.
Date LastUnrestrictedUpdate() const
Get the date of the last update to the edge's unrestricted capacity.
bool HasVehicleEverTriedLoading() const
Reports whether a vehicle has ever tried to load the cargo at this station.
uint16 triggers
The triggers that trigger animation.
virtual void UpdateVirtCoord()=0
Update the coordinated of the sign (as shown in the viewport).
uint GetNumHangars() const
Get the number of hangars on this airport.
static CommandCost CheckFlatLandAirport(AirportTileTableIterator tile_iter, DoCommandFlag flags)
Checks if an airport can be built at the given location and clear the area.
static bool IsRailStation(TileIndex t)
Is this station tile a rail station?
EconomySettings economy
settings to change the economy
static RoadBits GetAllRoadBits(TileIndex tile)
Get all set RoadBits on the given tile.
static RoadStopType GetRoadStopType(TileIndex t)
Get the road stop type of this tile.
CommandCost EnsureNoVehicleOnGround(TileIndex tile)
Ensure there is no vehicle at the ground at the given position.
Flag for an invalid DiagDirection.
int32 TileIndexDiff
An offset value between to tiles.
static bool IsWater(TileIndex t)
Is it a plain water tile?
virtual TileIterator * Clone() const =0
Allocate a new iterator that is a copy of this one.
static Titem * Get(size_t index)
Returns Titem with given index.
static Station * GetClosestDeletedStation(TileIndex tile)
Find the closest deleted station of the current company.
static RoadStop ** FindRoadStopSpot(bool truck_station, Station *st)
void Unqueue(LinkGraph *lg)
Remove a link graph from the execution queue.
Functions related to dates.
static WaterClass GetWaterClass(TileIndex t)
Get the water class at a tile.
const char * grf
newGRF used for the tile contents
uint GetSpecCount() const
Get the number of allocated specs within the class.
CompanyByte exclusivity
which company has exclusivity
static const AirportTileSpec * GetByTile(TileIndex tile)
Retrieve airport tile spec for the given airport tile.
static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
Remove an airport.
Base for the train class.
The vehicle is in a drive-through road stop.
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, CargoTypes *always_accepted)
Get the acceptance of cargoes around the tile in 1/8.
static byte GetAnimationFrame(TileIndex t)
Get the current animation frame.
uint Reroute(uint max_move, StationCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge)
Routes packets with station "avoid" as next hop to a different place.
Functions related to debugging.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset)
Check whether a sprite is a track sprite, which can be replaced by a non-track ground sprite and a ra...
Track
These are used to specify a single track.
Can planes land on this airport type?
uint16 cur_speed
current speed
A tile with road (or tram tracks)
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
bool distant_join_stations
allow to join non-adjacent stations
static TrackBits AxisToTrackBits(Axis a)
Maps an Axis to the corresponding TrackBits value.
Depot view; Window numbers:
Slope tileh
Slope of the tile.
Maximal number of cargo types in a game.
Full road along the x-axis (south-west + north-east)
Set when cargo was delivered for final delivery during the current STATION_ACCEPTANCE_TICKS interval...
Functions used internally by the roads.
Specification of a cargo type.
SpriteID GetCanalSprite(CanalFeature feature, TileIndex tile)
Lookup the base sprite to use for a canal.
bool IsInUse() const
Check whether the base station currently is in use; in use means that it is not scheduled for deletio...
TileIndex dock_tile
The location of the dock.
IndustryLifeType life_type
This is also known as Industry production flag, in newgrf specs.
TileIndex dest_tile
Heading for this tile.
bool ValParamRailtype(const RailType rail)
Validate functions for rail building.
void MakeDriveThrough()
Join this road stop to another 'base' road stop if possible; fill all necessary data to become an act...
static bool IsRoadStop(TileIndex t)
Is the station at t a road station?
Functions related to vehicles.
Aircraft, helicopters, rotors and their shadows belong to this class.
Set when cargo was delivered for final delivery this month.
Manual distribution. No link graph calculations are run.
static const uint INVALID_AIRPORTTILE
id for an invalid airport tile
static bool HasTileWaterGround(TileIndex t)
Checks whether the tile has water at the ground.
static DiagDirection GetDockDirection(TileIndex t)
Get the direction of a dock.
static uint TileX(TileIndex tile)
Get the X component of a tile.
A standard stop for buses.
TileArea train_station
Tile area the train 'station' part covers.
static bool CMSATree(TileIndex tile)
Check whether the tile is a tree.
static bool IsExpected(const BaseStation *st)
Helper for checking whether the given station is of this type.
static void MakeOilrig(TileIndex t, StationID sid, WaterClass wc)
Make the given tile an oilrig tile.
byte station_spread
amount a station may spread
static int GetSlopeMaxZ(Slope s)
Returns the height of the highest corner of a slope relative to TileZ (= minimal height) ...
StationIDStack DeleteFlows(StationID via)
Delete all flows at a station for specific cargo and destination.
static bool HasTileRoadType(TileIndex t, RoadType rt)
Check if a tile has a specific road type.
StationRect rect
NOSAVE: Station spread out rectangle maintained by StationRect::xxx() functions.
Iterator to iterate over all tiles belonging to an airport spec.
uint GetFlowVia(StationID via) const
Get the sum of flows via a specific station from this FlowStatMap.
Defines the internal data of a functional industry.
const T * Begin() const
Get the pointer to the first item (const)
Tile description for the 'land area information' tool.
void LeaveStation()
Perform all actions when leaving a station.
DifficultySettings difficulty
settings related to the difficulty
Stores station stats for a single cargo.
Tindex index
Index of this pool item.
Vehicle is flying in the air.
static RoadBits GetRoadBits(TileIndex t, RoadType rt)
Get the present road bits for a specific road type.
#define FOR_EACH_SET_ROADTYPE(var, road_types)
Iterate through each set RoadType in a RoadTypes value.
static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
Remove a dock.
static StationGfx GetAirportGfx(TileIndex t)
Get the station graphics of this airport tile.
Northeast, upper right on your monitor.
void ReleaseFlows(StationID via)
Release all flows at a station for specific cargo and destination.
static bool IsSteepSlope(Slope s)
Checks if a slope is steep.
T * First() const
Get the first vehicle in the chain.
static void FreeTrainReservation(Train *v)
Clear platform reservation during station building/removing.
Helper functions to extract data from command parameters.
void PassOnFlow(StationID origin, StationID via, uint amount)
Pass on some flow, remembering it as invalid, for later subtraction from locally consumed flow...
const DrawTileSeqStruct * GetLayout(PalSpriteID *ground) const
Returns the result spritelayout after preprocessing.
static CommandCost FindJoiningRoadStop(StationID existing_stop, StationID station_to_join, bool adjacent, TileArea ta, Station **st)
Find a nearby station that joins this road stop.
void FinalizeLocalConsumption(StationID self)
Subtract invalid flows from locally consumed flow.
Representation of a waypoint.
Simple vector template class.
void MarkTilesDirty(bool cargo_change) const
Marks the tiles of the station as dirty.
static Track AxisToTrack(Axis a)
Convert an Axis to the corresponding Track AXIS_X -> TRACK_X AXIS_Y -> TRACK_Y Uses the fact that the...
static Track GetRailStationTrack(TileIndex t)
Get the rail track of a rail station tile.
CommandCost FindJoiningBaseStation(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, T **st)
Find a nearby station that joins this station.
uint32 station
Count of company owned station tiles.
#define FOR_EACH_SET_BIT(bitpos_var, bitset_value)
Do an operation for each set set bit in a value.
#define AllocaM(T, num_elements)
alloca() has to be called in the parent function, so define AllocaM() as a macro
Common return value for all commands.
static bool IsStandardRoadStopTile(TileIndex t)
Is tile t a standard (non-drive through) road stop station?
static bool HasExactlyOneBit(T value)
Test whether value has exactly 1 bit set.
void StartSpriteCombine()
Starts a block of sprites, which are "combined" into a single bounding box.
RoadType
The different roadtypes we support.
StationCargoList cargo
The cargo packets of cargo waiting in this station.
static T max(const T a, const T b)
Returns the maximum of two values.
uint16 classes
Classes of this cargo type.
static bool IsDriveThroughStopTile(TileIndex t)
Is tile t a drive through road stop station?
Town * town
The town this station is associated with.
bool HasRating() const
Does this cargo have a rating at this station?
Vehicle * GetFirstSharedVehicle() const
Get the first vehicle of this vehicle chain.
uint8 status
Status; 0: no looping, 1: looping, 0xFF: no animation.
static DiagDirection TrackdirToExitdir(Trackdir trackdir)
Maps a trackdir to the (4-way) direction the tile is exited when following that trackdir.
uint GetFlowFrom(StationID from) const
Get the sum of flows from a specific station from this FlowStatMap.
uint tiles
Number of tile layouts.
uint StoredCount() const
Returns sum of cargo on board the vehicle (ie not only reserved).
uint16 w
The width of the area.
static RoadVehicle * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
bool IsTileFlat(TileIndex tile, int *h)
Check if a given tile is flat.
void Clear()
Clears the 'tile area', i.e.
Determine whether a newstation should be made available to build.
The vehicle entered a station.
static Slope GetFoundationPixelSlope(TileIndex tile, int *z)
Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation, the function returns the same as GetTilePixelSlope.
const T * End() const
Get the pointer behind the last valid item (const)
uint16 noise_reached
level of noise that all the airports are generating
uint16 rail_speed
Speed limit of rail (bridges and track)
byte nof_depots
the number of hangar tiles in this airport
bool IsNormalAircraft() const
Check if the aircraft type is a normal flying device; eg not a rotor or a shadow. ...
static StationType GetStationType(TileIndex t)
Get the station type of this tile.
StationSettings station
settings related to station management
GoodsEntry goods[NUM_CARGO]
Goods at this station.
static const uint TILE_SIZE
Tile size in world coordinates.
static CommandCost RemoveRailWaypoint(TileIndex tile, DoCommandFlag flags)
Remove a rail waypoint.
static uint32 RandomRange(uint32 limit)
Pick a random number between 0 and limit - 1, inclusive.
RoadStopType
Types of RoadStops.
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
Owner owner[4]
Name of the owner(s)
Direction
Defines the 8 directions on the map.
void UpdateStationAcceptance(Station *st, bool show_msg)
Update the acceptance for a station.
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.
static uint GetCustomStationSpecIndex(TileIndex t)
Get the custom station spec for this tile.
const DrawTileSeqStruct * seq
Array of child sprites. Terminated with a terminator entry.
const AirportTileTable *const * table
list of the tiles composing the airport
CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a bus or truck stop.
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track)
Use this function to notify YAPF that track layout (or signal configuration) has change.
static Station * From(BaseStation *st)
Converts a BaseStation to SpecializedStation with type checking.
static uint ClampU(const uint a, const uint min, const uint max)
Clamp an unsigned integer between an interval.
This struct contains all the info that is needed to draw and construct tracks.
CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
Clear a single tile of a station.
T * Append(uint to_add=1)
Append an item and return it.
byte delete_ctr
Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is ...
Order * next
Pointer to next order. If NULL, end of list.
bool selectgoods
only send the goods to station if a train has been there
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
company bankrupts, skip money check, skip vehicle on tile check in some cases
Functions related to (drawing on) viewports.
Pseudo random number generator.
void TriggerWatchedCargoCallbacks(Station *st)
Run the watched cargo callback for all houses in the catchment area.
A connected component of a link graph.
static bool HasStationRail(TileIndex t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint...
int GetTrainStopLocation(StationID station_id, TileIndex tile, const Train *v, int *station_ahead, int *station_length)
Get the stop location of (the center) of the front vehicle of a train at a platform of a station...
bool freeform_edges
allow terraforming the tiles at the map edges
CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis axis)
Check whether we can expand the rail part of the given station.
Set when cargo was delivered for final delivery last month.
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
static bool IsValidTile(TileIndex tile)
Checks if a tile is valid.
SpriteID single_y
single piece of rail in Y direction, without ground
void EndSpriteCombine()
Terminates a block of sprites started by StartSpriteCombine.
void ScaleToMonthly(uint runtime)
Scale all shares from link graph's runtime to monthly values.
Triggered in the periodic tile loop.
static bool IsBridgeAbove(TileIndex t)
checks if a bridge is set above the ground of this tile
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
static bool IsCompatibleTrainStationTile(TileIndex test_tile, TileIndex station_tile)
Check if a tile is a valid continuation to a railstation tile.
TrackBits
Bitfield corresponding to Track.
Buses, trucks and trams belong to this class.
bool ShouldStopAtStation(const Vehicle *v, StationID station) const
Check whether the given vehicle should stop at the given station based on this order and the non-stop...
static bool IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
void UpdateAirportsNoise()
Recalculate the noise generated by the airports of each town.
Shared order list linking together the linked list of orders and the list of vehicles sharing this or...
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold...
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.
Maximal number of airports in total.
byte noise_level
noise that this airport generates
uint GetShare(StationID st) const
Get flow for a station.
static bool CanRemoveRoadWithStop(TileIndex tile, DoCommandFlag flags)
Check if a drive-through road stop tile can be cleared.
struct RailtypeInfo::@40 strings
Strings associated with the rail type.
void RestrictFlows(StationID via)
Restrict all flows at a station for specific cargo and destination.
Functions related to low-level strings.
byte amount_fract
Fractional part of the amount in the cargo list.
SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
uint x
X position of the tile in unit coordinates.
SpriteID GetCustomStationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint32 var10)
Resolve sprites for drawing a station tile.
uint Size() const
Get the current size of the component.
None of the directions are disallowed.
byte rating
Station rating for this cargo.
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
EdgeIterator End()
Get an iterator pointing beyond the end of the edges array.
Foundation
Enumeration for Foundations.
TileIndex xy
town center tile
static void SetStationTileRandomBits(TileIndex t, byte random_bits)
Set the random bits for a station tile.
static bool IsBuoy(TileIndex t)
Is tile t a buoy tile?
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
Triggered when the airport is built (for all tiles at the same time).
CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector< T *, 4 > &affected_stations, DoCommandFlag flags, Money removal_cost, bool keep_rail)
Remove a number of tiles from any rail station within the area.
static void MakeAirport(TileIndex t, Owner o, StationID sid, byte section, WaterClass wc)
Make the given tile an airport tile.
void UpdateVirtCoord()
Update the virtual coords needed to draw the station sign.
TileIndex tile
Tile index.
AirportClassID cls_id
the class to which this airport type belongs
static uint ApplyPixelFoundationToSlope(Foundation f, Slope *s)
Applies a foundation to a slope.
Track along the y-axis (north-west to south-east)
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
uint32 PrepareLayout(uint32 orig_offset, uint32 newgrf_ground_offset, uint32 newgrf_offset, uint constr_stage, bool separate_ground) const
Prepares a sprite layout before resolving action-1-2-3 chains.
RoadStop * truck_stops
All the truck stops.
This indicates whether a cargo has a rating at the station.
uint Length() const
Get the number of items in the list.
StationID GetVia(StationID source) const
Get the best next hop for a cargo packet from station source.
void Add(TileIndex to_add)
Add a single tile to a tile area; enlarge if needed.
static int CountMapSquareAround(TileIndex tile, CMSAMatcher cmp)
Counts the numbers of tiles matching a specific type in the area around.
static Owner GetRoadOwner(TileIndex t, RoadType rt)
Get the owner of a specific road type.
StringID owner_type[4]
Type of each owner.
void ClearDriveThrough()
Prepare for removal of this stop; update other neighbouring stops if needed.
The tile is leveled up to a flat slope.
LinkGraphID link_graph
Link graph this station belongs to.
Information about GRF, used in the game and (part of it) in savegames.
static bool HasStationReservation(TileIndex t)
Get the reservation state of the rail station.
static bool IsRailStationTile(TileIndex t)
Is this tile a station tile and a rail station?
Ground palette sprite of a tile, together with its sprite layout.
#define FIND_FIRST_BIT(x)
Returns the first non-zero bit in a 6-bit value (from right).
bool road_stop_on_competitor_road
allow building of drive-through road stops on roads owned by competitors
static void SetStationGfx(TileIndex t, StationGfx gfx)
Set the station graphics of this tile.
static void SetRoadOwner(TileIndex t, RoadType rt, Owner o)
Set the owner of a specific road type.
bool IsTileForestIndustry(TileIndex tile)
Check whether the tile is a forest.
void DirtyCompanyInfrastructureWindows(CompanyID company)
Redraw all windows with company infrastructure counts.
static LinkGraphSchedule instance
Static instance of LinkGraphSchedule.
CommandCost CmdRemoveRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove bus or truck stops.
WaterClass
classes of water (for WATER_TILE_CLEAR water tile type).
Images for overlaying track.
static bool StationHandleBigTick(BaseStation *st)
This function is called for each station once every 250 ticks.
static bool IsTruckStop(TileIndex t)
Is the station at t a truck stop?
const Direction * rotation
the rotation of each tiletable
static void TruncateCargo(const CargoSpec *cs, GoodsEntry *ge, uint amount=UINT_MAX)
Truncate the cargo by a specific amount.
uint DistanceMax(TileIndex t0, TileIndex t1)
Gets the biggest distance component (x or y) between the two given tiles.
StationID GetVia() const
Get a station a package can be routed to.
static DiagDirection GetRoadStopDir(TileIndex t)
Gets the direction the road stop entrance points towards.
bool HasRoadTypesAvail(const CompanyID company, const RoadTypes rts)
Finds out, whether given company has all given RoadTypes available.
Entry point for OpenTTD to YAPF's cache.
bool IsType(OrderType type) const
Check whether this order is of the given type.
TileArea truck_station
Tile area the truck 'station' part covers.
const StationList * GetStations()
Run a tile loop to find stations around a tile, on demand.
Functions related to NewGRF houses.
static Owner GetTileOwner(TileIndex tile)
Returns the owner of a tile.
struct RailtypeInfo::@37 base_sprites
Struct containing the main sprites.
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
DoCommandFlag
List of flags for a command.
bool Intersects(const OrthogonalTileArea &ta) const
Does this tile area intersect with another?
GRFFilePropsBase< NUM_CARGO+3 > grf_prop
Properties related the the grf file.
Station with truck stops.
ClientSettings _settings_client
The current settings for this game.
byte status
Status of this cargo, see GoodsEntryStatus.
Piece of rail in X direction.
bool Succeeded() const
Did this command succeed?
Container for cargo from the same location and time.
static bool HasStationTileRail(TileIndex t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint...
void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage, EdgeUpdateMode mode)
Increase capacity for a link stat given by station cargo and next hop.
const IndustrySpec * GetIndustrySpec(IndustryType thistype)
Accessor for array _industry_specs.
byte layout
Airport layout number.
void DeleteAnimatedTile(TileIndex tile)
Removes the given tile from the animated tile table.
int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exec)
Allocate a StationSpec to a Station.
#define TILE_AREA_LOOP(var, ta)
A loop which iterates over the tiles of a TileArea.
Definition of base types and functions in a cross-platform compatible way.
static const Date INVALID_DATE
Representation of an invalid date.
Shift the VehicleEnterTileStatus this many bits to the right to get the station ID when VETS_ENTERED_...
static TrackBits GetRailReservationTrackBits(TileIndex t)
Returns the reserved track bits of the tile.
uint Reroute(uint max_move, VehicleCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge)
Routes packets with station "avoid" as next hop to a different place.
uint32 road[ROADTYPE_END]
Count of company owned track bits for each road type.
A number of safeguards to prevent using unsafe methods.
static void Run(Vehicle *v, bool allow_merge=true, bool is_full_loading=false)
Refresh all links the given vehicle will visit.
Trigger station every 250 ticks.
void WatchedCargoCallback(TileIndex tile, CargoTypes trigger_cargoes)
Run watched cargo accepted callback for a house.
bool CircularTileSearch(TileIndex *tile, uint size, TestTileOnSearchProc proc, void *user_data)
Function performing a search around a center tile and going outward, thus in circle.
IndustryType GetIndustryType(TileIndex tile)
Retrieve the type for this industry.
static const uint64 AIRPORT_CLOSED_block
Dummy block for indicating a closed airport.
IndustryType type
type of industry.
static PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite.
static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags)
Remove a bus station/truck stop.
The vehicle cannot enter the tile.
static Axis GetRailStationAxis(TileIndex t)
Get the rail direction of a rail station.
uint y
Y position of the tile in unit coordinates.
struct RoadStop * next
Next stop of the given type at this station.
bool HasStationInUse(StationID station, bool include_company, CompanyID company)
Tests whether the company's vehicles have this station in orders.
Liquids (Oil, Water, Rubber)
uint8 GetAirportNoiseLevelForTown(const AirportSpec *as, TileIterator &it, TileIndex town_tile)
Get a possible noise reduction factor based on distance from town center.
RoadBits
Enumeration for the road parts on a tile.
uint8 callback_mask
Bitmask of cargo callbacks that have to be called.
Trackdir
Enumeration for tracks and directions.
void ProcessRegisters(uint8 resolved_var10, uint32 resolved_sprite, bool separate_ground) const
Evaluates the register modifiers and integrates them into the preprocessed sprite layout...
void ShowDepotWindow(TileIndex tile, VehicleType type)
Opens a depot window.
uint GetCatchmentRadius() const
Determines the catchment radius of the station.
static const uint MIN_TIMEOUT_DISTANCE
Minimum effective distance for timeout calculation.
TileArea location
Location of the industry.
byte num_table
number of elements in the table
NodeID node
ID of node in link graph referring to this goods entry.
void GetStationLayout(byte *layout, int numtracks, int plat_len, const StationSpec *statspec)
Create the station layout for the given number of tracks and platform length.
static bool CMSAMine(TileIndex tile)
Check whether the tile is a mine.
bool IsHangar(TileIndex t)
Check whether the given tile is a hangar.
CargoID cargo_type
type of cargo this vehicle is carrying
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_LVL_BASE.
Train * GetTrainForReservation(TileIndex tile, Track track)
Find the train which has reserved a specific path.
static bool IsBuoyTile(TileIndex t)
Is tile t a buoy tile?
Represents the covered area of e.g.
char * stredup(const char *s, const char *last)
Create a duplicate of the given string.
GUI Functions related to companies.
CargoID produced_cargo[INDUSTRY_NUM_OUTPUTS]
16 production cargo slots
static bool IsAirport(TileIndex t)
Is this station tile an airport?
CommandCost RemoveRailStation(T *st, DoCommandFlag flags, Money removal_cost)
Remove a rail station/waypoint.
StringID name
Tile Subname string, land information on this tile will give you "AirportName (TileSubname)".
Functions related to order backups.
bool IsFrontEngine() const
Check if the vehicle is a front engine.
bool road_stop_on_town_road
allow building of drive-through road stops on town owned roads
Trigger station on new cargo arrival.
void RecomputeIndustriesNear()
Recomputes Station::industries_near, list of industries possibly accepting cargo in station's catchme...
uint16 max_speed
Maximum speed for vehicles travelling on this rail type.
Order * GetFirstOrder() const
Get the first order of the order chain.
Map accessor functions for bridges.
void FindVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
Find a vehicle from a specific location.
Set when a sprite originates from an Action 1.
TileIndex tile
Current tile index.
Defines the data structure for constructing industry.
StationSpecList * speclist
List of station specs of this station.
CommandCost CheckOwnership(Owner owner, TileIndex tile)
Check whether the current owner owns something.
void Push(const Titem &item)
Pushes a new item onto the stack if there is still space in the underlying pool.
static uint GetMinimalAirportDistanceToTile(TileIterator &it, TileIndex town_tile)
Computes the minimal distance from town's xy to any airport's tile.
Base class for tile iterators.
static const int STATION_RATING_TICKS
cycle duration for updating station rating
The tile has no ownership.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
static const AirportSpec * Get(byte type)
Retrieve airport spec for the given airport.
PersistentStorage * psa
Persistent storage for NewGRF airports.
static const AirportTileSpec * Get(StationGfx gfx)
Retrieve airport tile spec for the given airport tile.
Station view; Window numbers:
CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build a dock/haven.
Date LastRestrictedUpdate() const
Get the date of the last update to the edge's restricted capacity.
StationRect - used to track station spread out rectangle - cheaper than scanning whole map...
Bit value for coloured news.
SpriteID single_x
single piece of rail in X direction, without ground
Called when building a station to customize the tile layout.
static const uint8 ANIM_STATUS_NO_ANIMATION
There is no animation.
void RestrictShare(StationID st)
Restrict a flow by moving it to the end of the map and decreasing the amount of unrestricted flow...
StationFacilityByte facilities
The facilities that this station has.
void AddFlow(StationID origin, StationID via, uint amount)
Add some flow from "origin", going via "via".
uint64 flags
stores which blocks on the airport are taken. was 16 bit earlier on, then 32
CommandCost CmdRenameStation(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Rename a station.
static const SharesMap empty_sharesmap
Static instance of FlowStat::SharesMap.
DiagDirection
Enumeration for diagonal directions.
Catchment for all stations with "modified catchment" disabled.
#define lengthof(x)
Return the length of an fixed size array.
byte last_speed
Maximum speed (up to 255) of the last vehicle that tried to load this cargo.
uint8 cached_anim_triggers
NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen...
static T min(const T a, const T b)
Returns the minimum of two values.
static Foundation FlatteningFoundation(Slope s)
Returns the foundation needed to flatten a slope.
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.
StringID railtype
Type of rail on the tile.
StringID airport_tile_name
Name of the airport tile.
RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance)
Returns the RoadBits on an arbitrary tile Special behaviour:
static bool IsCargoInClass(CargoID c, CargoClass cc)
Does cargo c have cargo class cc?
Piece of rail in Y direction.
uint16 refit_cap
Capacity left over from before last refit.
static DiagDirection GetInclinedSlopeDirection(Slope s)
Returns the direction of an inclined slope.
Functions related to autoslope.
NewGRF supplied spritelayout.
static bool IsPlainRailTile(TileIndex t)
Checks whether the tile is a rail tile or rail tile with signals.
bool Convert8bitBooleanCallback(const GRFFile *grffile, uint16 cbid, uint16 cb_res)
Converts a callback result into a boolean.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
static bool AutoslopeEnabled()
Tests if autoslope is enabled for _current_company.
uint DistanceFromEdge(TileIndex tile)
Param the minimum distance to an edge.
static TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
Builds a TrackStatus.
bool build_on_slopes
allow building on slopes
Date LastCompression() const
Get date of last compression.
bool Failed() const
Did this command fail?
StringID station_name
Type of station within the class.
byte last_age
Age in years (up to 255) of the last vehicle that tried to load this cargo.
const struct SpriteGroup * spritegroup[Tcnt]
pointer to the different sprites of the entity
TileIndex GetHangarTile(uint hangar_num) const
Get the first tile of the given hangar.
static StationGfx GetStationGfx(TileIndex t)
Get the station graphics of this tile.
DirectionByte rotation
How this airport is rotated.
All ships have this type.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
Date LastUpdate() const
Get the date of the last update to any part of the edge's capacity.
RoadStop * bus_stops
All the road stops.
uint16 MaxTownNoise() const
Calculate the max town noise.
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 Trackdir ReverseTrackdir(Trackdir trackdir)
Maps a trackdir to the reverse trackdir.
NewGRF handling of airport tiles.
void ShowStationViewWindow(StationID station)
Opens StationViewWindow for given station.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
byte state
State of the airport.
uint Truncate(uint max_move=UINT_MAX, StationCargoAmountMap *cargo_per_source=NULL)
Truncates where each destination loses roughly the same percentage of its cargo.
#define FOR_ALL_SHIPS(var)
Iterate over all ships.
void DrawRoadCatenary(const TileInfo *ti, RoadBits tram)
Draws the catenary for the given tile.
Station list; Window numbers:
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
static bool HasSignals(TileIndex t)
Checks if a rail tile has signals.
FlowStatMap flows
Planned flows through this station.
TileIndex TileAddWrap(TileIndex tile, int addx, int addy)
This function checks if we add addx/addy to tile, if we do wrap around the edges. ...
CommandCost FindJoiningWaypoint(StationID existing_waypoint, StationID waypoint_to_join, bool adjacent, TileArea ta, Waypoint **wp)
Find a nearby waypoint that joins this waypoint.
bool Enter(RoadVehicle *rv)
Enter the road stop.
static void Reset(TileIndex tile=INVALID_TILE, bool from_gui=true)
Reset the OrderBackups from GUI/game logic.
#define DEBUG(name, level,...)
Output a line of debugging information.
'Train' is either a loco or a wagon.
uint8 FindFirstBit(uint32 x)
Search the first set bit in a 32 bit variable.
SourceType
Types of cargo source and destination.
void ChangeShare(StationID st, int flow)
Change share for specified station.
Functions related to clear (MP_CLEAR) land.
EdgeUpdateMode
Special modes for updating links.
TileIndex tile
The base tile of the area.
byte flags
Bitmask of flags, bit 0: use different sprite set; bit 1: divide cargo about by station size...
OwnerByte owner
The owner of this station.
uint16 _tick_counter
Ever incrementing (and sometimes wrapping) tick counter for setting off various events.
StationGfx GetStationGfx() const
Get the StationGfx for the current tile.
SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint layout, uint edge_info)
Resolve the sprites for custom station foundations.
A pair-construct of a TileIndexDiff.
static TrackBits GetTrackBits(TileIndex tile)
Gets the track bits of the given tile.
bool(* CMSAMatcher)(TileIndex tile)
Function to check whether the given tile matches some criterion.
void UpdateAllStationVirtCoords()
Update the virtual coords needed to draw the station sign for all stations.
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
uint32 rail[RAILTYPE_END]
Count of company owned track bits for each rail type.
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
void ReleaseShare(StationID st)
Release ("unrestrict") a flow by moving it to the begin of the map and increasing the amount of unres...
static Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
static TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
Return the offset between to tiles from a TileIndexDiffC struct.
Handling of NewGRF canals.
byte StationGfx
Copy from station_map.h.
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
Get the cargo types being produced around the tile (in a rectangle).
execute the given command
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
static TrackBits TrackToTrackBits(Track track)
Maps a Track to the corresponding TrackBits value.
uint GetHangarNum(TileIndex tile) const
Get the hangar number of the hangar at a specific tile.
CommandCost CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags)
Checks whether the local authority allows construction of a new station (rail, road, airport, dock) on the given tile.
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
PalSpriteID ground
Palette and sprite for the ground.
GRFConfig * GetGRFConfig(uint32 grfid, uint32 mask)
Retrieve a NewGRF from the current config by its grfid.
static CommandCost BuildStationPart(Station **st, DoCommandFlag flags, bool reuse, TileArea area, StationNaming name_class)
Common part of building various station parts and possibly attaching them to an existing one...
static uint MapSize()
Get the size of the map.
StationType
Station types.
this bit is set when a recolouring process is in action
void ErrorUnknownCallbackResult(uint32 grfid, uint16 cbid, uint16 cb_res)
Record that a NewGRF returned an unknown/invalid callback result.
Class for storing amounts of cargo.
static bool IsNormalRoadTile(TileIndex t)
Return whether a tile is a normal road tile.
static bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
Find out if the slope of the tile is suitable to build a depot of given direction.
Header file for NewGRF stations.
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
CommandCost CmdOpenCloseAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Open/close an airport to incoming aircraft.
Trackdir GetVehicleTrackdir() const
Get the tracks of the train vehicle.
CommandCost GetStationAround(TileArea ta, StationID closest_station, CompanyID company, T **st)
Look for a station owned by the given company around the given tile area.
bool IsStationTileBlocked(TileIndex tile)
Check whether a rail station tile is NOT traversable.
CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, const StationSpec *statspec, Axis axis, byte plat_len, byte numtracks)
Check the slope of a tile of a new station.
GUISettings gui
settings related to the GUI
DestinationID GetDestination() const
Gets the destination of this order.
Only bits 0 and 3 are used to encode the trackdir for road stops.
static Track RemoveFirstTrack(TrackBits *tracks)
Removes first Track from TrackBits and returns it.
void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, byte widget_index)
Mark a particular widget in a particular window as dirty (in need of repainting)
bool station_noise_level
build new airports when the town noise level is still within accepted limits
uint max_waiting_cargo
Max cargo from this station waiting at any station.
bool NeedsPreprocessing() const
Tests whether this spritelayout needs preprocessing by PrepareLayout() and ProcessRegisters(), or whether it can be used directly.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
void StationMonthlyLoop()
Monthly loop for stations.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
size_t Utf8StringLength(const char *s)
Get the length of an UTF-8 encoded string in number of characters and thus not the number of bytes th...
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
CompanyByte _current_company
Company currently doing an action.
Set of callback functions for performing tile operations of a given tile type.
T * Last()
Get the last vehicle in the chain.
size_t MapSize() const
Count the number of ranges with equal keys in this MultiMap.
uint32 TileIndex
The index/ID of a Tile.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
Use different sprite set for ground sprites.
uint32 GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, int y, bool centred)
Evaluate a tile's position within a station, and return the result in a bit-stuffed format...
virtual bool TileBelongsToRailStation(TileIndex tile) const =0
Check whether a specific tile belongs to this station.
uint DistanceManhattan(TileIndex t0, TileIndex t1)
Gets the Manhattan distance between the two given tiles.
Cargo support for NewGRFs.
Town * AirportGetNearestTown(const AirportSpec *as, const TileIterator &it)
Finds the town nearest to given airport.
void RerouteCargo(Station *st, CargoID c, StationID avoid, StationID avoid2)
Reroute cargo of type c at station st or in any vehicles unloading there.
void Invalidate()
Reduce all flows to minimum capacity so that they don't get in the way of link usage statistics too m...
A town owns the tile, or a town is expanding.
static void ShowRejectOrAcceptNews(const Station *st, uint num_items, CargoID *cargo, StringID msg)
Items contains the two cargo names that are to be accepted or rejected.
void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1=NR_NONE, uint32 ref1=UINT32_MAX, NewsReferenceType reftype2=NR_NONE, uint32 ref2=UINT32_MAX, void *free_data=NULL)
Add a new newsitem to be shown.
Vehicle * Next() const
Get the next vehicle of this vehicle.
StringID name
name of this airport
Extended foundation block instead of simple.
bool modified_catchment
different-size catchment areas
Trigger station on new cargo arrival.
byte fallback_railtype
Original railtype number to use when drawing non-newgrf railtypes, or when drawing stations...
static Money RailBuildCost(RailType railtype)
Returns the cost of building the specified railtype.
OrderSettings order
settings related to orders
static const IndustryType NUM_INDUSTRYTYPES
total number of industry types, new and old; limited to 240 because we need some special ids like INV...
AnimationInfo animation
Information about the animation.
uint16 SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
const SharesMap * GetShares() const
Get the actual shares as a const pointer so that they can be iterated over.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Sprites to use and how to display them for station tiles.
void Free()
'Free' the order
Bit sets of the above specified bits.
byte town_council_tolerance
minimum required town ratings to be allowed to demolish stuff
void CDECL error(const char *s,...)
Error handling for fatal non-user errors.
OwnerByte owner
Which company owns the vehicle?
void GetTileArea(TileArea *ta, StationType type) const
Get the tile area for a given station type.
Availability of station in construction window.
byte size_x
size of airport in x direction
void FreeTrainTrackReservation(const Train *v)
Free the reserved path in front of a vehicle.
TileIndex xy
Base tile of the station.
TransportType
Available types of transport.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
void AppendShare(StationID st, uint flow, bool restricted=false)
Add some flow to the end of the shares map.
StringID airport_name
Name of the airport.
A type of cargo is (no longer) accepted.
static bool IsOilRig(TileIndex t)
Is tile t part of an oilrig?
Slope
Enumeration for the slope-type.
Town view; Window numbers:
void DrawRailCatenary(const TileInfo *ti)
Draws overhead wires and pylons for electric railways.
static void MakeRoadStop(TileIndex t, Owner o, StationID sid, RoadStopType rst, RoadTypes rt, DiagDirection d)
Make the given tile a roadstop tile.
bool Include(const T &item)
Tests whether a item is present in the vector, and appends it to the end if not.
void Erase(T *item)
Removes given item from this vector.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
bool show_track_reservation
highlight reserved tracks.
void SetRailStationPlatformReservation(TileIndex start, DiagDirection dir, bool b)
Set the reservation for a complete station platform.
Main group of ground images.
static NewGRFClass * Get(Tid cls_id)
Get a particular class.
uint8 exclusive_counter
months till the exclusivity expires
Station with train station.
TileIndex GetOrderStationLocation(StationID station)
Determine the location for the station where the vehicle goes to next.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() ...
Transport by road vehicle.
Flow statistics telling how much flow should be sent along a link.
static const int STATION_LINKGRAPH_TICKS
cycle duration for cleaning dead links
uint GetRailtypeSpriteOffset() const
Offset between the current railtype and normal rail.
The vehicle is in a road stop.
static bool IsRailWaypoint(TileIndex t)
Is this station tile a rail waypoint?
void OffsetGroundSprite(int x, int y)
Called when a foundation has been drawn for the current tile.
static uint CountBits(T value)
Counts the number of set bits in a variable.
Defines the data structure of each individual tile of an airport.
Functions related to commands.
static bool IsValidID(size_t index)
Tests whether given index is a valid index for station of this type.
CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a single tile from a rail station.
Coordinates of a point in 2D.
remove a single rail track
A Stop for a Road Vehicle.
void AddFacility(StationFacility new_facility_bit, TileIndex facil_xy)
Called when new facility is built on the station.
CargoID Index() const
Determines index of this cargospec.
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.
byte GetSnowLine()
Get the current snow line, either variable or static.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-NULL) Titem.
#define FOR_ALL_AIRCRAFT(var)
Macro for iterating over all aircraft.
static bool HasRailCatenaryDrawn(RailType rt)
Test if we should draw rail catenary.
Date build_date
Date of construction of tile contents.
static bool IsRoadStopTile(TileIndex t)
Is tile t a road stop station?
uint GetFlowFromVia(StationID from, StationID via) const
Get the flow from a specific station via a specific other station.
header file for electrified rail specific functions
Triggered every 250 ticks (for all tiles at the same time).
static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, SmallVector< Train *, 4 > &affected_vehicles, StationClassID spec_class, byte spec_index, byte plat_len, byte numtracks)
Checks if a rail station can be built at the given area.
static void DeleteStationIfEmpty(BaseStation *st)
This is called right after a station was deleted.
bool adjacent_stations
allow stations to be built directly adjacent to other stations
static void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram)
Make a normal road tile.
ConstructionSettings construction
construction of things in-game
static TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
static DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
Gets the disallowed directions.
const char * GetName() const
Get the name of this grf.
static RoadTypes GetRoadTypes(TileIndex t)
Get the present road types of a tile.
Functions related to waypoints.
static void free(const void *ptr)
Version of the standard free that accepts const pointers.
Airport airport
Tile area the airport covers.
static bool AutoslopeCheckForEntranceEdge(TileIndex tile, int z_new, Slope tileh_new, DiagDirection entrance)
Autoslope check for tiles with an entrance on an edge.
StringID name
Name of this rail type.
CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Place an Airport.
RailTrackOffset
Offsets for sprites within an overlay/underlay set.
static TileIndexDiffC GetDockOffset(TileIndex t)
Get the tileoffset from this tile a ship should target to get to this dock.
CommandCost RemoveBuoy(TileIndex tile, DoCommandFlag flags)
Remove a buoy.
const struct GRFFile * grffile
grf file that introduced this entity
static const uint MAX_LENGTH_STATION_NAME_CHARS
The maximum length of a station name in characters including '\0'.
StringID str
Description of the tile.
StringID station_name
Default name for nearby station.
static bool IsHangarTile(TileIndex t)
Is tile t an hangar tile?
const Tcont * Packets() const
Returns a pointer to the cargo packet list (so you can iterate over it etc).
remove a (rectangle of) tiles from a rail station
void DeleteStaleLinks(Station *from)
Check all next hops of cargo packets in this station for existence of a a valid link they may use to ...
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
static TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
Converts TrackBits to TrackdirBits while allowing both directions.
#define FOR_ALL_VEHICLES(var)
Iterate over all vehicles.
StringID station_class
Class of station.
byte callback_mask
Bitmask of station callbacks that have to be called.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
byte disallowed_lengths
Bitmask of platform lengths available for the station.
CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Build rail station.
Choose a sprite layout to draw, instead of the standard 0-7 range.
GameCreationSettings game_creation
settings used during the creation of a game (map)
static const uint NEW_AIRPORTTILE_OFFSET
offset of first newgrf airport tile
uint AvailableCount() const
Returns sum of cargo still available for loading at the sation.
void UpdateAirplanesOnNewStation(const Station *st)
Updates the status of the Aircraft heading or in the station.
Specification of a rectangle with absolute coordinates of all edges.
Full road along the y-axis (north-west + south-east)
byte CargoID
Cargo slots to indicate a cargo type within a game.
IndustryType indtype
Industry type to get the name from.
Flag for invalid railtype.
Enum of the default airport tiles.
Check slope of new station tiles.
static Industry * GetByTile(TileIndex tile)
Get the industry of the given tile.
NewGRFSpriteLayout * renderdata
Array of tile layouts.
Small news item. (Information window with text and viewport)
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
void AfterStationTileSetChange(bool adding, StationType type)
After adding/removing tiles to station, update some station-related stuff.
Owner
Enum for all companies/owners.
byte time_since_pickup
Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo.
static CargoTypes GetAcceptanceMask(const Station *st)
Get a mask of the cargo types that the station accepts.
StringID name
Name of this station.
Maximum catchment for airports with "modified catchment" enabled.
Defines the data structure for an airport.
Track along the x-axis (north-east to south-west)
Functions related to water (management)
static DiagDirection AxisToDiagDir(Axis a)
Converts an Axis to a DiagDirection.
static bool CMSAWater(TileIndex tile)
Check whether the tile is water.
An iterator for non-const edges.
static bool IsTileOnWater(TileIndex t)
Tests if the tile was built on water.
VehicleEnterTileStatus
The returned bits of VehicleEnterTile.
#define TILE_ADD(x, y)
Adds to tiles together.
StationGfx GetTranslatedAirportTileID(StationGfx gfx)
Do airporttile gfx ID translation for NewGRFs.
static void MakeDriveThroughRoadStop(TileIndex t, Owner station, Owner road, Owner tram, StationID sid, RoadStopType rst, RoadTypes rt, Axis a)
Make the given tile a drivethrough roadstop tile.
SpriteID sprite
The 'real' sprite.
CommandCost CmdRemoveFromRailWaypoint(TileIndex start, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
Remove a single tile from a waypoint.
byte disallowed_platforms
Bitmask of number of platforms available for the station.
StringID airport_class
Name of the airport class.
Functions related to news.
void FindStationsAroundTiles(const TileArea &location, StationList *stations)
Find all stations around a rectangular producer (industry, house, headquarter, ...)
uint GetFlow() const
Get the sum of all flows from this FlowStatMap.
StationClassID cls_id
The class to which this spec belongs.
Base classes/functions for stations.
void RemoveEdge(NodeID to)
Remove an outgoing edge from this node.
static bool IsDock(TileIndex t)
Is tile t a dock tile?
static Station * Get(size_t index)
Gets station with given index.
Date _date
Current date in days (day counter)
bool TryPathReserve(Train *v, bool mark_as_stuck=false, bool first_tile_okay=false)
Try to reserve a path to a safe position.
uint16 h
The height of the area.
Triggered when new cargo arrives at the station (for all tiles at the same time). ...
GRFFileProps grf_prop
properties related the the grf file
static Point RemapCoords2(int x, int y)
Map 3D world or tile coordinate to equivalent 2D coordinate as used in the viewports and smallmap...
StringID string_id
Default name (town area) of station.
The tile/execution is done by "water".
remove a (rectangle of) tiles from a rail waypoint
void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index)
Delete inspect window for a given feature and index.
VehicleTypeByte type
Type of vehicle.
void Append(CargoPacket *cp, StationID next)
Appends the given cargo packet to the range of packets with the same next station.
void Merge(LinkGraph *other)
Merge a link graph with another one.
Base class for all station-ish types.
static const int STATION_ACCEPTANCE_TICKS
cycle duration for updating station acceptance
Axis
Allow incrementing of DiagDirDiff variables.
static CommandCost FindJoiningStation(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Station **st)
Find a nearby station that joins this station.
struct GRFFileProps grf_prop
Properties related to the grf file.
custom station rating for this cargo type
LinkGraphSettings linkgraph
settings for link graph calculations
Used for industry tiles on land (also for oilrig if newgrf says so).
static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags, uint invalid_dirs, bool is_drive_through, bool is_truck_stop, Axis axis, StationID *station, RoadTypes rts)
Checks if a road stop can be built at the given tile.
Set when the station accepts the cargo currently for final deliveries.
static RoadBits AxisToRoadBits(Axis a)
Create the road-part which belongs to the given Axis.
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
Order current_order
The current order (+ status, like: loading)
static RoadStop * GetByTile(TileIndex tile, RoadStopType type)
Find a roadstop at given tile.
Date build_date
Date of construction.
Called to calculate part of a station rating.
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-...
static void RestoreTrainReservation(Train *v)
Restore platform reservation during station building/removing.
static int GetTileMaxPixelZ(TileIndex tile)
Get top height of the tile.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
CargoTypes always_accepted
Bitmask of always accepted cargo types (by houses, HQs, industry tiles when industry doesn't accept c...
PaletteID pal
The palette (use PAL_NONE) if not needed)
uint32 water
Count of company owned track bits for canals.
StringID name
Name of this class.
static Station * GetIfValid(size_t index)
Returns station if the index is a valid index for this station type.