OpenTTD Source
20240917-master-g9ab0a47812
|
Go to the documentation of this file.
15 #include "viewport_kdtree.h"
31 #include "strings_internal.h"
73 #include "table/strings.h"
102 for (
const auto &depot : as->
depots) {
118 template <
class T,
class F>
127 if (!T::IsValidID(t) || T::Get(t)->owner != company || !filter(T::Get(t)))
continue;
128 if (closest_station == INVALID_STATION) {
130 }
else if (closest_station != t) {
135 *st = (closest_station == INVALID_STATION) ?
nullptr : T::Get(closest_station);
156 for (
int dx = -3; dx <= 3; dx++) {
157 for (
int dy = -3; dy <= 3; dy++) {
181 for (
const auto &p : ind->
produced) {
213 #define M(x) ((x) - STR_SV_STNAME)
218 STATIONNAMING_AIRPORT,
219 STATIONNAMING_OILRIG,
221 STATIONNAMING_HELIPORT,
246 if (
GetIndustrySpec(indtype)->station_name == STR_UNDEFINED)
return false;
250 sni->
free_names &= ~(1 <<
M(STR_SV_STNAME_OILFIELD) | 1 <<
M(STR_SV_STNAME_MINES));
256 static const uint32_t _gen_station_name_bits[] = {
259 1U <<
M(STR_SV_STNAME_AIRPORT),
260 1U <<
M(STR_SV_STNAME_OILFIELD),
261 1U <<
M(STR_SV_STNAME_DOCKS),
262 1U <<
M(STR_SV_STNAME_HELIPORT),
271 if (s != st && s->
town == t) {
272 if (s->indtype != IT_INVALID) {
273 sni.indtypes[s->indtype] =
true;
275 if (name != STR_UNDEFINED) {
284 uint str =
M(s->string_id);
286 if (str ==
M(STR_SV_STNAME_FOREST)) {
287 str =
M(STR_SV_STNAME_WOODS);
289 ClrBit(sni.free_names, str);
302 return STR_SV_STNAME_FALLBACK;
309 uint32_t tmp = sni.free_names & _gen_station_name_bits[name_class];
313 if (
HasBit(sni.free_names,
M(STR_SV_STNAME_MINES))) {
315 return STR_SV_STNAME_MINES;
321 if (
HasBit(sni.free_names,
M(STR_SV_STNAME)))
return STR_SV_STNAME;
323 if (
HasBit(sni.free_names,
M(STR_SV_STNAME_CENTRAL)))
return STR_SV_STNAME_CENTRAL;
327 if (
HasBit(sni.free_names,
M(STR_SV_STNAME_LAKESIDE)) &&
330 return STR_SV_STNAME_LAKESIDE;
334 if (
HasBit(sni.free_names,
M(STR_SV_STNAME_WOODS)) && (
345 if (
HasBit(sni.free_names,
M(STR_SV_STNAME_VALLEY)))
return STR_SV_STNAME_VALLEY;
347 if (
HasBit(sni.free_names,
M(STR_SV_STNAME_HEIGHTS)))
return STR_SV_STNAME_HEIGHTS;
351 static const int8_t _direction_and_table[] = {
352 ~( (1 <<
M(STR_SV_STNAME_WEST)) | (1 <<
M(STR_SV_STNAME_EAST)) | (1 <<
M(STR_SV_STNAME_NORTH)) ),
353 ~( (1 <<
M(STR_SV_STNAME_SOUTH)) | (1 <<
M(STR_SV_STNAME_WEST)) | (1 <<
M(STR_SV_STNAME_NORTH)) ),
354 ~( (1 <<
M(STR_SV_STNAME_SOUTH)) | (1 <<
M(STR_SV_STNAME_EAST)) | (1 <<
M(STR_SV_STNAME_NORTH)) ),
355 ~( (1 <<
M(STR_SV_STNAME_SOUTH)) | (1 <<
M(STR_SV_STNAME_WEST)) | (1 <<
M(STR_SV_STNAME_EAST)) ),
358 sni.free_names &= _direction_and_table[
363 static const uint32_t fallback_names = (
364 (1U <<
M(STR_SV_STNAME_NORTH)) |
365 (1U <<
M(STR_SV_STNAME_SOUTH)) |
366 (1U <<
M(STR_SV_STNAME_EAST)) |
367 (1U <<
M(STR_SV_STNAME_WEST)) |
368 (1U <<
M(STR_SV_STNAME_TRANSFER)) |
369 (1U <<
M(STR_SV_STNAME_HALT)) |
370 (1U <<
M(STR_SV_STNAME_EXCHANGE)) |
371 (1U <<
M(STR_SV_STNAME_ANNEXE)) |
372 (1U <<
M(STR_SV_STNAME_SIDINGS)) |
373 (1U <<
M(STR_SV_STNAME_BRANCH)) |
374 (1U <<
M(STR_SV_STNAME_UPPER)) |
375 (1U <<
M(STR_SV_STNAME_LOWER))
378 sni.free_names &= fallback_names;
379 return (sni.free_names == 0) ? STR_SV_STNAME_FALLBACK : (STR_SV_STNAME +
FindFirstBit(sni.free_names));
392 Station *best_station =
nullptr;
395 uint cur_dist = DistanceManhattan(tile, st->xy);
397 if (cur_dist < threshold) {
398 threshold = cur_dist;
400 }
else if (cur_dist == threshold && best_station !=
nullptr) {
402 if (st->
index < best_station->
index) best_station = st;
418 case STATION_AIRPORT:
435 default: NOT_REACHED();
446 pt.y -= 32 * ZOOM_BASE;
453 this->
sign.
UpdatePosition(pt.x, pt.y, STR_VIEWPORT_STATION, STR_VIEWPORT_STATION_TINY);
455 _viewport_sign_kdtree.
Insert(ViewportSignKdtreeItem::MakeStation(this->
index));
466 if (this->
xy == new_xy)
return;
470 this->BaseStation::MoveSign(new_xy);
479 st->UpdateVirtCoord();
483 void BaseStation::FillCachedName()
const
485 auto tmp_params = MakeParameters(this->
index);
489 void ClearAllStationCachedNames()
492 st->cached_name.clear();
505 for (
auto it = std::begin(st->
goods); it != std::end(st->
goods); ++it) {
520 for (
auto it = std::begin(st->
goods); it != std::end(st->
goods); ++it) {
521 if (it->cargo.TotalCount() == 0)
SetBit(mask, std::distance(std::begin(st->
goods), it));
536 StringID msg = reject ? STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_LIST : STR_NEWS_STATION_NOW_ACCEPTS_CARGO_LIST;
550 std::set<IndustryID> industries;
557 AddProducedCargo(tile, produced);
563 for (IndustryID industry : industries) {
588 if (always_accepted !=
nullptr) *always_accepted = 0;
596 AddAcceptedCargo(tile, acceptance, always_accepted);
610 if (always_accepted !=
nullptr) *always_accepted = 0;
614 AddAcceptedCargo(tile, acceptance, always_accepted);
632 if (!st->
rect.IsEmpty()) {
638 uint amt = acceptance[i];
656 if (old_acc == new_acc)
return;
661 CargoTypes accepts = new_acc & ~old_acc;
662 CargoTypes rejects = ~new_acc & old_acc;
673 static void UpdateStationSignCoord(
BaseStation *st)
677 if (r->IsEmpty())
return;
681 st->MoveSign(new_xy);
706 if (*st !=
nullptr) {
711 CommandCost ret = (*st)->rect.BeforeAddRect(area.
tile, area.
w, area.
h, StationRect::ADD_TEST);
712 if (ret.
Failed())
return ret;
719 _station_kdtree.
Insert((*st)->index);
745 UpdateStationSignCoord(st);
760 MarkCatchmentTilesDirty();
763 MarkCatchmentTilesDirty();
770 case STATION_AIRPORT:
779 default: NOT_REACHED();
810 if (ret.
Failed())
return ret;
832 cost.
AddCost(_price[PR_BUILD_FOUNDATION]);
839 }
else if (allowed_z != flat_z) {
859 if (ret.
Failed())
return ret;
863 if (ret.
Failed())
return ret;
886 static CommandCost CheckFlatLandRailStation(
TileIndex tile_cur,
TileIndex north_tile,
int &allowed_z,
DoCommandFlag flags,
Axis axis, StationID *station,
RailType rt, std::vector<Train *> &affected_vehicles,
StationClassID spec_class, uint16_t spec_index, uint8_t plat_len, uint8_t numtracks)
889 uint invalid_dirs = 5 << axis;
895 if (ret.
Failed())
return ret;
901 if (ret.
Failed())
return ret;
912 if (*station == INVALID_STATION) {
914 }
else if (*station != st) {
939 affected_vehicles.push_back(v);
943 if (ret.
Failed())
return ret;
950 if (ret.
Failed())
return ret;
975 if (ret.
Failed())
return ret;
994 if (*station == INVALID_STATION) {
996 }
else if (*station != st) {
1019 if (build_over_road) {
1021 RoadType road_rt = GetRoadType(cur_tile, RTT_ROAD);
1028 if (ret.
Failed())
return ret;
1036 if (ret.
Failed())
return ret;
1045 RoadType tram_rt = GetRoadType(cur_tile, RTT_TRAM);
1054 if (ret.
Failed())
return ret;
1068 if (ret.
Failed())
return ret;
1102 static inline uint8_t *CreateSingle(uint8_t *layout,
int n)
1105 do *layout++ = 0;
while (--i);
1106 layout[((n - 1) >> 1) - n] = 2;
1110 static inline uint8_t *CreateMulti(uint8_t *layout,
int n, uint8_t b)
1113 do *layout++ = b;
while (--i);
1116 layout[n - 1 - n] = 0;
1130 if (statspec !=
nullptr) {
1132 if (found != std::end(statspec->
layouts)) {
1134 std::copy(std::begin(found->second), std::end(found->second), layout);
1139 if (plat_len == 1) {
1140 CreateSingle(layout, numtracks);
1142 if (numtracks & 1) layout = CreateSingle(layout, plat_len);
1143 int n = numtracks >> 1;
1146 layout = CreateMulti(layout, plat_len, 4);
1147 layout = CreateMulti(layout, plat_len, 6);
1164 template <
class T, StringID error_message,
class F>
1167 assert(*st ==
nullptr);
1168 bool check_surrounding =
true;
1171 if (existing_station != INVALID_STATION) {
1172 if (adjacent && existing_station != station_to_join) {
1179 T *candidate = T::GetIfValid(existing_station);
1180 if (candidate !=
nullptr && filter(candidate)) *st = candidate;
1181 check_surrounding = (*st ==
nullptr);
1186 if (adjacent) check_surrounding =
false;
1190 if (check_surrounding) {
1193 if (ret.
Failed())
return ret;
1197 if (*st ==
nullptr && station_to_join != INVALID_STATION) *st = T::GetIfValid(station_to_join);
1213 return FindJoiningBaseStation<Station, STR_ERROR_MUST_REMOVE_RAILWAY_STATION_FIRST>(existing_station, station_to_join, adjacent, ta, st, [](
const Station *) ->
bool {
return true; });
1229 return FindJoiningBaseStation<Waypoint, STR_ERROR_MUST_REMOVE_ROADWAYPOINT_FIRST>(existing_waypoint, waypoint_to_join, adjacent, ta, wp, [](
const Waypoint *wp) ->
bool {
return HasBit(wp->
waypoint_flags,
WPF_ROAD); });
1231 return FindJoiningBaseStation<Waypoint, STR_ERROR_MUST_REMOVE_RAILWAYPOINT_FIRST>(existing_waypoint, waypoint_to_join, adjacent, ta, wp, [](
const Waypoint *wp) ->
bool {
return !
HasBit(wp->
waypoint_flags,
WPF_ROAD); });
1276 bool length_price_ready =
true;
1277 uint8_t tracknum = 0;
1281 CommandCost ret =
CheckFlatLandRailStation(cur_tile, tile_area.tile, allowed_z, flags, axis, station, rt, affected_vehicles, spec_class, spec_index, plat_len, numtracks);
1282 if (ret.
Failed())
return ret;
1285 if (tracknum == numtracks) {
1286 length_price_ready =
true;
1295 cost.
AddCost(_price[PR_BUILD_STATION_RAIL]);
1298 if (length_price_ready) {
1299 cost.
AddCost(_price[PR_BUILD_STATION_RAIL_LENGTH]);
1300 length_price_ready =
false;
1352 if (ret.
Failed())
return ret;
1361 if (plat_len == 0 || numtracks == 0)
return CMD_ERROR;
1372 bool reuse = (station_to_join != NEW_STATION);
1373 if (!reuse) station_to_join = INVALID_STATION;
1374 bool distant_join = (station_to_join != INVALID_STATION);
1381 TileArea new_location(tile_org, w_org, h_org);
1384 StationID est = INVALID_STATION;
1385 std::vector<Train *> affected_vehicles;
1388 if (cost.
Failed())
return cost;
1392 if (ret.
Failed())
return ret;
1394 ret =
BuildStationPart(&st, flags, reuse, new_location, STATIONNAMING_RAIL);
1395 if (ret.
Failed())
return ret;
1399 if (ret.
Failed())
return ret;
1407 if (statspec !=
nullptr) {
1423 uint8_t numtracks_orig;
1429 st->
rect.BeforeAddRect(tile_org, w_org, h_org, StationRect::ADD_TRY);
1431 if (statspec !=
nullptr) {
1440 std::vector<uint8_t> layouts(numtracks * plat_len);
1443 numtracks_orig = numtracks;
1446 size_t layout_idx = 0;
1452 uint8_t layout = layouts[layout_idx++];
1457 affected_vehicles.push_back(v);
1479 if (statspec !=
nullptr) {
1486 if (callback <= UINT8_MAX) {
1494 TriggerStationAnimation(st, tile,
SAT_BUILT);
1507 }
while (--numtracks);
1509 for (uint i = 0; i < affected_vehicles.size(); ++i) {
1517 update_reservation_area =
TileArea(tile_org, 1, numtracks_orig);
1519 update_reservation_area =
TileArea(tile_org, numtracks_orig, 1);
1522 for (
TileIndex tile : update_reservation_area) {
1533 platform_begin = next_tile;
1536 platform_end = next_tile;
1540 bool reservation =
false;
1541 for (
TileIndex t = platform_begin; !reservation && t <= platform_end; t += tile_offset) {
1562 if (ta.
w != 0 && ta.
h != 0) {
1612 static void MakeRailStationAreaSmaller(
BaseStation *st)
1622 static void MakeShipStationAreaSmaller(
Station *st)
1625 UpdateStationDockingTiles(st);
1635 road_waypoint_area = MakeStationAreaSmaller(st, road_waypoint_area, TileBelongsToRoadWaypointStation);
1667 if (ret.
Failed())
continue;
1670 T *st = T::GetByTile(tile);
1671 if (st ==
nullptr)
continue;
1676 if (ret.
Failed())
continue;
1685 total_cost.
AddCost(-_price[PR_CLEAR_RAIL]);
1704 DoClearSquare(tile);
1710 st->rect.AfterRemoveTile(st, tile);
1716 include(affected_stations, st);
1722 if (quantity == 0)
return error.
Failed() ? error :
CommandCost(STR_ERROR_THERE_IS_NO_STATION);
1724 for (T *st : affected_stations) {
1729 MakeRailStationAreaSmaller(st);
1730 UpdateStationSignCoord(st);
1737 MarkCatchmentTilesDirty();
1743 total_cost.
AddCost(quantity * removal_cost);
1758 if (end == 0) end = start;
1762 std::vector<Station *> affected_stations;
1765 if (ret.
Failed())
return ret;
1768 for (
Station *st : affected_stations) {
1771 st->MarkTilesDirty(
false);
1772 MarkCatchmentTilesDirty();
1773 st->RecomputeCatchment();
1791 if (end == 0) end = start;
1795 std::vector<Waypoint *> affected_stations;
1815 if (ret.
Failed())
return ret;
1821 assert(ta.
w != 0 && ta.
h != 0);
1827 if (st->TileBelongsToRailStation(tile)) {
1828 std::vector<T*> affected_stations;
1830 if (ret.
Failed())
return ret;
1885 if (*primary_stop ==
nullptr) {
1887 return primary_stop;
1891 while (stop->
next !=
nullptr) stop = stop->
next;
1910 return FindJoiningBaseStation<Station, STR_ERROR_MUST_REMOVE_ROAD_STOP_FIRST>(existing_stop, station_to_join, adjacent, ta, st, [](
const Station *) ->
bool {
return true; });
1928 uint invalid_dirs = 0;
1929 if (is_drive_through) {
1933 SetBit(invalid_dirs, ddir);
1941 if (ret.
Failed())
return ret;
1946 if (!is_preexisting_roadstop) {
1975 bool reuse = (station_to_join != NEW_STATION);
1976 if (!reuse) station_to_join = INVALID_STATION;
1977 bool distant_join = (station_to_join != INVALID_STATION);
1986 if (roadstopspec !=
nullptr) {
1995 if (width == 0 || length == 0)
return CMD_ERROR;
1999 TileArea roadstop_area(tile, width, length);
2004 if (!is_drive_through && RoadTypeIsTram(rt))
return CMD_ERROR;
2009 if (ret.
Failed())
return ret;
2015 if (roadstopspec !=
nullptr) {
2016 unit_cost = roadstopspec->
GetBuildCost(is_truck_stop ? PR_BUILD_STATION_TRUCK : PR_BUILD_STATION_BUS);
2018 unit_cost = _price[is_truck_stop ? PR_BUILD_STATION_TRUCK : PR_BUILD_STATION_BUS];
2020 StationID est = INVALID_STATION;
2021 CommandCost cost =
CalculateRoadStopCost(roadstop_area, flags, is_drive_through, is_truck_stop ? STATION_TRUCK : STATION_BUS, axis, ddir, &est, rt, unit_cost);
2022 if (cost.
Failed())
return cost;
2026 if (ret.
Failed())
return ret;
2031 ret =
BuildStationPart(&st, flags, reuse, roadstop_area, STATIONNAMING_ROAD);
2032 if (ret.
Failed())
return ret;
2035 int specindex = AllocateSpecToRoadStop(roadstopspec, st, (flags &
DC_EXEC) != 0);
2038 if (roadstopspec !=
nullptr) {
2050 for (
TileIndex cur_tile : roadstop_area) {
2061 if (roadstopspec !=
nullptr) {
2070 *currstop = road_stop;
2072 if (is_truck_stop) {
2081 st->
rect.BeforeAddTile(cur_tile, StationRect::ADD_TRY);
2084 if (is_drive_through) {
2107 if (roadstopspec !=
nullptr) {
2108 st->SetRoadStopRandomBits(cur_tile,
GB(Random(), 0, 8));
2109 TriggerRoadStopAnimation(st, cur_tile,
SAT_BUILT);
2115 if (st !=
nullptr) {
2153 if (ret.
Failed())
return ret;
2168 assert(cur_stop !=
nullptr);
2176 if (ret.
Failed())
return ret;
2182 if (*primary_stop == cur_stop) {
2184 *primary_stop = cur_stop->
next;
2186 if (*primary_stop ==
nullptr) {
2193 while (pred->
next != cur_stop) pred = pred->
next;
2198 for (RoadTramType rtt : _roadtramtypes) {
2199 RoadType rt = GetRoadType(tile, rtt);
2216 DoClearSquare(tile);
2223 StationID station_id = st->
index;
2226 [station_id](
const Order *order) {
return order->IsType(OT_GOTO_STATION) && order->GetDestination() == station_id; },
2227 [station_id, tile](
Vehicle *v) {
2234 st->
rect.AfterRemoveTile(st, tile);
2238 st->RemoveRoadStopTileData(tile);
2239 if ((
int)specindex != replacement_spec_index) DeallocateSpecFromRoadStop(st, specindex);
2251 Price category = is_truck ? PR_CLEAR_STATION_TRUCK : PR_CLEAR_STATION_BUS;
2268 if (ret.
Failed())
return ret;
2274 if (ret.
Failed())
return ret;
2281 for (RoadTramType rtt : _roadtramtypes) {
2282 RoadType rt = GetRoadType(tile, rtt);
2295 DoClearSquare(tile);
2297 wp->
rect.AfterRemoveTile(wp, tile);
2299 wp->RemoveRoadStopTileData(tile);
2300 if ((
int)specindex != replacement_spec_index) DeallocateSpecFromRoadStop(wp, specindex);
2302 if (replacement_spec_index < 0) {
2305 UpdateStationSignCoord(wp);
2331 CommandCost last_error(STR_ERROR_THERE_IS_NO_STATION);
2332 bool had_success =
false;
2334 for (
TileIndex cur_tile : roadstop_area) {
2343 for (RoadTramType rtt : _roadtramtypes) {
2344 road_type[rtt] = GetRoadType(cur_tile, rtt);
2354 if (station_type == STATION_ROADWAYPOINT) {
2369 road_owner[RTT_ROAD], road_owner[RTT_TRAM]);
2378 return had_success ? cost : last_error;
2395 if (width == 0 || height == 0)
return CMD_ERROR;
2401 TileArea roadstop_area(tile, width, height);
2415 if (end == 0) end = start;
2418 TileArea roadstop_area(start, end);
2445 uint noise_reduction = distance / town_tolerance_distance;
2466 Town *nearest =
nullptr;
2469 auto height = as->
size_y;
2470 if (rotation ==
DIR_E || rotation ==
DIR_W) std::swap(width, height);
2472 uint perimeter_min_x =
TileX(tile);
2473 uint perimeter_min_y =
TileY(tile);
2474 uint perimeter_max_x = perimeter_min_x + width - 1;
2475 uint perimeter_max_y = perimeter_min_y + height - 1;
2477 mindist = UINT_MAX - 1;
2482 if (
TileX(cur_tile) == perimeter_min_x ||
TileX(cur_tile) == perimeter_max_x ||
TileY(cur_tile) == perimeter_min_y ||
TileY(cur_tile) == perimeter_max_y) {
2484 if (t ==
nullptr)
continue;
2487 if (dist == mindist && t->
index < nearest->
index) nearest = t;
2488 if (dist < mindist) {
2537 bool reuse = (station_to_join != NEW_STATION);
2538 if (!reuse) station_to_join = INVALID_STATION;
2539 bool distant_join = (station_to_join != INVALID_STATION);
2546 if (ret.
Failed())
return ret;
2565 if (cost.
Failed())
return cost;
2573 StringID authority_refuse_message = STR_NULL;
2574 Town *authority_refuse_town =
nullptr;
2579 authority_refuse_message = STR_ERROR_LOCAL_AUTHORITY_REFUSES_NOISE;
2580 authority_refuse_town = nearest;
2589 authority_refuse_message = STR_ERROR_LOCAL_AUTHORITY_REFUSES_AIRPORT;
2590 authority_refuse_town = t;
2594 if (authority_refuse_message != STR_NULL) {
2600 ret =
FindJoiningStation(INVALID_STATION, station_to_join, allow_adjacent, airport_area, &st);
2601 if (ret.
Failed())
return ret;
2607 if (ret.
Failed())
return ret;
2614 cost.
AddCost(_price[PR_BUILD_STATION_AIRPORT]);
2627 st->
rect.BeforeAddRect(tile, w, h, StationRect::ADD_TRY);
2640 AirportTileAnimationTrigger(st, iter,
AAT_BUILT);
2670 if (ret.
Failed())
return ret;
2678 if (!a->IsNormalAircraft())
continue;
2679 if (a->targetairport == st->
index && a->state !=
FLYING) {
2704 if (!st->TileBelongsToAirport(tile_cur))
continue;
2707 if (ret.
Failed())
return ret;
2709 cost.
AddCost(_price[PR_CLEAR_STATION_AIRPORT]);
2713 DoClearSquare(tile_cur);
2754 if (ret.
Failed())
return ret;
2772 const Vehicle *v = orderlist->GetFirstSharedVehicle();
2773 assert(v !=
nullptr);
2774 if ((v->
owner == company) != include_company)
continue;
2776 for (
const Order *order = orderlist->GetFirstOrder(); order !=
nullptr; order = order->
next) {
2777 if (order->GetDestination() == station && (order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT))) {
2791 static const uint8_t _dock_w_chk[4] = { 2, 1, 2, 1 };
2792 static const uint8_t _dock_h_chk[4] = { 1, 2, 1, 2 };
2804 bool reuse = (station_to_join != NEW_STATION);
2805 if (!reuse) station_to_join = INVALID_STATION;
2806 bool distant_join = (station_to_join != INVALID_STATION);
2818 if (ret.
Failed())
return ret;
2824 if (ret.
Failed())
return ret;
2840 if (ret.
Failed())
return ret;
2841 if (add_cost) cost.
AddCost(ret);
2849 _dock_w_chk[direction], _dock_h_chk[direction]);
2853 ret =
FindJoiningStation(INVALID_STATION, station_to_join, adjacent, dock_area, &st);
2854 if (ret.
Failed())
return ret;
2860 if (ret.
Failed())
return ret;
2868 st->
rect.BeforeAddRect(dock_area.
tile, dock_area.
w, dock_area.
h, StationRect::ADD_TRY);
2880 UpdateStationDockingTiles(st);
2896 if (st !=
nullptr) UpdateStationDockingTiles(st);
2899 if (neutral !=
nullptr) UpdateStationDockingTiles(neutral);
2918 if (IsPossibleDockingTile(docking_tile)) {
2957 if (ret.
Failed())
return ret;
2967 if (ret.
Failed())
return ret;
2970 DoClearSquare(tile1);
2972 MakeWaterKeepingClass(tile2, st->
owner);
2974 st->
rect.AfterRemoveTile(st, tile1);
2975 st->
rect.AfterRemoveTile(st, tile2);
2977 MakeShipStationAreaSmaller(st);
2994 if (s->current_order.GetDestination() != st->
index) {
3009 s->SetDestTile(s->GetOrderStationLocation(st->
index));
3027 const auto &layouts = _station_display_datas[st];
3028 if (gfx >= layouts.size()) gfx &= 1;
3029 return layouts.data() + gfx;
3045 case SPR_RAIL_TRACK_X:
3046 case SPR_MONO_TRACK_X:
3047 case SPR_MGLV_TRACK_X:
3048 snow_desert =
false;
3049 *overlay_offset =
RTO_X;
3052 case SPR_RAIL_TRACK_Y:
3053 case SPR_MONO_TRACK_Y:
3054 case SPR_MGLV_TRACK_Y:
3055 snow_desert =
false;
3056 *overlay_offset =
RTO_Y;
3059 case SPR_RAIL_TRACK_X_SNOW:
3060 case SPR_MONO_TRACK_X_SNOW:
3061 case SPR_MGLV_TRACK_X_SNOW:
3063 *overlay_offset =
RTO_X;
3066 case SPR_RAIL_TRACK_Y_SNOW:
3067 case SPR_MONO_TRACK_Y_SNOW:
3068 case SPR_MGLV_TRACK_Y_SNOW:
3070 *overlay_offset =
RTO_Y;
3077 if (ti !=
nullptr) {
3093 *ground = snow_desert ? SPR_FLAT_SNOW_DESERT_TILE : SPR_FLAT_GRASS_TILE;
3097 static void DrawTile_Station(
TileInfo *ti)
3102 int32_t total_offset;
3104 uint32_t relocation = 0;
3105 uint32_t ground_relocation = 0;
3108 uint tile_layout = 0;
3119 if (statspec !=
nullptr) {
3155 case APT_RADAR_GRASS_FENCE_SW:
3158 case APT_GRASS_FENCE_NE_FLAG:
3161 case APT_RADAR_FENCE_SW:
3164 case APT_RADAR_FENCE_NE:
3167 case APT_GRASS_FENCE_NE_FLAG_2:
3177 palette = COMPANY_SPRITE_COLOUR(owner);
3180 palette = PALETTE_TO_GREY;
3192 if (!HasFoundationNW(ti->
tile, slope, z))
SetBit(edge_info, 0);
3193 if (!HasFoundationNE(ti->
tile, slope, z))
SetBit(edge_info, 1);
3195 if (image == 0)
goto draw_default_foundation;
3200 static const uint8_t foundation_parts[] = {
3213 static const uint8_t composite_foundation_parts[] = {
3215 0x00, 0xD1, 0xE4, 0xE0,
3217 0xCA, 0xC9, 0xC4, 0xC0,
3219 0xD2, 0x91, 0xE4, 0xA0,
3224 uint8_t parts = composite_foundation_parts[ti->
tileh];
3235 goto draw_default_foundation;
3239 for (
int i = 0; i < 8; i++) {
3250 draw_default_foundation:
3255 bool draw_ground =
false;
3258 DrawWaterClassGround(ti);
3260 if (sprite != 0) total_offset = sprite - SPR_IMG_BUOY;
3263 DrawWaterClassGround(ti);
3269 DrawShoreTile(ti->
tileh);
3271 DrawClearLandTile(ti, 3);
3289 if (layout !=
nullptr) {
3298 t = &tmp_rail_layout;
3300 }
else if (statspec !=
nullptr) {
3351 if (stopspec !=
nullptr) {
3352 stop_draw_mode = stopspec->draw_mode;
3358 if (group !=
nullptr && group->type == SGT_TILELAYOUT) {
3382 uint sprite_offset = axis ==
AXIS_X ? 1 : 0;
3383 DrawRoadOverlays(ti, PAL_NONE, road_rti, tram_rti, sprite_offset, sprite_offset);
3411 int32_t total_offset = 0;
3426 DrawSprite(ground + overlay_offset, PAL_NONE, x, y);
3435 uint sprite_offset = 5 - image;
3438 if (roadtype_info->UsesOverlay()) {
3440 DrawSprite(ground + sprite_offset, PAL_NONE, x, y);
3443 if (overlay)
DrawSprite(overlay + sprite_offset, PAL_NONE, x, y);
3444 }
else if (RoadTypeIsTram(roadtype)) {
3445 DrawSprite(SPR_TRAMWAY_TRAM + sprite_offset, PAL_NONE, x, y);
3449 if (RoadTypeIsRoad(roadtype) && roadtype_info->UsesOverlay()) {
3457 DrawRailTileSeqInGUI(x, y, t, (st == STATION_WAYPOINT || st == STATION_ROADWAYPOINT) ? 0 : total_offset, 0, pal);
3460 static int GetSlopePixelZ_Station(
TileIndex tile, uint, uint,
bool)
3472 RoadType road_rt = GetRoadTypeRoad(tile);
3473 RoadType tram_rt = GetRoadTypeTram(tile);
3496 td->
owner_type[i] = STR_LAND_AREA_INFORMATION_ROAD_OWNER;
3497 td->
owner[i] = road_owner;
3501 td->
owner_type[i] = STR_LAND_AREA_INFORMATION_TRAM_OWNER;
3502 td->
owner[i] = tram_owner;
3512 if (spec !=
nullptr) {
3552 if (
IsAirport(tile)) FillTileDescAirport(tile, td);
3556 default: NOT_REACHED();
3557 case STATION_RAIL: str = STR_LAI_STATION_DESCRIPTION_RAILROAD_STATION;
break;
3558 case STATION_AIRPORT:
3559 str = (
IsHangar(tile) ? STR_LAI_STATION_DESCRIPTION_AIRCRAFT_HANGAR : STR_LAI_STATION_DESCRIPTION_AIRPORT);
3561 case STATION_TRUCK: str = STR_LAI_STATION_DESCRIPTION_TRUCK_LOADING_AREA;
break;
3562 case STATION_BUS: str = STR_LAI_STATION_DESCRIPTION_BUS_STATION;
break;
3563 case STATION_OILRIG: {
3571 case STATION_DOCK: str = STR_LAI_STATION_DESCRIPTION_SHIP_DOCK;
break;
3572 case STATION_BUOY: str = STR_LAI_STATION_DESCRIPTION_BUOY;
break;
3573 case STATION_WAYPOINT: str = STR_LAI_STATION_DESCRIPTION_WAYPOINT;
break;
3574 case STATION_ROADWAYPOINT: str = STR_LAI_STATION_DESCRIPTION_WAYPOINT;
break;
3604 RoadTramType rtt = (RoadTramType)sub_mode;
3626 static void TileLoop_Station(
TileIndex tile)
3631 case STATION_AIRPORT:
3639 case STATION_OILRIG:
3644 case STATION_ROADWAYPOINT: {
3663 HouseZonesBits new_zone = HZB_TOWN_EDGE;
3673 if (new_rs != cur_rs) {
3685 static void AnimateTile_Station(
TileIndex tile)
3688 AnimateStationTile(tile);
3693 AnimateAirportTile(tile);
3698 AnimateRoadStopTile(tile);
3704 static bool ClickTile_Station(
TileIndex tile)
3748 }
else if (x < stop) {
3750 uint16_t spd = std::max(0, (stop - x) * 20 - 15);
3751 if (spd < v->cur_speed) v->
cur_speed = spd;
3774 CargoTypes cargoes = 0;
3780 if (cargoes == 0)
return;
3818 static inline void byte_inc_sat(uint8_t *p)
3835 StationCargoAmountMap waiting_per_source;
3837 for (StationCargoAmountMap::iterator i(waiting_per_source.begin()); i != waiting_per_source.end(); ++i) {
3839 if (source_station ==
nullptr)
continue;
3846 static void UpdateStationRating(
Station *st)
3848 bool waiting_changed =
false;
3850 byte_inc_sat(&st->time_since_load);
3851 byte_inc_sat(&st->time_since_unload);
3869 waiting_changed =
true;
3888 uint waiting_avg = waiting / (num_dests + 1);
3891 ge->
rating = rating = MAX_STATION_RATING;
3902 | (ClampTo<uint8_t>(last_speed) << 24);
3904 uint32_t var10 = (st->last_vehicle_type ==
VEH_INVALID) ? 0x0 : (st->last_vehicle_type + 0x10);
3908 rating =
GB(callback, 0, 14);
3911 if (
HasBit(callback, 14)) rating -= 0x4000;
3917 if (b >= 0) rating += b >> 2;
3920 if (st->last_vehicle_type ==
VEH_SHIP) waittime >>= 2;
3921 if (waittime <= 21) rating += 25;
3922 if (waittime <= 12) rating += 25;
3923 if (waittime <= 6) rating += 45;
3924 if (waittime <= 3) rating += 35;
3937 if (age < 3) rating += 10;
3938 if (age < 2) rating += 10;
3939 if (age < 1) rating += 13;
3945 ge->
rating = rating = or_ +
Clamp(ClampTo<uint8_t>(rating) - or_, -2, 2);
3949 if (rating <= 64 && waiting_avg >= 100) {
3950 int dec = Random() & 0x1F;
3951 if (waiting_avg < 200) dec &= 7;
3952 waiting -= (dec + 1) * num_dests;
3953 waiting_changed =
true;
3957 if (rating <= 127 && waiting != 0) {
3958 uint32_t r = Random();
3959 if (rating <= (
int)
GB(r, 0, 7)) {
3961 waiting = std::max((
int)waiting - (
int)((
GB(r, 8, 2) - 1) * num_dests), 0);
3962 waiting_changed =
true;
3969 static const uint WAITING_CARGO_THRESHOLD = 1 << 12;
3970 static const uint WAITING_CARGO_CUT_FACTOR = 1 << 6;
3971 static const uint MAX_WAITING_CARGO = 1 << 15;
3973 if (waiting > WAITING_CARGO_THRESHOLD) {
3974 uint difference = waiting - WAITING_CARGO_THRESHOLD;
3975 waiting -= (difference / WAITING_CARGO_CUT_FACTOR);
3977 waiting = std::min(waiting, MAX_WAITING_CARGO);
3978 waiting_changed =
true;
3983 if (waiting_changed && waiting < ge->cargo.AvailableCount()) {
3997 StationID index = st->
index;
3998 if (waiting_changed) {
4021 for (
Vehicle *v : st->loading_vehicles) {
4022 for (
Vehicle *u = v; u !=
nullptr; u = u->
Next()) {
4023 if (u->cargo_type != c)
continue;
4024 u->cargo.Reroute(UINT_MAX, &u->cargo, avoid, avoid2, &ge);
4043 if (lg ==
nullptr)
continue;
4044 std::vector<NodeID> to_remove{};
4045 for (
Edge &edge : (*lg)[ge.
node].edges) {
4047 assert(to->
goods[c].
node == edge.dest_node);
4051 bool updated =
false;
4053 if (auto_distributed) {
4056 std::vector<Vehicle *> vehicles;
4058 bool found_from =
false;
4059 bool found_to =
false;
4060 for (
Order *order = l->GetFirstOrder(); order !=
nullptr; order = order->
next) {
4061 if (!order->IsType(OT_GOTO_STATION) && !order->IsType(OT_IMPLICIT))
continue;
4062 if (order->GetDestination() == from->
index) {
4064 if (found_to)
break;
4065 }
else if (order->GetDestination() == to->
index) {
4067 if (found_from)
break;
4070 if (!found_to || !found_from)
continue;
4071 vehicles.push_back(l->GetFirstSharedVehicle());
4074 auto iter = vehicles.begin();
4075 while (iter != vehicles.end()) {
4088 *iter = next_shared;
4091 iter = vehicles.erase(iter);
4094 if (iter == vehicles.end()) iter = vehicles.begin();
4100 to_remove.emplace_back(to->
goods[c].
node);
4113 for (NodeID r : to_remove) (*lg)[ge.
node].RemoveEdge(r);
4145 Debug(misc, 0,
"Can't allocate link graph");
4154 }
else if (ge2.
link_graph == INVALID_LINK_GRAPH) {
4172 if (lg !=
nullptr) {
4173 (*lg)[ge1.
node].UpdateEdge(ge2.
node, capacity, usage, time, mode);
4185 for (
const Vehicle *v = front; v !=
nullptr; v = v->
Next()) {
4200 static void StationHandleSmallTick(
BaseStation *st)
4211 void OnTick_Station()
4213 if (_game_mode == GM_EDITOR)
return;
4216 StationHandleSmallTick(st);
4249 void ModifyStationRatingAround(
TileIndex tile,
Owner owner,
int amount, uint radius)
4253 for (GoodsEntry &ge : st->goods) {
4254 if (ge.status != 0) {
4255 ge.rating = ClampTo<uint8_t>(ge.rating + amount);
4274 if (amount == 0)
return 0;
4286 Debug(misc, 0,
"Can't allocate link graph");
4291 if (lg !=
nullptr) (*lg)[ge.
node].UpdateSupply(amount);
4310 static bool IsUniqueStationName(
const std::string &name)
4313 if (!st->
name.empty() && st->
name == name)
return false;
4332 if (ret.
Failed())
return ret;
4334 bool reset = text.empty();
4338 if (!IsUniqueStationName(text))
return_cmd_error(STR_ERROR_NAME_MUST_BE_UNIQUE);
4359 if (st->TileIsInCatchment(tile)) stations->insert(st);
4372 assert(this->
w == 1 && this->
h == 1);
4373 AddNearbyStationsByCatchment(this->tile, &this->stations, Town::GetByTile(this->tile)->stations_near);
4376 this->stations.insert(st);
4386 static bool CanMoveGoodsToStation(
const Station *st,
CargoID type)
4410 if (all_stations->empty())
return 0;
4411 if (amount == 0)
return 0;
4413 Station *first_station =
nullptr;
4414 typedef std::pair<Station *, uint> StationInfo;
4415 std::vector<StationInfo> used_stations;
4417 for (
Station *st : *all_stations) {
4419 if (!CanMoveGoodsToStation(st, type))
continue;
4423 if (first_station ==
nullptr) {
4427 if (used_stations.empty()) {
4428 used_stations.reserve(2);
4429 used_stations.emplace_back(first_station, 0);
4431 used_stations.emplace_back(st, 0);
4435 if (first_station ==
nullptr)
return 0;
4437 if (used_stations.empty()) {
4440 return UpdateStationWaiting(first_station, type, amount, source_type, source_id);
4445 uint best_rating = 0;
4448 for (
auto &p : used_stations) {
4449 auto owner = p.first->owner;
4450 auto rating = p.first->goods[type].rating;
4451 if (rating > company_best[owner]) {
4452 best_sum += rating - company_best[owner];
4453 company_best[owner] = rating;
4454 if (rating > best_rating) best_rating = rating;
4456 company_sum[owner] += rating;
4461 amount *= best_rating + 1;
4464 for (
auto &p : used_stations) {
4465 uint owner = p.first->owner;
4468 p.second = amount * company_best[owner] * p.first->goods[type].rating / best_sum / company_sum[owner];
4473 if (amount > moving) {
4474 std::stable_sort(used_stations.begin(), used_stations.end(), [type](
const StationInfo &a,
const StationInfo &b) {
4475 return b.first->goods[type].rating < a.first->goods[type].rating;
4478 assert(amount - moving <= used_stations.size());
4479 for (uint i = 0; i < amount - moving; i++) {
4480 used_stations[i].second++;
4485 for (
auto &p : used_stations) {
4486 moved += UpdateStationWaiting(p.first, type, p.second, source_type, source_id);
4492 void UpdateStationDockingTiles(
Station *st)
4506 int x2 = std::min<int>(x + area->
w + 1,
Map::SizeX());
4507 int x1 = std::max<int>(x - 1, 0);
4509 int y2 = std::min<int>(y + area->
h + 1,
Map::SizeY());
4510 int y1 = std::max<int>(y - 1, 0);
4521 Debug(misc, 0,
"Can't allocate station for oilrig at 0x{:X}, reverting to oilrig only", tile);
4544 UpdateStationDockingTiles(st);
4546 st->
rect.BeforeAddTile(tile, StationRect::ADD_FORCE);
4556 for (
Station *near : nearby) {
4557 near->RecomputeCatchment(
true);
4584 for (RoadTramType rtt : _roadtramtypes) {
4587 RoadType rt = GetRoadType(tile, rtt);
4611 case STATION_WAYPOINT:
4620 case STATION_ROADWAYPOINT:
4685 if (ret.
Failed())
return ret;
4693 if (ret.
Failed())
return ret;
4696 if (ret.
Failed())
return ret;
4715 case STATION_WAYPOINT:
return_cmd_error(STR_ERROR_BUILDING_MUST_BE_DEMOLISHED);
4716 case STATION_AIRPORT:
return_cmd_error(STR_ERROR_MUST_DEMOLISH_AIRPORT_FIRST);
4717 case STATION_TRUCK:
return_cmd_error(
HasTileRoadType(tile, RTT_TRAM) ? STR_ERROR_MUST_DEMOLISH_CARGO_TRAM_STATION_FIRST : STR_ERROR_MUST_DEMOLISH_TRUCK_STATION_FIRST);
4718 case STATION_BUS:
return_cmd_error(
HasTileRoadType(tile, RTT_TRAM) ? STR_ERROR_MUST_DEMOLISH_PASSENGER_TRAM_STATION_FIRST : STR_ERROR_MUST_DEMOLISH_BUS_STATION_FIRST);
4719 case STATION_ROADWAYPOINT:
return_cmd_error(STR_ERROR_BUILDING_MUST_BE_DEMOLISHED);
4722 case STATION_OILRIG:
4723 SetDParam(1, STR_INDUSTRY_NAME_OIL_RIG);
4732 case STATION_TRUCK: [[fallthrough]];
4736 if (remove_road.
Failed())
return remove_road;
4739 case STATION_ROADWAYPOINT: {
4741 if (remove_road.
Failed())
return remove_road;
4744 case STATION_BUOY:
return RemoveBuoy(tile, flags);
4745 case STATION_DOCK:
return RemoveDock(tile, flags);
4760 case STATION_WAYPOINT:
4761 case STATION_RAIL: {
4768 case STATION_AIRPORT:
4796 for (
const auto &it : this->
shares) {
4797 if (it.second == st) {
4798 return it.first - prev;
4815 assert(!this->
shares.empty());
4817 assert(it != this->
shares.end() && it->first <= this->unrestricted);
4818 if (it->second != excluded && it->second != excluded2)
return it->second;
4823 uint end = it->first;
4824 uint begin = (it == this->
shares.begin() ? 0 : (--it)->first);
4825 uint interval = end - begin;
4826 if (interval >= this->
unrestricted)
return INVALID_STATION;
4829 SharesMap::const_iterator it2 = (rand < begin) ? this->
shares.upper_bound(rand) :
4830 this->
shares.upper_bound(rand + interval);
4831 assert(it2 != this->
shares.end() && it2->first <= this->unrestricted);
4832 if (it2->second != excluded && it2->second != excluded2)
return it2->second;
4837 uint end2 = it2->first;
4838 uint begin2 = (it2 == this->
shares.begin() ? 0 : (--it2)->first);
4839 uint interval2 = end2 - begin2;
4840 if (interval2 >= new_max)
return INVALID_STATION;
4841 new_max -= interval2;
4842 if (begin > begin2) {
4843 Swap(begin, begin2);
4845 Swap(interval, interval2);
4850 it3 = this->
shares.upper_bound(rand);
4851 }
else if (rand < begin2 - interval) {
4852 it3 = this->
shares.upper_bound(rand + interval);
4854 it3 = this->
shares.upper_bound(rand + interval + interval2);
4856 assert(it3 != this->
shares.end() && it3->first <= this->unrestricted);
4867 assert(!this->
shares.empty());
4868 SharesMap new_shares;
4870 for (
const auto &it : this->
shares) {
4871 new_shares[++i] = it.second;
4872 if (it.first == this->unrestricted) this->
unrestricted = i;
4874 this->shares.swap(new_shares);
4875 assert(!this->shares.empty() && this->unrestricted <= (--this->shares.end())->first);
4888 assert(!this->
shares.empty());
4890 uint removed_shares = 0;
4891 uint added_shares = 0;
4892 uint last_share = 0;
4893 SharesMap new_shares;
4894 for (
const auto &it : this->
shares) {
4895 if (it.second == st) {
4897 uint share = it.first - last_share;
4898 if (flow == INT_MIN || (uint)(-flow) >= share) {
4899 removed_shares += share;
4900 if (it.first <= this->unrestricted) this->
unrestricted -= share;
4901 if (flow != INT_MIN) flow += share;
4902 last_share = it.first;
4905 removed_shares += (uint)(-flow);
4907 added_shares += (uint)(flow);
4909 if (it.first <= this->unrestricted) this->
unrestricted += flow;
4915 new_shares[it.first + added_shares - removed_shares] = it.second;
4916 last_share = it.first;
4919 new_shares[last_share + (uint)flow] = st;
4926 this->shares.swap(new_shares);
4936 assert(!this->
shares.empty());
4938 uint last_share = 0;
4939 SharesMap new_shares;
4940 for (
auto &it : this->
shares) {
4942 if (it.first > this->unrestricted)
return;
4943 if (it.second == st) {
4944 flow = it.first - last_share;
4947 new_shares[it.first] = it.second;
4950 new_shares[it.first - flow] = it.second;
4952 last_share = it.first;
4954 if (flow == 0)
return;
4955 new_shares[last_share + flow] = st;
4956 this->shares.swap(new_shares);
4957 assert(!this->shares.empty());
4967 assert(!this->
shares.empty());
4969 uint next_share = 0;
4971 for (SharesMap::reverse_iterator it(this->
shares.rbegin()); it != this->shares.rend(); ++it) {
4972 if (it->first < this->unrestricted)
return;
4974 flow = next_share - it->first;
4978 if (it->first == this->unrestricted)
return;
4979 if (it->second == st) found =
true;
4981 next_share = it->first;
4983 if (flow == 0)
return;
4984 SharesMap new_shares;
4985 new_shares[flow] = st;
4986 for (SharesMap::iterator it(this->
shares.begin()); it != this->shares.end(); ++it) {
4987 if (it->second != st) {
4988 new_shares[flow + it->first] = it->second;
4993 this->
shares.swap(new_shares);
4994 assert(!this->
shares.empty());
5004 assert(runtime > 0);
5005 SharesMap new_shares;
5007 for (
auto i : this->
shares) {
5008 share = std::max(share + 1, i.first * 30 / runtime);
5009 new_shares[share] = i.second;
5012 this->shares.swap(new_shares);
5023 FlowStatMap::iterator origin_it = this->find(origin);
5024 if (origin_it == this->end()) {
5025 this->emplace(origin,
FlowStat(via, flow));
5027 origin_it->second.ChangeShare(via, flow);
5028 assert(!origin_it->second.GetShares()->empty());
5042 FlowStatMap::iterator prev_it = this->find(origin);
5043 if (prev_it == this->end()) {
5046 this->emplace(origin, fs);
5048 prev_it->second.ChangeShare(via, flow);
5049 prev_it->second.ChangeShare(INVALID_STATION, flow);
5050 assert(!prev_it->second.GetShares()->empty());
5060 for (
auto &i : *
this) {
5062 uint local = fs.
GetShare(INVALID_STATION);
5063 if (local > INT_MAX) {
5086 for (FlowStatMap::iterator f_it = this->begin(); f_it != this->end();) {
5090 ret.
Push(f_it->first);
5091 this->erase(f_it++);
5105 for (
auto &it : *
this) {
5106 it.second.RestrictShare(via);
5116 for (
auto &it : *
this) {
5117 it.second.ReleaseShare(via);
5128 for (
const auto &it : *
this) {
5129 ret += (--(it.second.GetShares()->end()))->first;
5142 for (
const auto &it : *
this) {
5143 ret += it.second.GetShare(via);
5155 FlowStatMap::const_iterator i = this->find(from);
5156 if (i == this->end())
return 0;
5157 return (--(i->second.GetShares()->end()))->first;
5168 FlowStatMap::const_iterator i = this->find(from);
5169 if (i == this->end())
return 0;
5170 return i->second.GetShare(via);
5175 GetSlopePixelZ_Station,
5178 GetTileDesc_Station,
5179 GetTileTrackStatus_Station,
5181 AnimateTile_Station,
5183 ChangeTileOwner_Station,
5185 VehicleEnter_Station,
5186 GetFoundation_Station,
5187 TerraformTile_Station,
@ VETS_STATION_ID_OFFSET
Shift the VehicleEnterTileStatus this many bits to the right to get the station ID when VETS_ENTERED_...
@ INVALID_RAILTYPE
Flag for invalid railtype.
int AllocateSpecToStation(const StationSpec *statspec, BaseStation *st, bool exec)
Allocate a StationSpec to a Station.
@ ROADSTOPTYPE_FREIGHT
This RoadStop is for freight (truck) stops.
Buses, trucks and trams belong to this class.
@ AAT_STATION_250_TICKS
Triggered every 250 ticks (for all tiles at the same time).
static debug_inline uint TileY(TileIndex tile)
Get the Y component of a tile.
@ ROADSTOP_BUS
A standard stop for buses.
StringID airport_class
Name of the airport class.
debug_inline bool IsFrontEngine() const
Check if the vehicle is a front engine.
@ MP_HOUSE
A house by a town.
@ RSF_DRAW_MODE_REGISTER
Read draw mode from register 0x100.
void DeleteNewGRFInspectWindow(GrfSpecFeature feature, uint index)
Delete inspect window for a given feature and index.
bool IsTileFlat(TileIndex tile, int *h)
Check if a given tile is flat.
StationFacility facilities
The facilities that this station has.
const char * grf
newGRF used for the tile contents
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...
static CommandCost RemoveRailWaypoint(TileIndex tile, DoCommandFlag flags)
Remove a rail waypoint.
@ VETSB_CANNOT_ENTER
The vehicle cannot enter the tile.
uint StoredCount() const
Returns sum of cargo on board the vehicle (ie not only reserved).
CommandCost CmdBuildRoadStop(DoCommandFlag flags, TileIndex tile, uint8_t width, uint8_t length, RoadStopType stop_type, bool is_drive_through, DiagDirection ddir, RoadType rt, RoadStopClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent)
Build a bus or truck stop.
@ TROPICZONE_DESERT
Tile is desert.
static const uint INVALID_AIRPORTTILE
id for an invalid airport tile
void ScaleToMonthly(uint runtime)
Scale all shares from link graph's runtime to monthly values.
TileArea docking_station
Tile area the docking tiles cover.
static const uint64_t AIRPORT_CLOSED_block
Dummy block for indicating a closed airport.
@ ROTSG_GROUND
Required: Main group of ground images.
CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta)
Check whether we can expand the rail part of the given station.
@ DIAGDIR_NE
Northeast, upper right on your monitor.
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-...
Owner owner
owner of the industry. Which SHOULD always be (imho) OWNER_NONE
void Invalidate()
Reduce all flows to minimum capacity so that they don't get in the way of link usage statistics too m...
PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite.
Minimal stack that uses a pool to avoid pointers.
uint64_t flags
stores which blocks on the airport are taken. was 16 bit earlier on, then 32
GoodsEntry goods[NUM_CARGO]
Goods at this station.
static const IndustryType NUM_INDUSTRYTYPES
total number of industry types, new and old; limited to 240 because we need some special ids like INV...
StationRect - used to track station spread out rectangle - cheaper than scanning whole map.
uint8_t rating
Station rating for this cargo.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
static CargoArray GetAcceptanceAroundStation(const Station *st, CargoTypes *always_accepted)
Get the acceptance of cargoes around the station in.
uint unrestricted
Limit for unrestricted shares.
bool IsType(OrderType type) const
Check whether this order is of the given type.
static Titem * Get(size_t index)
Returns Titem with given index.
DisallowedRoadDirections GetDisallowedRoadDirections(Tile t)
Gets the disallowed directions.
void MakeRoadStop(Tile t, Owner o, StationID sid, RoadStopType rst, RoadType road_rt, RoadType tram_rt, DiagDirection d)
Make the given tile a roadstop tile.
static TickCounter counter
Monotonic counter, in ticks, since start of game.
static bool IsRoadWaypointOnSnowOrDesert(Tile t)
Check if a road waypoint tile has snow/desert.
TileIndex GetRotatedTileFromOffset(TileIndexDiffC tidc) const
Add the tileoffset to the base tile of this airport but rotate it first.
@ CC_LIQUID
Liquids (Oil, Water, Rubber)
uint GetFlowVia(StationID via) const
Get the sum of flows via a specific station from this FlowStatMap.
uint GetHangarNum(TileIndex tile) const
Get the hangar number of the hangar at a specific tile.
@ CC_PASSENGERS
Passengers.
StationSettings station
settings related to station management
void SetWindowDirty(WindowClass cls, WindowNumber number)
Mark window as dirty (in need of repainting)
void SetRailStationTileFlags(TileIndex tile, const StationSpec *statspec)
Set rail station tile flags for the given tile.
A connected component of a link graph.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
@ FACIL_TRAIN
Station with train station.
std::vector< NewGRFSpriteLayout > renderdata
Number of tile layouts.
std::tuple< Slope, int > GetFoundationPixelSlope(TileIndex tile)
Get slope of a tile on top of a (possible) foundation If a tile does not have a foundation,...
CargoArray GetAcceptanceAroundTiles(TileIndex center_tile, int w, int h, int rad, CargoTypes *always_accepted)
Get the acceptance of cargoes around the tile in 1/8.
void AfterStationTileSetChange(bool adding, StationType type)
After adding/removing tiles to station, update some station-related stuff.
uint GetFlow() const
Get the sum of all flows from this FlowStatMap.
RoadBits
Enumeration for the road parts on a tile.
bool ValParamRailType(const RailType rail)
Validate functions for rail building.
void Push(const Titem &item)
Pushes a new item onto the stack if there is still space in the underlying pool.
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track)
Use this function to notify YAPF that track layout (or signal configuration) has change.
@ ROADSTOP_END
End of valid types.
const DrawTileSprites * GetStationTileLayout(StationType st, uint8_t gfx)
Get station tile layout for a station type and its station gfx.
constexpr void Swap(T &a, T &b)
Type safe swap operation.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
void RerouteCargo(Station *st, CargoID c, StationID avoid, StationID avoid2)
Reroute cargo of type c at station st or in any vehicles unloading there.
static const CommandCost CMD_ERROR
Define a default return value for a failed command.
void UpdateAirplanesOnNewStation(const Station *st)
Updates the status of the Aircraft heading or in the station.
@ TRACK_BIT_X
X-axis track.
void SetCustomRoadStopSpecIndex(Tile t, uint8_t specindex)
Set the custom road stop spec for this tile.
static CommandCost CalculateRailStationCost(TileArea tile_area, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, std::vector< Train * > &affected_vehicles, StationClassID spec_class, uint16_t spec_index, uint8_t plat_len, uint8_t numtracks)
Calculates cost of new rail stations within the area.
Foundation FlatteningFoundation(Slope s)
Returns the foundation needed to flatten a slope.
@ ROAD_Y
Full road along the y-axis (north-west + south-east)
bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
Find out if the slope of the tile is suitable to build a depot of given direction.
const RailTypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
uint GetRailtypeSpriteOffset() const
Offset between the current railtype and normal rail.
@ SSF_EXTENDED_FOUNDATIONS
Extended foundation block instead of simple.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold.
@ SAT_250_TICKS
Trigger station every 250 ticks.
@ TO_BUILDINGS
company buildings - depots, stations, HQ, ...
Tile information, used while rendering the tile.
static bool StationHandleBigTick(BaseStation *st)
This function is called for each station once every 250 ticks.
bool IsRailStation(Tile t)
Is this station tile a rail station?
void ReleaseShare(StationID st)
Release ("unrestrict") a flow by moving it to the begin of the map and increasing the amount of unres...
WaterClass GetWaterClass(Tile t)
Get the water class at a tile.
@ SPRITE_WIDTH
number of bits for the sprite number
StringID railtype
Type of rail on the tile.
CompanyMask statues
which companies have a statue?
@ FACIL_DOCK
Station with a dock.
Vehicle * Next() const
Get the next vehicle of this vehicle.
const Tcont * Packets() const
Returns a pointer to the cargo packet list (so you can iterate over it etc).
const AirportFTAClass * GetAirport(const uint8_t airport_type)
Get the finite state machine of an airport type.
Town * town
The town this station is associated with.
void SetRailStationPlatformReservation(TileIndex start, DiagDirection dir, bool b)
Set the reservation for a complete station platform.
CommandCost FindJoiningBaseStation(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, T **st, F filter)
Find a nearby station that joins this station.
@ CBM_CARGO_STATION_RATING_CALC
custom station rating for this cargo type
Owner owner[4]
Name of the owner(s)
@ CBID_STATION_AVAILABILITY
Determine whether a newstation should be made available to build.
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
@ TRANSPORT_WATER
Transport over water.
Slope GetTileSlope(TileIndex tile)
Return the slope of a given tile inside the map.
@ AAT_STATION_NEW_CARGO
Triggered when new cargo arrives at the station (for all tiles at the same time).
@ PALETTE_MODIFIER_COLOUR
this bit is set when a recolouring process is in action
DiagDirection TrackdirToExitdir(Trackdir trackdir)
Maps a trackdir to the (4-way) direction the tile is exited when following that trackdir.
@ INVALID_OWNER
An invalid owner.
std::vector< AirportTileLayout > layouts
List of layouts composing the airport.
uint8_t callback_mask
Bitmask of station callbacks that have to be called.
uint16_t triggers
The triggers that trigger animation.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
Price
Enumeration of all base prices for use with Prices.
StringID name
name of this airport
static CommandCost CanRemoveRoadWithStop(TileIndex tile, DoCommandFlag flags)
Check if a drive-through road stop tile can be cleared.
static bool CMSAWater(TileIndex tile)
Check whether the tile is water.
@ SAT_NEW_CARGO
Trigger station on new cargo arrival.
StringID station_class
Class of station.
CommandCost RemoveRailStation(T *st, DoCommandFlag flags, Money removal_cost)
Remove a rail station/waypoint.
uint16_t road_speed
Speed limit of road (bridges and track)
static Roadside GetRoadWaypointRoadside(Tile tile)
Get the decorations of a road waypoint.
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
Iterator to iterate over all tiles belonging to a bitmaptilearea.
An interval timer will fire every interval, and will continue to fire until it is deleted.
constexpr static debug_inline uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
@ AAT_BUILT
Triggered when the airport is built (for all tiles at the same time).
static LinkGraphSchedule instance
Static instance of LinkGraphSchedule.
bool AutoslopeEnabled()
Tests if autoslope is enabled for _current_company.
Owner
Enum for all companies/owners.
CommandCost CalculateRoadStopCost(TileArea tile_area, DoCommandFlag flags, bool is_drive_through, StationType station_type, Axis axis, DiagDirection ddir, StationID *est, RoadType rt, Money unit_cost)
Calculates cost of new road stops within the area.
RailType
Enumeration for all possible railtypes.
uint8_t flags
Bitmask of flags, bit 0: use different sprite set; bit 1: divide cargo about by station size.
uint32_t GetRegister(uint i)
Gets the value of a so-called newgrf "register".
Tindex index
Index of this pool item.
RoadStopDrawMode
Different draw modes to disallow rendering of some parts of the stop or road.
void DrawRoadCatenary(const TileInfo *ti)
Draws the catenary for the given tile.
@ RVSB_IN_ROAD_STOP
The vehicle is in a road stop.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
CommandCost CmdOpenCloseAirport(DoCommandFlag flags, StationID station_id)
Open/close an airport to incoming aircraft.
@ VEH_TRAIN
Train vehicle type.
uint32_t GetPlatformInfo(Axis axis, uint8_t 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.
CargoTypes GetAcceptanceMask(const Station *st)
Get a mask of the cargo types that the station accepts.
Class for storing amounts of cargo.
SpriteID sprite
The 'real' sprite.
void PassOnFlow(StationID origin, StationID via, uint amount)
Pass on some flow, remembering it as invalid, for later subtraction from locally consumed flow.
static constexpr TimerGameEconomy::Date STALE_LINK_DEPOT_TIMEOUT
Number of days before deleting links served only by vehicles stopped in depot.
DifficultySettings difficulty
settings related to the difficulty
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
@ CBID_CARGO_STATION_RATING_CALC
Called to calculate part of a station rating.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
bool IsOilRig(Tile t)
Is tile t part of an oilrig?
This struct contains all the info that is needed to draw and construct tracks.
@ VETSB_CONTINUE
Bit sets of the above specified bits.
void SetStationTileHaveWires(Tile t, bool b)
Set the catenary wires state of the rail station.
void MoveSign(TileIndex new_xy) override
Move the station main coordinate somewhere else.
Representation of a waypoint.
@ CBM_STATION_SLOPE_CHECK
Check slope of new station tiles.
void SetStationTileHavePylons(Tile t, bool b)
Set the catenary pylon state of the rail station.
bool IsCompatibleTrainStationTile(Tile test_tile, Tile station_tile)
Check if a tile is a valid continuation to a railstation tile.
static RoadStop * GetByTile(TileIndex tile, RoadStopType type)
Find a roadstop at given tile.
uint8_t GetAirportNoiseLevelForDistance(const AirportSpec *as, uint distance)
Get a possible noise reduction factor based on distance from town center.
static constexpr bool IsSteepSlope(Slope s)
Checks if a slope is steep.
uint8_t town_council_tolerance
minimum required town ratings to be allowed to demolish stuff
bool IsRailStationTile(Tile t)
Is this tile a station tile and a rail station?
void GetStationLayout(uint8_t *layout, uint numtracks, uint plat_len, const StationSpec *statspec)
Create the station layout for the given number of tracks and platform length.
@ EUM_INCREASE
Increase capacity.
@ VEH_ROAD
Road vehicle type.
static const uint TILE_SIZE
Tile size in world coordinates.
DiagDirection
Enumeration for diagonal directions.
Wrapper class to abstract away the way the tiles are stored.
static IterateWrapper Iterate(size_t from=0)
Returns an iterable ensemble of all valid CargoSpec.
static Station * Get(size_t index)
Gets station with given index.
ClientSettings _settings_client
The current settings for this game.
void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32_t total_offset, uint32_t newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence in GUI with railroad specifics.
void AddAnimatedTile(TileIndex tile, bool mark_dirty)
Add the given tile to the animated tile table (if it does not exist yet).
TileIndex xy
town center tile
Specification of a cargo type.
DiagDirection GetRoadStopDir(Tile t)
Gets the direction the road stop entrance points towards.
static bool IsValidID(size_t index)
Tests whether given index is a valid index for station of this type.
@ MP_INDUSTRY
Part of an industry.
GRFConfig * GetGRFConfig(uint32_t grfid, uint32_t mask)
Retrieve a NewGRF from the current config by its grfid.
int y
Y position of the tile in unit coordinates.
void Add(TileIndex to_add)
Add a single tile to a tile area; enlarge if needed.
StringID airport_tile_name
Name of the airport tile.
constexpr uint ClampU(const uint a, const uint min, const uint max)
Clamp an unsigned integer between an interval.
CompanyInfrastructure infrastructure
NOSAVE: Counts of company owned infrastructure.
DiagDirection GetDockDirection(Tile t)
Get the direction of a dock.
@ VS_TRAIN_SLOWING
Train is slowing down.
NodeID Size() const
Get the current size of the component.
static StationSpec::TileFlags GetStationTileFlags(StationGfx gfx, const StationSpec *statspec)
Get station tile flags for the given StationGfx.
static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags, int replacement_spec_index=-1)
Remove a bus station/truck stop.
@ WC_STATION_VIEW
Station view; Window numbers:
bool IsWaterTile(Tile t)
Is it a water tile with plain water?
StringID station_name
Default name for nearby station.
bool Enter(RoadVehicle *rv)
Enter the road stop.
uint8_t status
Status of this cargo, see GoodsEntryStatus.
void ProcessRegisters(uint8_t resolved_var10, uint32_t resolved_sprite, bool separate_ground) const
Evaluates the register modifiers and integrates them into the preprocessed sprite layout.
Defines the internal data of a functional industry.
struct RailTypeInfo::@26 strings
Strings associated with the rail type.
RailType GetRailType(Tile t)
Gets the rail type of the given tile.
Owner owner
Which company owns the vehicle?
static void RestoreTrainReservation(Train *v)
Restore platform reservation during station building/removing.
@ CBID_STATION_DRAW_TILE_LAYOUT
Choose a tile layout to draw, instead of the standard range.
@ DC_EXEC
execute the given command
uint32_t PaletteID
The number of the palette.
uint8_t landscape
the landscape we're currently in
void FinalizeLocalConsumption(StationID self)
Subtract invalid flows from locally consumed flow.
void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTrigger trigger, CargoID cargo_type=INVALID_CARGO)
Trigger road stop randomisation.
Owner owner
The owner of this station.
void RecomputeCatchment(bool no_clear_nearby_lists=false)
Recompute tiles covered in our catchment area.
@ MP_ROAD
A tile with road (or tram tracks)
Defines the data structure for an airport.
Tile description for the 'land area information' tool.
uint GetShare(StationID st) const
Get flow for a station.
SpriteID GetCustomStationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint32_t var10)
Resolve sprites for drawing a station tile.
StringID name
Name of this class.
constexpr bool HasExactlyOneBit(T value)
Test whether value has exactly 1 bit set.
StringID airport_name
Name of the airport.
CommandCost CheckIfAuthorityAllowsNewStation(TileIndex tile, DoCommandFlag flags)
Checks whether the local authority allows construction of a new station (rail, road,...
Axis GetRailStationAxis(Tile t)
Get the rail direction of a rail station.
@ ROADSTOP_TRUCK
A standard stop for trucks.
DoCommandFlag
List of flags for a command.
Foundation
Enumeration for Foundations.
EdgeUpdateMode
Special modes for updating links.
uint16_t h
The height of the area.
SourceType
Types of cargo source and destination.
CommandCost EnsureNoVehicleOnGround(TileIndex tile)
Ensure there is no vehicle at the ground at the given position.
uint32_t station
Count of company owned station tiles.
uint8_t time_since_pickup
Number of rating-intervals (up to 255) since the last vehicle tried to load this cargo.
Station * neutral_station
Associated neutral station.
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
bool Succeeded() const
Did this command succeed?
StationType
Station types.
TrackBits TrackToTrackBits(Track track)
Maps a Track to the corresponding TrackBits value.
void Remove(const T &element)
Remove a single element from the tree, if it exists.
virtual bool TileBelongsToRailStation(TileIndex tile) const =0
Check whether a specific tile belongs to this station.
@ AAT_TILELOOP
Triggered in the periodic tile loop.
StringID string_id
Default name (town area) of station.
GameCreationSettings game_creation
settings used during the creation of a game (map)
void MakeDriveThrough()
Join this road stop to another 'base' road stop if possible; fill all necessary data to become an act...
void Clear()
Clears the 'tile area', i.e.
void RestrictFlows(StationID via)
Restrict all flows at a station for specific cargo and destination.
static Pool::IterateWrapper< Station > Iterate(size_t from=0)
Returns an iterable ensemble of all valid stations of type T.
@ TRANSPORT_ROAD
Transport by road vehicle.
uint GetFlowFrom(StationID from) const
Get the sum of flows from a specific station from this FlowStatMap.
@ ROADSTOP_DRAW_MODE_OVERLAY
Drive-through stops: Draw the road overlay, e.g. pavement.
HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
Returns the bit corresponding to the town zone of the specified tile.
Aircraft, helicopters, rotors and their shadows belong to this class.
Slope tileh
Slope of the tile.
@ SSF_SEPARATE_GROUND
Use different sprite set for ground sprites.
@ RSF_NO_CATENARY
Do not show catenary.
bool HasPowerOnRoad(RoadType enginetype, RoadType tiletype)
Checks if an engine of the given RoadType got power on a tile with a given RoadType.
@ TRACK_BIT_NONE
No track.
@ CBM_STATION_DRAW_TILE_LAYOUT
Use callback to select a tile layout to use when drawing.
Flow statistics telling how much flow should be sent along a link.
void ClearDockingTilesCheckingNeighbours(TileIndex tile)
Clear docking tile status from tiles around a removed dock, if the tile has no neighbours which would...
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner)
Change the owner of a tile.
void GetStringWithArgs(StringBuilder &builder, StringID string, StringParameters &args, uint case_index, bool game_script)
Get a parsed string with most special stringcodes replaced by the string parameters.
StationCargoList cargo
The cargo packets of cargo waiting in this station.
void Queue(LinkGraph *lg)
Queue a link graph for execution.
TimerGameEconomy::Date date_of_last_service
Last economy date the vehicle had a service at a depot.
@ NR_STATION
Reference station. Scroll to station when clicking on the news. Delete news when station is deleted.
void UpdateVirtCoord() override
Update the virtual coords needed to draw the waypoint sign.
Money RoadBuildCost(RoadType roadtype)
Returns the cost of building the specified roadtype.
PalSpriteID ground
Palette and sprite for the ground.
bool include(Container &container, typename Container::const_reference &item)
Helper function to append an item to a container if it is not already contained.
bool IsDock(Tile t)
Is tile t a dock tile?
Defines the data structure of each individual tile of an airport.
TimerGameCalendar::Date build_date
Date of construction of tile contents.
void DrawRoadGroundSprites(const TileInfo *ti, RoadBits road, RoadBits tram, const RoadTypeInfo *road_rti, const RoadTypeInfo *tram_rti, Roadside roadside, bool snow_or_desert)
Draw road ground sprites.
bool IsTruckStop(Tile t)
Is the station at t a truck stop?
StringID name
Name of this rail type.
CommandCost CmdBuildRailStation(DoCommandFlag flags, TileIndex tile_org, RailType rt, Axis axis, uint8_t numtracks, uint8_t plat_len, StationClassID spec_class, uint16_t spec_index, StationID station_to_join, bool adjacent)
Build rail station.
SpriteID GetCustomRoadSprite(const RoadTypeInfo *rti, TileIndex tile, RoadTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
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...
OrderSettings order
settings related to orders
TransportType
Available types of transport.
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.
uint DistanceManhattan(TileIndex t0, TileIndex t1)
Gets the Manhattan distance between the two given tiles.
Direction rotation
How this airport is rotated.
CargoArray GetProductionAroundTiles(TileIndex north_tile, int w, int h, int rad)
Get the cargo types being produced around the tile (in a rectangle).
StationIDStack DeleteFlows(StationID via)
Delete all flows at a station for specific cargo and destination.
CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, const StationSpec *statspec, Axis axis, uint8_t plat_len, uint8_t numtracks)
Check the slope of a tile of a new station.
constexpr bool IsInsideBS(const T x, const size_t base, const size_t size)
Checks if a value is between a window started at some base point.
void CheckForDockingTile(TileIndex t)
Mark the supplied tile as a docking tile if it is suitable for docking.
CargoID Index() const
Determines index of this cargospec.
static constexpr TimerGameEconomy::Date COMPRESSION_INTERVAL
Minimum number of days between subsequent compressions of a LG.
void MakeDriveThroughRoadStop(Tile t, Owner station, Owner road, Owner tram, StationID sid, StationType rst, RoadType road_rt, RoadType tram_rt, Axis a)
Make the given tile a drivethrough roadstop tile.
uint8_t status
Status; 0: no looping, 1: looping, 0xFF: no animation.
bool station_noise_level
build new airports when the town noise level is still within accepted limits
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.
CommandCost CheckOwnership(Owner owner, TileIndex tile)
Check whether the current owner owns something.
@ VEH_INVALID
Non-existing type of vehicle.
TileIndex dest_tile
Heading for this tile.
bool serve_neutral_industries
company stations can serve industries with attached neutral stations
StationGfx GetStationGfx(Tile t)
Get the station graphics of this tile.
CargoClasses classes
Classes of this cargo type.
#define return_cmd_error(errcode)
Returns from a function with a specific StringID as error.
StationList stations
List of stations nearby.
CommandCost CheckFlatLandRoadStop(TileIndex cur_tile, int &allowed_z, DoCommandFlag flags, uint invalid_dirs, bool is_drive_through, StationType station_type, Axis axis, StationID *station, RoadType rt)
Checks if a road stop can be built at the given tile.
ProducedCargoes produced
produced cargo slots
TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
Converts TrackBits to TrackdirBits while allowing both directions.
TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
Return the offset between two tiles from a TileIndexDiffC struct.
bool IsBayRoadStopTile(Tile t)
Is tile t a bay (non-drive through) road stop station?
static CommandCost CheckFlatLandAirport(AirportTileTableIterator tile_iter, DoCommandFlag flags)
Checks if an airport can be built at the given location and clear the area.
TrackedViewportSign sign
NOSAVE: Dimensions of sign.
StationList stations_near
NOSAVE: List of nearby stations.
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.
void ReleaseFlows(StationID via)
Release all flows at a station for specific cargo and destination.
#define M(x)
Helper for creating a bitset of slopes.
Common return value for all commands.
TileArea location
Location of the industry.
uint ApplyPixelFoundationToSlope(Foundation f, Slope &s)
Applies a foundation to a slope.
Track GetRailStationTrack(Tile t)
Get the rail track of a rail station tile.
bool IsWater(Tile t)
Is it a plain water tile?
Iterable ensemble of each set bit in a value.
Track RemoveFirstTrack(TrackBits *tracks)
Removes first Track from TrackBits and returns it.
Trackdir GetVehicleTrackdir() const override
Get the tracks of the train vehicle.
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.
@ CBID_STATION_BUILD_TILE_LAYOUT
Called when building a station to customize the tile layout.
static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
Remove an airport.
Information about GRF, used in the game and (part of it) in savegames.
CommandCost CmdRemoveFromRoadWaypoint(DoCommandFlag flags, TileIndex start, TileIndex end)
Remove road waypoints.
void SetStationGfx(Tile t, StationGfx gfx)
Set the station graphics of this tile.
uint8_t StationGfx
Copy from station_map.h.
TileArea train_station
Tile area the train 'station' part covers.
@ OWNER_NONE
The tile has no ownership.
@ NF_INCOLOUR
Bit value for coloured news.
static Industry * GetByTile(TileIndex tile)
Get the industry of the given tile.
TrackBits
Allow incrementing of Track variables.
@ INVALID_DIAGDIR
Flag for an invalid DiagDirection.
void DirtyCompanyInfrastructureWindows(CompanyID company)
Redraw all windows with company infrastructure counts.
static constexpr int GetSlopeMaxZ(Slope s)
Returns the height of the highest corner of a slope relative to TileZ (= minimal height)
Town * CalcClosestTownFromTile(TileIndex tile, uint threshold=UINT_MAX)
Return the town closest to the given tile within threshold.
CommandCost CmdBuildAirport(DoCommandFlag flags, TileIndex tile, uint8_t airport_type, uint8_t layout, StationID station_to_join, bool allow_adjacent)
Place an Airport.
IndustryType type
type of industry.
StationRect rect
NOSAVE: Station spread out rectangle maintained by StationRect::xxx() functions.
Roadside
The possible road side decorations.
void TriggerWatchedCargoCallbacks(Station *st)
Run the watched cargo callback for all houses in the catchment area.
@ DRD_NONE
None of the directions are disallowed.
bool HasRating() const
Does this cargo have a rating at this station?
TileIndex tile
Current tile index.
static bool FindNearIndustryName(TileIndex tile, void *user_data)
Find a station action 0 property 24 station name, or reduce the free_names if needed.
Base class for tile iterators.
bool MayHaveRoad(Tile t)
Test whether a tile can have road/tram types.
static bool CMSAMine(TileIndex tile)
Check whether the tile is a mine.
uint DistanceFromEdge(TileIndex tile)
Param the minimum distance to an edge.
void MarkTilesDirty(bool cargo_change) const
Marks the tiles of the station as dirty.
@ DIAGDIR_BEGIN
Used for iterations.
void Insert(const T &element)
Insert a single element in the tree.
StringID roadtype
Type of road on the tile.
Money GetClearCost(Price category) const
Get the cost for clearing a road stop of this type.
TrackBits GetRailReservationTrackBits(Tile t)
Returns the reserved track bits of the tile.
@ GES_ACCEPTED_BIGTICK
Set when cargo was delivered for final delivery during the current STATION_ACCEPTANCE_TICKS interval.
Cheats _cheats
All the cheats.
const SharesMap * GetShares() const
Get the actual shares as a const pointer so that they can be iterated over.
StationID GetVia(StationID source) const
Get the best next hop for a cargo packet from station source.
@ TRACKDIR_BIT_NONE
No track build.
static bool IsExpected(const BaseStation *st)
Helper for checking whether the given station is of this type.
@ WATER_CLASS_INVALID
Used for industry tiles on land (also for oilrig if newgrf says so).
TileArea truck_station
Tile area the truck 'station' part covers.
void UpdateAirportsNoise()
Recalculate the noise generated by the airports of each town.
DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
NodeID node
ID of node in link graph referring to this goods entry.
uint8_t fallback_railtype
Original railtype number to use when drawing non-newgrf railtypes, or when drawing stations.
VehicleCargoList cargo
The cargo this vehicle is carrying.
static void FreeTrainReservation(Train *v)
Clear platform reservation during station building/removing.
bool Failed() const
Did this command fail?
static RoadStop ** FindRoadStopSpot(bool truck_station, Station *st)
Order current_order
The current order (+ status, like: loading)
TileIndex GetHangarTile(uint hangar_num) const
Get the first tile of the given hangar.
@ VEH_SHIP
Ship vehicle type.
An edge in the link graph.
@ TRACK_BIT_LEFT
Left track.
Airport airport
Tile area the airport covers.
Iterator to iterate over all tiles belonging to an airport spec.
Represents the covered area of e.g.
void AddFacility(StationFacility new_facility_bit, TileIndex facil_xy)
Called when new facility is built on the station.
DiagDirection AxisToDiagDir(Axis a)
Converts an Axis to a DiagDirection.
size_t MapSize() const
Count the number of ranges with equal keys in this MultiMap.
void EndSpriteCombine()
Terminates a block of sprites started by StartSpriteCombine.
uint16_t SourceID
Contains either industry ID, town ID or company ID (or INVALID_SOURCE)
uint16_t MaxTownNoise() const
Calculate the max town noise.
bool HasStationTileRail(Tile t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
static bool CMSATree(TileIndex tile)
Check whether the tile is a tree.
uint16_t cur_speed
current speed
CargoTypes GetEmptyMask(const Station *st)
Get a mask of the cargo types that are empty at the station.
@ SRT_NEW_CARGO
Trigger station on new cargo arrival.
Trackdir ReverseTrackdir(Trackdir trackdir)
Maps a trackdir to the reverse trackdir.
@ Blocked
Tile is blocked to vehicles.
static const AirportTileSpec * GetByTile(TileIndex tile)
Retrieve airport tile spec for the given airport tile.
TileIndexDiff TileDiffXY(int x, int y)
Calculates an offset for the given coordinate(-offset).
GameSettings _settings_game
Game settings of a running game or the scenario editor.
IndustryType indtype
Industry type to get the name from.
bool IsTileOnWater(Tile t)
Tests if the tile was built on water.
bool IsBuoyTile(Tile t)
Is tile t a buoy tile?
RoadType
The different roadtypes we support.
static const uint8_t ANIM_STATUS_NO_ANIMATION
There is no animation.
EconomySettings economy
settings to change the economy
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
static CommandCost RemoveDock(TileIndex tile, DoCommandFlag flags)
Remove a dock.
IndustryID GetIndustryIndex(Tile t)
Get the industry ID of the given tile.
NewGRF supplied spritelayout.
@ NoWires
Tile should NOT contain catenary wires.
void FindVehiclesWithOrder(VehiclePredicate veh_pred, OrderPredicate ord_pred, VehicleFunc veh_func)
Find vehicles matching an order.
StringID name
Name of this station.
@ ROTSG_ROADSTOP
Required: Bay stop surface.
CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
Clear a single tile of a station.
bool NeedsPreprocessing() const
Tests whether this spritelayout needs preprocessing by PrepareLayout() and ProcessRegisters(),...
static debug_inline bool IsNormalRoadTile(Tile t)
Return whether a tile is a normal road tile.
'Train' is either a loco or a wagon.
static IntervalTimer< TimerGameEconomy > _economy_stations_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::STATION}, [](auto) { for(Station *st :Station::Iterate()) { for(GoodsEntry &ge :st->goods) { SB(ge.status, GoodsEntry::GES_LAST_MONTH, 1, GB(ge.status, GoodsEntry::GES_CURRENT_MONTH, 1));ClrBit(ge.status, GoodsEntry::GES_CURRENT_MONTH);} } })
Economy monthly loop for stations.
void FreeTrainTrackReservation(const Train *v)
Free the reserved path in front of a vehicle.
bool HasTileRoadType(Tile t, RoadTramType rtt)
Check if a tile has a road or a tram road type.
SpriteID GetCanalSprite(CanalFeature feature, TileIndex tile)
Lookup the base sprite to use for a canal.
DiagDirection DirToDiagDir(Direction dir)
Convert a Direction to a DiagDirection.
void SetCustomStationSpecIndex(Tile t, uint8_t specindex)
Set the custom station spec for this tile.
TimerGameEconomy::Date LastCompression() const
Get date of last compression.
@ SPRITE_MODIFIER_CUSTOM_SPRITE
Set when a sprite originates from an Action 1.
@ NUM_AIRPORTS
Maximal number of airports in total.
std::string name
Custom name.
Ground palette sprite of a tile, together with its sprite layout.
GRFFilePropsBase< NUM_CARGO+3 > grf_prop
Properties related the the grf file.
void RestrictShare(StationID st)
Restrict a flow by moving it to the end of the map and decreasing the amount of unrestricted flow.
Owner GetTileOwner(Tile tile)
Returns the owner of a tile.
void StartSpriteCombine()
Starts a block of sprites, which are "combined" into a single bounding box.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
@ RSF_DRIVE_THROUGH_ONLY
Stop is drive-through only.
TileArea bus_station
Tile area the bus 'station' part covers.
CommandCost RemoveBuoy(TileIndex tile, DoCommandFlag flags)
Remove a buoy.
@ INVALID_ROADTYPE
flag for invalid roadtype
@ RTSG_GROUND
Main group of ground images.
@ FACIL_TRUCK_STOP
Station with truck stops.
void DeallocateSpecFromStation(BaseStation *st, uint8_t specindex)
Deallocate a StationSpec from a Station.
int32_t TileIndexDiff
An offset value between two tiles.
Coordinates of a point in 2D.
StringID station_name
Type of station within the class.
StringID name
Name of this rail type.
bool ValParamRoadType(RoadType roadtype)
Validate functions for rail building.
LinkGraphSettings linkgraph
settings for link graph calculations
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 void ToggleRoadWaypointOnSnowOrDesert(Tile t)
Toggle the snow/desert state of a road waypoint tile.
uint AvailableCount() const
Returns sum of cargo still available for loading at the sation.
static const int GFX_DOCK_BASE_WATER_PART
The offset for the water parts.
void OffsetGroundSprite(int x, int y)
Called when a foundation has been drawn for the current tile.
static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming name_class)
TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
Builds a TrackStatus.
void AppendShare(StationID st, uint flow, bool restricted=false)
Add some flow to the end of the shares map.
@ ROADSIDE_BARREN
Road on barren land.
@ CBM_STATION_AVAIL
Availability of station in construction window.
static Station * From(BaseStation *st)
Converts a BaseStation to SpecializedStation with type checking.
@ ROADSTOPTYPE_ALL
This RoadStop is for both types of station road stops.
const Tspec * GetSpec(uint index) const
Get a spec from the class at a given index.
uint GetCustomRoadStopSpecIndex(Tile t)
Get the custom road stop spec for this tile.
CargoTypes always_accepted
Bitmask of always accepted cargo types (by houses, HQs, industry tiles when industry doesn't accept c...
void ShowStationViewWindow(StationID station)
Opens StationViewWindow for given station.
void AddCost(const Money &cost)
Adds the given cost to the cost of the command.
static void TruncateCargo(const CargoSpec *cs, GoodsEntry *ge, uint amount=UINT_MAX)
Truncate the cargo by a specific amount.
bool show_track_reservation
highlight reserved tracks.
bool IsValidAxis(Axis d)
Checks if an integer value is a valid Axis.
CommandCost CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadTramType rtt, DoCommandFlag flags, bool town_check)
Is it allowed to remove the given road bits from the given tile?
void DrawRoadOverlays(const TileInfo *ti, PaletteID pal, const RoadTypeInfo *road_rti, const RoadTypeInfo *tram_rti, uint road_offset, uint tram_offset, bool draw_underlay)
Draw road underlay and overlay sprites.
Set of callback functions for performing tile operations of a given tile type.
const StationList * GetStations()
Run a tile loop to find stations around a tile, on demand.
@ SAT_BUILT
Trigger tile when built.
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.
LinkGraphID link_graph
Link graph this station belongs to.
void SetTileOwner(Tile tile, Owner owner)
Sets the owner of a tile.
RoadStop * truck_stops
All the truck stops.
Defines the data structure for constructing industry.
uint32_t PrepareLayout(uint32_t orig_offset, uint32_t newgrf_ground_offset, uint32_t newgrf_offset, uint constr_stage, bool separate_ground) const
Prepares a sprite layout before resolving action-1-2-3 chains.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
constexpr uint CountBits(T value)
Counts the number of set bits in a variable.
Industry * industry
NOSAVE: Associated industry for neutral stations. (Rebuilt on load from Industry->st)
void SetStationTileBlocked(Tile t, bool b)
Set the blocked state of the rail station.
bool value
tells if the bool cheat is active or not
static void Reset(TileIndex tile=INVALID_TILE, bool from_gui=true)
Reset the OrderBackups from GUI/game logic.
@ DC_BANKRUPT
company bankrupts, skip money check, skip vehicle on tile check in some cases
Iterator to iterate over all tiles belonging to an airport.
std::array< uint32_t, RAILTYPE_END > rail
Count of company owned track bits for each rail type.
CommandCost CmdBuildDock(DoCommandFlag flags, TileIndex tile, StationID station_to_join, bool adjacent)
Build a dock/haven.
bool IsAvailable() const
Check whether this airport is available to build.
@ RTSG_OVERLAY
Images for overlaying track.
std::set< Station *, StationCompare > StationList
List of stations.
StationType GetStationType(Tile t)
Get the station type of this tile.
void TileLoop_Water(TileIndex tile)
Let a water tile floods its diagonal adjoining tiles called from tunnelbridge_cmd,...
@ OWNER_TOWN
A town owns the tile, or a town is expanding.
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.
@ ROADSTOPTYPE_PASSENGER
This RoadStop is for passenger (bus) stops.
bool HasTileWaterClass(Tile t)
Checks whether the tile has an waterclass associated.
static debug_inline bool IsPlainRailTile(Tile t)
Checks whether the tile is a rail tile or rail tile with signals.
@ TRACK_BIT_ALL
All possible tracks.
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.
uint8_t disallowed_lengths
Bitmask of platform lengths available for the station.
void IncreaseStats(Station *st, CargoID cargo, StationID next_station_id, uint capacity, uint usage, uint32_t time, EdgeUpdateMode mode)
Increase capacity for a link stat given by station cargo and next hop.
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.
bool IsValidTile(Tile tile)
Checks if a tile is valid.
TrackBits GetTrackBits(Tile tile)
Gets the track bits of the given tile.
Direction direction
facing
uint16_t max_speed
Maximum speed for vehicles travelling on this rail type.
void AddFlow(StationID origin, StationID via, uint amount)
Add some flow from "origin", going via "via".
bool IsTileForestIndustry(TileIndex tile)
Check whether the tile is a forest.
TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
static constexpr TimerGameTick::Ticks STATION_LINKGRAPH_TICKS
Cycle duration for cleaning dead links.
uint DistanceMax(TileIndex t0, TileIndex t1)
Gets the biggest distance component (x or y) between the two given tiles.
SpriteID single_x
single piece of rail in X direction, without ground
uint8_t size_x
size of airport in x direction
@ MP_TREES
Tile got trees.
const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
A pair-construct of a TileIndexDiff.
uint8_t GetAnimationFrame(Tile t)
Get the current animation frame.
@ ROADSTOP_DRAW_MODE_WAYP_GROUND
Waypoints: Draw the sprite layout ground tile (on top of the road)
void DrawFoundation(TileInfo *ti, Foundation f)
Draw foundation f at tile ti.
@ TRACK_BIT_UPPER
Upper track.
static const uint MAX_LENGTH_STATION_NAME_CHARS
The maximum length of a station name in characters including '\0'.
static debug_inline uint SizeX()
Get the size of the map along the X.
bool IsRoadWaypoint(Tile t)
Is the station at t a road waypoint?
@ SSF_CUSTOM_FOUNDATIONS
Draw custom foundations.
uint16_t tram_speed
Speed limit of tram (bridges and track)
void ForAllStationsRadius(TileIndex center, uint radius, Func func)
Call a function on all stations whose sign is within a radius of a center tile.
static const SharesMap empty_sharesmap
Static instance of FlowStat::SharesMap.
bool road_stop_on_competitor_road
allow building of drive-through road stops on roads owned by competitors
@ DT_MANUAL
Manual distribution. No link graph calculations are run.
CommandCost RemoveFromRailBaseStation(TileArea ta, std::vector< T * > &affected_stations, DoCommandFlag flags, Money removal_cost, bool keep_rail)
Remove a number of tiles from any rail station within the area.
bool enabled
entity still available (by default true).newgrf can disable it, though
RoadBits GetAnyRoadBits(Tile tile, RoadTramType rtt, bool straight_tunnel_bridge_entrance)
Returns the RoadBits on an arbitrary tile Special behaviour:
@ GES_CURRENT_MONTH
Set when cargo was delivered for final delivery this month.
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
Point RemapCoords2(int x, int y)
Map 3D world or tile coordinate to equivalent 2D coordinate as used in the viewports and smallmap.
bool IsValidDiagDirection(DiagDirection d)
Checks if an integer value is a valid DiagDirection.
All ships have this type.
Stores station stats for a single cargo.
CompanyID _current_company
Company currently doing an action.
Track
These are used to specify a single track.
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
static void DeleteStationIfEmpty(BaseStation *st)
This is called right after a station was deleted.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
bool IsBuoy(Tile t)
Is tile t a buoy tile?
static int CountMapSquareAround(TileIndex tile, CMSAMatcher cmp)
Counts the numbers of tiles matching a specific type in the area around.
@ TRACK_BIT_RIGHT
Right track.
uint8_t delete_ctr
Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is ...
@ WATER_CLASS_CANAL
Canal.
uint8_t size_y
size of airport in y direction
std::unordered_map< uint16_t, std::vector< uint8_t > > layouts
Custom platform layouts, keyed by platform and length combined.
uint8_t amount_fract
Fractional part of the amount in the cargo list.
NodeID AddNode(const Station *st)
Add a node to the component and create empty edges associated with it.
static size_t GetNumItems()
Returns number of valid items in the pool.
void DeleteAnimatedTile(TileIndex tile)
Removes the given tile from the animated tile table.
Trackdir
Enumeration for tracks and directions.
bool IsDockingTile(Tile t)
Checks whether the tile is marked as a dockling tile.
void ClearDriveThrough()
Prepare for removal of this stop; update other neighbouring stops if needed.
void UpdatePosition(int center, int top, StringID str, StringID str_small=STR_NULL)
Update the position of the viewport sign.
bool IsCustomStationSpecIndex(Tile t)
Is there a custom rail station spec on this tile?
void MakeAirport(Tile t, Owner o, StationID sid, uint8_t section, WaterClass wc)
Make the given tile an airport tile.
Slope
Enumeration for the slope-type.
bool TryPathReserve(Train *v, bool mark_as_stuck=false, bool first_tile_okay=false)
Try to reserve a path to a safe position.
static RoadVehicle * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
@ ROADSIDE_GRASS
Road on grass.
Axis
Allow incrementing of DiagDirDiff variables.
bool IsRoadWaypointTile(Tile t)
Is this tile a station tile and a road waypoint?
Town * AirportGetNearestTown(const AirportSpec *as, Direction rotation, TileIndex tile, TileIterator &&it, uint &mindist)
Finds the town nearest to given airport.
@ TRANSPORT_RAIL
Transport by train.
static debug_inline uint Size()
Get the size of the map.
uint8_t noise_level
noise that this airport generates
FlowStatMap flows
Planned flows through this station.
RailTrackOffset
Offsets for sprites within an overlay/underlay set.
void SetDParam(size_t n, uint64_t v)
Set a string parameter v at index n in the global string parameter array.
StationID GetStationIndex(Tile t)
Get StationID from a tile.
uint16_t GetStationLayoutKey(uint8_t platforms, uint8_t length)
Get the station layout key for a given station layout size.
TileIndex tile
The base tile of the area.
bool HasStationReservation(Tile t)
Get the reservation state of the rail station.
static const uint MIN_TIMEOUT_DISTANCE
Minimum effective distance for timeout calculation.
bool IsWaypointClass(const RoadStopClass &cls)
Test if a RoadStopClass is the waypoint class.
bool build_on_slopes
allow building on slopes
@ ROTSG_OVERLAY
Optional: Images for overlaying track.
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...
@ RSRT_NEW_CARGO
Trigger roadstop on arrival of new cargo.
bool HasStationRail(Tile t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint?
@ RTO_X
Piece of rail in X direction.
struct GRFFileProps grf_prop
Properties related to the grf file.
@ OWNER_WATER
The tile/execution is done by "water".
Shared order list linking together the linked list of orders and the list of vehicles sharing this or...
uint8_t last_age
Age in years (up to 255) of the last vehicle that tried to load this cargo.
CommandCost RemoveRoadWaypointStop(TileIndex tile, DoCommandFlag flags, int replacement_spec_index=-1)
Remove a road waypoint.
StationGfx GetAirportGfx(Tile t)
Get the station graphics of this airport tile.
bool HasSignals(Tile t)
Checks if a rail tile has signals.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
void AddNewsItem(StringID string, NewsType type, NewsFlag flags, NewsReferenceType reftype1=NR_NONE, uint32_t ref1=UINT32_MAX, NewsReferenceType reftype2=NR_NONE, uint32_t ref2=UINT32_MAX, const NewsAllocatedData *data=nullptr)
Add a new newsitem to be shown.
void SetDockingTile(Tile t, bool b)
Set the docking tile state of a tile.
@ FOUNDATION_LEVELED
The tile is leveled up to a flat slope.
void UpdateVirtCoord() override
Update the virtual coords needed to draw the station sign.
bool IsHangar(Tile t)
Check whether the given tile is a hangar.
@ WC_VEHICLE_DEPOT
Depot view; Window numbers:
CommandCost FindJoiningWaypoint(StationID existing_waypoint, StationID waypoint_to_join, bool adjacent, TileArea ta, Waypoint **wp, bool is_road)
Find a nearby waypoint that joins this waypoint.
Owner GetRoadOwner(Tile t, RoadTramType rtt)
Get the owner of a specific road type.
@ MP_STATION
A tile of a station.
Money GetBuildCost(Price category) const
Get the cost for building a road stop of this type.
static constexpr TimerGame< struct Economy >::Date INVALID_DATE
Representation of an invalid date.
GRFFileProps grf_prop
properties related to the grf file
@ GES_ACCEPTANCE
Set when the station accepts the cargo currently for final deliveries.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
std::string cached_name
NOSAVE: Cache of the resolved name of the station, if not using a custom name.
bool kdtree_valid
Are the sign data valid for use with the _viewport_sign_kdtree?
void ForAllStationsAroundTiles(const TileArea &ta, Func func)
Call a function on all stations that have any part of the requested area within their catchment.
void FindVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
Find a vehicle from a specific location.
void UpdateCompanyRoadInfrastructure(RoadType rt, Owner o, int count)
Update road infrastructure counts for a company.
@ RTO_Y
Piece of rail in Y direction.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function()
bool HasRailCatenaryDrawn(RailType rt)
Test if we should draw rail catenary.
uint8_t disallowed_platforms
Bitmask of number of platforms available for the station.
StationID GetVia() const
Get a station a package can be routed to.
CommandCost CmdRemoveFromRailWaypoint(DoCommandFlag flags, TileIndex start, TileIndex end, bool keep_rail)
Remove a single tile from a waypoint.
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
@ DIAGDIR_END
Used for iterations.
@ WPF_ROAD
This is a road waypoint.
Direction
Defines the 8 directions on the map.
RoadBits GetRoadBits(Tile t, RoadTramType rtt)
Get the present road bits for a specific road type.
BitmapTileArea catchment_tiles
NOSAVE: Set of individual tiles covered by catchment area.
void Merge(LinkGraph *other)
Merge a link graph with another one.
CommandCost CmdRemoveFromRailStation(DoCommandFlag flags, TileIndex start, TileIndex end, bool keep_rail)
Remove a single tile from a rail station.
bool IsBridgeAbove(Tile t)
checks if a bridge is set above the ground of this tile
StringID str
Description of the tile.
@ TRACK_BIT_Y
Y-axis track.
RoadStop * next
Next stop of the given type at this station.
static void ShowRejectOrAcceptNews(const Station *st, CargoTypes cargoes, bool reject)
Add news item for when a station changes which cargoes it accepts.
StationGfx GetTranslatedAirportTileID(StationGfx gfx)
Do airporttile gfx ID translation for NewGRFs.
@ DC_AUTO
don't allow building on structures
TileIndex xy
Base tile of the station.
void AddTrackToSignalBuffer(TileIndex tile, Track track, Owner owner)
Add track to signal update buffer.
Struct containing information relating to NewGRF classes for stations and airports.
Base class for all station-ish types.
uint8_t cached_anim_triggers
NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
bool HasStationInUse(StationID station, bool include_company, CompanyID company)
Tests whether the company's vehicles have this station in orders.
TileArea road_waypoint_area
Tile area the road waypoint part covers.
struct RoadTypeInfo::@29 strings
Strings associated with the rail type.
void SetRoadOwner(Tile t, RoadTramType rtt, Owner o)
Set the owner of a specific road type.
bool IsReversingRoadTrackdir(Trackdir dir)
Checks whether the trackdir means that we are reversing.
@ ROAD_NONE
No road-part is build.
static Pool::IterateWrapper< Aircraft > Iterate(size_t from=0)
Returns an iterable ensemble of all valid vehicles of type T.
uint16_t waypoint_flags
Waypoint flags, see WaypointFlags.
static void SetRoadWaypointRoadside(Tile tile, Roadside s)
Set the decorations of a road waypoint.
Track AxisToTrack(Axis a)
Convert an Axis to the corresponding Track AXIS_X -> TRACK_X AXIS_Y -> TRACK_Y Uses the fact that the...
IndustryLifeType life_type
This is also known as Industry production flag, in newgrf specs.
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...
uint16_t w
The width of the area.
void ErrorUnknownCallbackResult(uint32_t grfid, uint16_t cbid, uint16_t cb_res)
Record that a NewGRF returned an unknown/invalid callback result.
uint32_t RandomRange(uint32_t limit, const std::source_location location=std::source_location::current())
Pick a random number between 0 and limit - 1, inclusive.
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.
void TriggerStationRandomisation(Station *st, TileIndex trigger_tile, StationRandomTrigger trigger, CargoID cargo_type)
Trigger station randomisation.
bool distant_join_stations
allow to join non-adjacent stations
static CommandCost RemoveGenericRoadStop(DoCommandFlag flags, const TileArea &roadstop_area, StationType station_type, bool remove_road)
Remove a tile area of road stop or road waypoints.
uint GetNumHangars() const
Get the number of hangars on this airport.
RoadStopType GetRoadStopType(Tile t)
Get the road stop type of this tile.
virtual const SpriteGroup * Resolve([[maybe_unused]] ResolverObject &object) const
Base sprite group resolver.
const DrawTileSeqStruct * seq
Array of child sprites. Terminated with a terminator entry.
uint8_t cached_roadstop_anim_triggers
NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing sh...
@ ROADSTOP_DRAW_MODE_ROAD
Bay stops: Draw the road itself.
bool adjacent_stations
allow stations to be built directly adjacent to other stations
bool IsStationTileBlocked(Tile t)
Is tile t a blocked tile?
uint16_t max_speed
Maximum speed for vehicles travelling on this road type.
@ FACIL_BUS_STOP
Station with bus stops.
GRFFilePropsBase< NUM_CARGO+3 > grf_prop
Properties related the the grf file.
static void Run(Vehicle *v, bool allow_merge=true, bool is_full_loading=false)
Refresh all links the given vehicle will visit.
Container for cargo from the same location and time.
static debug_inline TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
std::span< const HangarTileTable > depots
Position of the depots on the airports.
uint8_t station_spread
amount a station may spread
Tindex class_index
Class index of this spec, invalid until class is allocated.
int GetTileMaxPixelZ(TileIndex tile)
Get top height of the tile.
static Station * GetIfValid(size_t index)
Returns station if the index is a valid index for this station type.
@ CBM_ROAD_STOP_AVAIL
Availability of road stop in construction window.
struct RailTypeInfo::@23 base_sprites
Struct containing the main sprites.
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_BASE.
@ NF_SMALL
Small news item. (Information window with text and viewport)
bool IsStoppedInDepot() const
Check whether the vehicle is in the depot and stopped.
SpriteID GetCustomStationFoundationRelocation(const StationSpec *statspec, BaseStation *st, TileIndex tile, uint layout, uint edge_info)
Resolve the sprites for custom station foundations.
void MakeRoadNormal(Tile t, RoadBits bits, RoadType road_rt, RoadType tram_rt, TownID town, Owner road, Owner tram)
Make a normal road tile.
void DrawRailCatenary(const TileInfo *ti)
Draws overhead wires and pylons for electric railways.
bool IsShipDestinationTile(TileIndex tile, StationID station)
Test if a tile is a docking tile for the given station.
void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32_t total_offset, uint32_t newgrf_offset, PaletteID default_palette)
Draw tile sprite sequence on tile with railroad specifics.
static const uint NEW_AIRPORTTILE_OFFSET
offset of first newgrf airport tile
CommandCost GetStationAround(TileArea ta, StationID closest_station, CompanyID company, T **st, F filter)
Look for a station owned by the given company around the given tile area.
const DrawTileSeqStruct * GetLayout(PalSpriteID *ground) const
Returns the result spritelayout after preprocessing.
@ VEH_AIRCRAFT
Aircraft vehicle type.
RoadStopType
Types of RoadStops.
@ VETSB_ENTERED_STATION
The vehicle entered a station.
bool IsStationRoadStop(Tile t)
Is the station at t a road station?
CargoID cargo_type
type of cargo this vehicle is carrying
uint max_waiting_cargo
Max cargo from this station waiting at any station.
bool IsValidCargoID(CargoID t)
Test whether cargo type is not INVALID_CARGO.
OrthogonalTileArea & Expand(int rad)
Expand a tile area by rad tiles in each direction, keeping within map bounds.
static constexpr TimerGameTick::Ticks STATION_RATING_TICKS
Cycle duration for updating station rating.
void Append(CargoPacket *cp, StationID next)
Appends the given cargo packet to the range of packets with the same next station.
@ WC_TOWN_VIEW
Town view; Window numbers:
void SetStationTileRandomBits(Tile t, uint8_t random_bits)
Set the random bits for a station tile.
StringID owner_type[4]
Type of each owner.
IndustryType GetIndustryType(Tile tile)
Retrieve the type for this industry.
TrackBits AxisToTrackBits(Axis a)
Maps an Axis to the corresponding TrackBits value.
RoadStop * bus_stops
All the road stops.
@ RVS_IN_DT_ROAD_STOP
The vehicle is in a drive-through road stop.
static const uint ROAD_STOP_TRACKBIT_FACTOR
Multiplier for how many regular track bits a bay stop counts.
uint16_t noise_reached
level of noise that all the airports are generating
int x
X position of the tile in unit coordinates.
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
void Unqueue(LinkGraph *lg)
Remove a link graph from the execution queue.
PaletteID pal
The palette (use PAL_NONE) if not needed)
bool IsInUse() const
Check whether the base station currently is in use; in use means that it is not scheduled for deletio...
static Date date
Current date in days (day counter).
TileIndex tile
Tile index.
@ NT_ACCEPTANCE
A type of cargo is (no longer) accepted.
ConstructionSettings construction
construction of things in-game
@ Pylons
Tile should contain catenary pylons.
SharesMap shares
Shares of flow to be sent via specified station (or consumed locally).
RoadBits GetAllRoadBits(Tile tile)
Get all set RoadBits on the given tile.
Cheat station_rating
Fix station ratings at 100%.
bool IsWithinMapBounds(uint8_t table, TileIndex index) const
Check if the airport would be within the map bounds at the given tile.
@ ROADSIDE_PAVED
Road with paved sidewalks.
bool IsDockTile(Tile t)
Is tile t a dock tile?
const IndustrySpec * GetIndustrySpec(IndustryType thistype)
Accessor for array _industry_specs.
bool IsAnyRoadStop(Tile t)
Is the station at t a road station?
CommandCost CmdRemoveRoadStop(DoCommandFlag flags, TileIndex tile, uint8_t width, uint8_t height, RoadStopType stop_type, bool remove_road)
Remove bus or truck stops.
bool selectgoods
only send the goods to station if a train has been there
uint16_t rail_speed
Speed limit of rail (bridges and track)
uint8_t GetSnowLine()
Get the current snow line, either variable or static.
static debug_inline bool IsTileType(Tile tile, TileType type)
Checks if a tile is a given tiletype.
bool IsRailWaypoint(Tile t)
Is this station tile a rail waypoint?
virtual TileIndex GetOrderStationLocation([[maybe_unused]] StationID station)
Determine the location for the station where the vehicle goes to next.
StringID name
Displayed name of the industry.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
A Stop for a Road Vehicle.
VehicleType type
Type of vehicle.
static CommandCost CheckFlatLandRailStation(TileIndex tile_cur, TileIndex north_tile, int &allowed_z, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, std::vector< Train * > &affected_vehicles, StationClassID spec_class, uint16_t spec_index, uint8_t plat_len, uint8_t numtracks)
Checks if a rail station can be built at the given tile.
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
virtual void UpdateVirtCoord()=0
Update the coordinated of the sign (as shown in the viewport).
const struct GRFFile * grffile
grf file that introduced this entity
static debug_inline uint TileX(TileIndex tile)
Get the X component of a tile.
StringID tramtype
Type of tram on the tile.
StringID name
Tile Subname string, land information on this tile will give you "AirportName (TileSubname)".
void SetAnimationFrame(Tile t, uint8_t frame)
Set a new animation frame.
@ TRACK_Y
Track along the y-axis (north-west to south-east)
@ FACIL_WAYPOINT
Station is a waypoint.
void WatchedCargoCallback(TileIndex tile, CargoTypes trigger_cargoes)
Run watched cargo accepted callback for a house.
static const CargoID NUM_CARGO
Maximum number of cargo types in a game.
bool HasPowerOnRail(RailType enginetype, RailType tiletype)
Checks if an engine of the given RailType got power on a tile with a given RailType.
PersistentStorage * psa
Persistent storage for NewGRF airports.
static uint GetClassCount()
Get the number of allocated classes.
const AirportSpec * GetSpec() const
Get the AirportSpec that from the airport type of this airport.
WaterClass
classes of water (for WATER_TILE_CLEAR water tile type).
static NewGRFClass * Get(Tindex class_index)
Get a particular class.
static const AirportTileSpec * Get(StationGfx gfx)
Retrieve airport tile spec for the given airport tile.
void ShowDepotWindow(TileIndex tile, VehicleType type)
Opens a depot window.
void GetTileArea(TileArea *ta, StationType type) const override
Get the tile area for a given station type.
bool IsCargoInClass(CargoID c, CargoClass cc)
Does cargo c have cargo class cc?
bool(* CMSAMatcher)(TileIndex tile)
Function to check whether the given tile matches some criterion.
@ AIRPLANES
Can planes land on this airport type?
uint8_t type
Type of this airport,.
T * Last()
Get the last vehicle in the chain.
CompanyID exclusivity
which company has exclusivity
constexpr T ClrBit(T &x, const uint8_t y)
Clears a bit in a variable.
bool IsTileOwner(Tile tile, Owner owner)
Checks if a tile belongs to the given owner.
GRFFileProps grf_prop
properties related the the grf file
void SetWindowClassesDirty(WindowClass cls)
Mark all windows of a particular class as dirty (in need of repainting)
void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, WidgetID widget_index)
Mark a particular widget in a particular window as dirty (in need of repainting)
void UpdateAllStationVirtCoords()
Update the virtual coords needed to draw the station sign for all stations.
uint GetSpecCount() const
Get the number of allocated specs within the class.
TropicZone GetTropicZone(Tile tile)
Get the tropic zone.
@ WC_STATION_LIST
Station list; Window numbers:
Order * next
Pointer to next order. If nullptr, end of list.
bool IsAnyRoadStopTile(Tile t)
Is tile t a road stop station?
void ShowWaypointWindow(const Waypoint *wp)
Show the window for the given waypoint.
@ TRACK_X
Track along the x-axis (north-east to south-west)
DiagDirection GetInclinedSlopeDirection(Slope s)
Returns the direction of an inclined slope.
bool HasTileWaterGround(Tile t)
Checks whether the tile has water at the ground.
static Station * GetClosestDeletedStation(TileIndex tile)
Find the closest deleted station of the current company.
uint8_t layout
Airport layout number.
static CommandCost FindJoiningStation(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Station **st)
Find a nearby station that joins this station.
@ GES_RATING
This indicates whether a cargo has a rating at the station.
bool HasVehicleEverTriedLoading() const
Reports whether a vehicle has ever tried to load the cargo at this station.
bool Convert8bitBooleanCallback(const GRFFile *grffile, uint16_t cbid, uint16_t cb_res)
Converts a callback result into a boolean.
static constexpr TimerGameTick::Ticks STATION_ACCEPTANCE_TICKS
Cycle duration for updating station acceptance.
uint Truncate(uint max_move=UINT_MAX, StationCargoAmountMap *cargo_per_source=nullptr)
Truncates where each destination loses roughly the same percentage of its cargo.
uint32_t water
Count of company owned track bits for canals.
std::tuple< Slope, int > GetTileSlopeZ(TileIndex tile)
Return the slope of a given tile inside the map.
uint8_t exclusive_counter
months till the exclusivity expires
@ ROAD_X
Full road along the x-axis (south-west + north-east)
TileArea ship_station
Tile area the ship 'station' part covers.
bool IsAirport(Tile t)
Is this station tile an airport?
SpriteID single_y
single piece of rail in Y direction, without ground
RoadBits AxisToRoadBits(Axis a)
Create the road-part which belongs to the given Axis.
void ChangeShare(StationID st, int flow)
Change share for specified station.
VehicleEnterTileStatus
The returned bits of VehicleEnterTile.
std::array< const struct SpriteGroup *, Tcnt > spritegroup
pointers to the different sprites of the entity
static const AirportSpec * Get(uint8_t type)
Retrieve airport spec for the given airport.
@ FLYING
Vehicle is flying in the air.
CommandCost CmdRenameStation(DoCommandFlag flags, StationID station_id, const std::string &text)
Rename a station.
static TileIndex FindDockLandPart(TileIndex t)
Find the part of a dock that is land-based.
bool road_stop_on_town_road
allow building of drive-through road stops on town owned roads
void MakeDock(Tile t, Owner o, StationID sid, DiagDirection d, WaterClass wc)
Make the given tile a dock tile.
bool IsDriveThroughStopTile(Tile t)
Is tile t a drive through road stop station or waypoint?
uint GetFlowFromVia(StationID from, StationID via) const
Get the flow from a specific station via a specific other station.
uint8_t last_speed
Maximum speed (up to 255) of the last vehicle that tried to load this cargo.
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.
@ AT_OILRIG
Oilrig airport.
Money RailBuildCost(RailType railtype)
Returns the cost of building the specified railtype.
@ RVSB_ROAD_STOP_TRACKDIR_MASK
Only bits 0 and 3 are used to encode the trackdir for road stops.
static uint SizeY()
Get the size of the map along the Y.
@ WC_VEHICLE_ORDERS
Vehicle orders; Window numbers:
GUISettings gui
settings related to the GUI
std::vector< TileFlags > tileflags
List of tile flags.
Train * GetTrainForReservation(TileIndex tile, Track track)
Find the train which has reserved a specific path.
uint16_t refit_cap
Capacity left over from before last refit.
Action 2 sprite layout for houses, industry tiles, objects and airport tiles.
void MakeOilrig(Tile t, StationID sid, WaterClass wc)
Make the given tile an oilrig tile.
void MakeRailStation(Tile t, Owner o, StationID sid, Axis a, uint8_t section, RailType rt)
Make the given tile a rail station tile.
const char * GetName() const
Get the name of this grf.
@ GES_LAST_MONTH
Set when cargo was delivered for final delivery last month.
void UpdateStationAcceptance(Station *st, bool show_msg)
Update the acceptance for a station.
SpriteID GetCustomRailSprite(const RailTypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results)
Get the sprite to draw for the given tile.
std::vector< SpecMapping< StationSpec > > speclist
List of rail station specs of this station.
AnimationInfo animation
Information about the animation.
bool AutoslopeCheckForEntranceEdge(TileIndex tile, int z_new, Slope tileh_new, DiagDirection entrance)
Autoslope check for tiles with an entrance on an edge.
TimerGameCalendar::Date build_date
Date of construction.
@ FACIL_AIRPORT
Station with an airport.
@ EXPENSES_CONSTRUCTION
Construction costs.
uint GetCustomStationSpecIndex(Tile t)
Get the custom station spec for this tile.
static Date date
Current date in days (day counter).
constexpr uint8_t FindFirstBit(T x)
Search the first set bit in a value.
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
@ INDUSTRYLIFE_EXTRACTIVE
Like mines.