12 #include "../stdafx.h" 13 #include "../void_map.h" 14 #include "../signs_base.h" 15 #include "../depot_base.h" 17 #include "../gamelog_internal.h" 18 #include "../network/network.h" 19 #include "../network/network_func.h" 20 #include "../gfxinit.h" 21 #include "../viewport_func.h" 22 #include "../industry.h" 23 #include "../clear_map.h" 24 #include "../vehicle_func.h" 25 #include "../string_func.h" 26 #include "../date_func.h" 27 #include "../roadveh.h" 29 #include "../station_base.h" 30 #include "../waypoint_base.h" 31 #include "../roadstop_base.h" 32 #include "../tunnelbridge_map.h" 33 #include "../pathfinder/yapf/yapf_cache.h" 34 #include "../elrail_func.h" 35 #include "../signs_func.h" 36 #include "../aircraft.h" 37 #include "../object_map.h" 38 #include "../object_base.h" 39 #include "../tree_map.h" 40 #include "../company_func.h" 41 #include "../road_cmd.h" 42 #include "../ai/ai.hpp" 43 #include "../ai/ai_gui.hpp" 45 #include "../economy_base.h" 46 #include "../animated_tile_func.h" 47 #include "../subsidy_base.h" 48 #include "../subsidy_func.h" 49 #include "../newgrf.h" 50 #include "../engine_func.h" 51 #include "../rail_gui.h" 52 #include "../core/backup_type.hpp" 53 #include "../smallmap_gui.h" 54 #include "../news_func.h" 55 #include "../order_backup.h" 57 #include "../disaster_vehicle.h" 65 #include "../safeguards.h" 84 if (include_invalid_water_class) {
101 bool has_water =
false;
102 bool has_canal =
false;
103 bool has_river =
false;
112 }
else if (!
IsLock(neighbour)) {
136 if (!has_water && !has_canal && !has_river && include_invalid_water_class) {
141 if (has_river && !has_canal) {
143 }
else if (has_canal || !has_water) {
150 static void ConvertTownOwner()
170 static void UpdateExclusiveRights()
188 static const byte convert_currency[] = {
197 static void UpdateCurrencies()
205 static void UpdateVoidTiles()
213 return rt >= min ? (
RailType)(rt + 1): rt;
243 ResetViewportAfterLoadGame();
246 FOR_ALL_COMPANIES(c) {
263 FOR_ALL_INDUSTRIES(i) {
264 if (i->
psa != NULL) {
270 FOR_ALL_STATIONS(s) {
278 for (std::list<PersistentStorage *>::iterator it = t->psa_list.begin(); it != t->psa_list.end(); ++it) {
304 typedef void (CDECL *SignalHandlerPointer)(int);
305 static SignalHandlerPointer _prev_segfault = NULL;
306 static SignalHandlerPointer _prev_abort = NULL;
307 static SignalHandlerPointer _prev_fpe = NULL;
327 signal(SIGSEGV, _prev_segfault);
328 signal(SIGABRT, _prev_abort);
329 signal(SIGFPE, _prev_fpe);
375 p +=
seprintf(p,
lastof(buffer),
"Loading your savegame caused OpenTTD to crash.\n");
383 "This is most likely caused by a missing NewGRF or a NewGRF that\n" 384 "has been loaded as replacement for a missing NewGRF. OpenTTD\n" 385 "cannot easily determine whether a replacement NewGRF is of a newer\n" 386 "or older version.\n" 387 "It will load a NewGRF with the same GRF ID as the missing NewGRF.\n" 388 "This means that if the author makes incompatible NewGRFs with the\n" 389 "same GRF ID OpenTTD cannot magically do the right thing. In most\n" 390 "cases OpenTTD will load the savegame and not crash, but this is an\n" 392 "Please load the savegame with the appropriate NewGRFs installed.\n" 393 "The missing/compatible NewGRFs are:\n");
400 p +=
seprintf(p,
lastof(buffer),
"NewGRF %08X (checksum %s) not found.\n Loaded NewGRF \"%s\" with same GRF ID instead.\n",
BSWAP32(c->ident.grfid), buf, c->filename);
405 p +=
seprintf(p,
lastof(buffer),
"NewGRF %08X (%s) not found; checksum %s.\n",
BSWAP32(c->ident.grfid), c->filename, buf);
410 "This is probably caused by a corruption in the savegame.\n" 411 "Please file a bug report and attach this savegame.\n");
416 SignalHandlerPointer call = NULL;
418 case SIGSEGV: call = _prev_segfault;
break;
419 case SIGABRT: call = _prev_abort;
break;
420 case SIGFPE: call = _prev_fpe;
break;
421 default: NOT_REACHED();
423 if (call != NULL) call(signum);
481 int entry_x = v->
x_pos;
482 int entry_y = v->
y_pos;
489 default: NOT_REACHED();
491 byte entry_z = GetSlopePixelZ(entry_x, entry_y);
496 byte middle_z = GetSlopePixelZ(middle_x, middle_y);
499 if (middle_z == entry_z)
return 0;
533 if (_cur_tileloop_tile == 0) _cur_tileloop_tile = 1;
545 DEBUG(net, 0,
"The loading savegame was paused due to an error state.");
546 DEBUG(net, 0,
" The savegame cannot be used for multiplayer!");
569 FOR_ALL_STATIONS(st) {
572 for (
TileIndex t = 0; t < map_size; t++) {
574 if (
_m[t].m5 > 7)
continue;
579 assert(dx >= 0 && dy >= 0);
589 for (
TileIndex t = 0; t < map_size; t++) {
591 SB(
_m[t].type, 0, 2,
GB(
_me[t].m6, 0, 2));
592 SB(
_me[t].m6, 0, 2, 0);
594 SB(
_m[t].type, 2, 2,
GB(
_me[t].m6, 6, 2));
595 SB(
_me[t].m6, 6, 2, 0);
597 SB(
_m[t].type, 2, 2, 0);
616 for (
TileIndex t = 0; t < map_size; t++) {
625 FOR_ALL_COMPANIES(c) {
627 if (c->
name != NULL) c->
name_1 = STR_SV_UNNAMED;
633 FOR_ALL_STATIONS(st) {
636 if (st->
name != NULL) st->
string_id = STR_SV_STNAME_FALLBACK;
652 FOR_ALL_STATIONS(st) {
660 FOR_ALL_COMPANIES(c) {
769 FOR_ALL_STATIONS(st) {
782 FOR_ALL_COMPANIES(c) {
836 st = STATION_AIRPORT;
844 }
else if (gfx == 75) {
850 }
else if (gfx == 82) {
854 st = STATION_AIRPORT;
867 SB(
_me[t].m6, 3, 3, st);
874 for (
TileIndex t = 0; t < map_size; t++) {
880 bst->
rect.BeforeAddTile(t, StationRect::ADD_FORCE);
909 case STATION_OILRIG: {
945 for (
TileIndex t = 0; t < map_size; t++) {
975 FOR_ALL_TOWNS(t) UpdateTownMaxPass(t);
982 FOR_ALL_COMPANIES(c) {
1002 for (
TileIndex t = 0; t < map_size; t++) {
1008 uint tmp =
GB(
_m[t].m4, 0, 4);
1009 SB(
_m[t].m4, 0, 4,
GB(
_m[t].m2, 0, 4));
1010 SB(
_m[t].m2, 0, 4, tmp);
1032 for (
TileIndex t = 0; t < map_size; t++) {
1035 SB(
_m[t].m5, 6, 2,
GB(
_m[t].m5, 4, 2));
1039 SB(
_m[t].m4, 0, 4,
GB(
_m[t].m5, 0, 4));
1040 SB(
_m[t].m4, 4, 4, 0);
1041 SB(
_me[t].m6, 2, 4, 0);
1044 SB(
_m[t].m4, 5, 2,
GB(
_m[t].m5, 2, 2));
1072 for (
TileIndex t = 0; t < map_size; t++) {
1076 SB(
_me[t].m7, 5, 1,
GB(
_m[t].m3, 7, 1));
1080 SB(
_me[t].m7, 0, 4,
GB(
_m[t].m3, 0, 4));
1081 SB(
_me[t].m6, 3, 3,
GB(
_m[t].m3, 4, 3));
1082 SB(
_m[t].m3, 0, 4,
GB(
_m[t].m4, 4, 4));
1083 SB(
_m[t].m3, 4, 4,
GB(
_m[t].m5, 0, 4));
1084 SB(
_m[t].m5, 0, 4,
GB(
_m[t].m4, 0, 4));
1088 SB(
_me[t].m7, 0, 5,
GB(
_m[t].m4, 0, 5));
1089 SB(
_me[t].m6, 3, 3,
GB(
_m[t].m3, 4, 3));
1090 SB(
_m[t].m3, 4, 4,
GB(
_m[t].m5, 0, 4));
1091 SB(
_m[t].m5, 0, 1,
GB(
_m[t].m4, 6, 1));
1092 SB(
_m[t].m5, 5, 1,
GB(
_m[t].m4, 5, 1));
1110 SB(
_m[t].m3, 4, 4,
_m[t].m1);
1120 SB(
_me[t].m7, 0, 5, o);
1123 SB(
_me[t].m6, 2, 4,
GB(
_m[t].m2, 4, 4));
1124 SB(
_me[t].m7, 5, 1,
GB(
_m[t].m4, 7, 1));
1137 for (
TileIndex t = 0; t < map_size; t++) {
1170 for (
TileIndex t = 0; t < map_size; t++) {
1196 if (
GB(
_m[t].m5, 3, 2) == 0) {
1213 uint north_south =
GB(
_m[t].m5, 5, 1);
1217 _m[t].
m5 = 1 << 7 | type << 2 | dir;
1261 for (
TileIndex t = 0; t < map_size; t++) {
1314 for (
TileIndex t = 0; t < map_size; t++) {
1332 SB(
_m[t].m4, 4, 4, 0);
1349 FOR_ALL_ROADVEHICLES(rv) {
1356 FOR_ALL_STATIONS(st) {
1369 FOR_ALL_COMPANIES(c) {
1406 for (
TileIndex t = 0; t < map_size; t++) {
1413 FOR_ALL_INDUSTRIES(i) {
1417 for (j = 0; j != 50; j++) PlantRandomFarmField(i);
1427 FOR_ALL_ORDERS(order) {
1446 for (
TileIndex t = 0; t < map_size; t++) {
1451 SB(
_m[t].m5, 3, 2,
GB(
_m[t].m3, 6, 2));
1452 SB(
_m[t].m3, 6, 2, 0);
1483 for (
TileIndex t = 0; t < map_size; t++) {
1486 case GFX_POWERPLANT_SPARKS:
1490 case GFX_OILWELL_ANIMATED_1:
1491 case GFX_OILWELL_ANIMATED_2:
1492 case GFX_OILWELL_ANIMATED_3:
1496 case GFX_COAL_MINE_TOWER_ANIMATED:
1497 case GFX_COPPER_MINE_TOWER_ANIMATED:
1498 case GFX_GOLD_MINE_TOWER_ANIMATED:
1546 for (
TileIndex t = 0; t < map_size; t++) {
1584 FOR_ALL_STATIONS(st) {
1585 std::list<Vehicle *>::iterator iter;
1586 for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end();) {
1608 for (
TileIndex t = 0; t < map_size; t++) {
1612 SB(
_m[t].m2, 4, 4, 0);
1614 SB(
_m[t].m2, 4, 3,
GB(
_m[t].m2, 0, 3));
1622 FOR_ALL_ROADVEHICLES(rv) {
1638 for (
TileIndex t = 0; t < map_size; t++) {
1655 for (
TileIndex t = 0; t < map_size; t++) {
1664 FOR_ALL_STATIONS(st) {
1675 FOR_ALL_INDUSTRIES(i) {
1691 for (
TileIndex t = 0; t < map_size; t++) {
1720 FOR_ALL_ORDERS(order) {
1743 FOR_ALL_COMPANIES(c) {
1744 for (uint i = 0; i < 4; i++) {
1754 for (
TileIndex t = 0; t < map_size; t++) {
1758 case STATION_OILRIG:
1762 SB(
_m[t].m3, 0, 2, 0);
1773 SB(
_m[t].m3, 0, 2, 0);
1788 for (
TileIndex t = 0; t < map_size; t++) {
1810 for (
TileIndex t = 0; t < map_size; t++) {
1819 for (
TileIndex t = 0; t < map_size; t++) {
1887 for (
TileIndex t = 0; t < map_size; t++) {
1890 SB(
_m[t].m3, 5, 1, 0);
1900 FOR_ALL_ROADVEHICLES(v) {
1909 for (
TileIndex t = 0; t < map_size; t++) {
1933 for (
TileIndex t = 0; t < map_size; t++) {
1978 for (
TileIndex t = 0; t < map_size; t++) {
1997 FOR_ALL_STATIONS(st) {
2013 FOR_ALL_COMPANIES(c) {
2018 FOR_ALL_ENGINES(e) {
2030 for (
TileIndex t = 0; t < map_size; t++) {
2042 for (
TileIndex t = 0; t < map_size; t++) {
2058 for (
TileIndex t = 0; t < map_size; t++) {
2065 uint offset =
_m[t].
m3;
2069 SB(
_me[t].m6, 2, 4, 0);
2079 SlError(STR_ERROR_TOO_MANY_OBJECTS);
2123 case 5: layout = 1;
break;
2124 case 0: layout = 2;
break;
2135 FOR_ALL_STATIONS(st) {
2151 FOR_ALL_COMPANIES(c) {
2175 FOR_ALL_STATIONS(st) {
2176 std::list<Vehicle *>::iterator iter;
2177 for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
2194 for (
TileIndex *tile = _animated_tiles.
Begin(); tile < _animated_tiles.
End(); ) {
2199 for (
TileIndex *j = _animated_tiles.
Begin(); !
remove && j < tile; j++) {
2200 remove = *tile == *j;
2230 FOR_ALL_SUBSIDIES(s) {
2268 if (ss != NULL && sd != NULL && ss->
owner == sd->
owner &&
2326 if (t->force_proceed !=
TFP_NONE) {
2335 for (
TileIndex t = 0; t < map_size; t++) {
2345 uint density =
GB(
_m[t].m2, 6, 2);
2346 uint ground =
GB(
_m[t].m2, 4, 2);
2347 uint counter =
GB(
_m[t].m2, 0, 4);
2348 _m[t].
m2 = ground << 6 | density << 4 | counter;
2368 struct AirportTileConversion {
2372 static const AirportTileConversion atc[] = {
2383 for (
TileIndex t = 0; t < map_size; t++) {
2387 for (uint i = 0; i <
lengthof(atc); i++) {
2388 if (old_gfx < atc[i].old_start) {
2392 if (old_gfx < atc[i].old_start + atc[i].num_frames) {
2397 offset += atc[i].num_frames - 1;
2405 FOR_ALL_STATIONS(st) {
2414 for (
TileIndex t = 0; t < map_size; t++) {
2423 FOR_ALL_DEPOTS(d) d->
town_cn = UINT16_MAX;
2458 for (
TileIndex t = 0; t < map_size; t++) {
2462 uint per_proc =
_me[t].
m7;
2464 SB(
_m[t].m3, 5, 1, 0);
2465 SB(
_me[t].m6, 2, 6,
min(per_proc, 63));
2470 uint rand =
_me[t].
m7;
2491 FOR_ALL_OBJECTS(o) {
2498 for (
TileIndex t = 0; t < map_size; t++) {
2553 hidden = frame >= _tunnel_visibility_frame[dir];
2556 hidden = frame <
TILE_SIZE - _tunnel_visibility_frame[dir];
2574 default: NOT_REACHED();
2582 default: NOT_REACHED();
2590 FOR_ALL_ROADVEHICLES(rv) {
2607 if (!
HasBit(t->flags, 5))
continue;
2615 FOR_ALL_COMPANIES(c) {
2746 FOR_ALL_INDUSTRIES(ind) {
2747 assert(ind->
psa != NULL);
2750 bool is_empty =
true;
2751 for (uint i = 0; i <
sizeof(ind->
psa->
storage); i++) {
2769 FOR_ALL_STATIONS(st) {
2774 bool is_empty =
true;
2800 for (
TileIndex t = 0; t < map_size; t++) {
2803 uint fence =
GB(
_m[t].m4, 5, 3);
2807 fence =
GB(
_m[t].m4, 2, 3);
2811 SB(
_m[t].m4, 2, 3, 0);
2812 SB(
_m[t].m4, 5, 3, 0);
2839 _saved_scrollpos_zoom = _saved_scrollpos_zoom + ZOOM_LVL_SHIFT;
2840 _saved_scrollpos_x *= ZOOM_LVL_BASE;
2841 _saved_scrollpos_y *= ZOOM_LVL_BASE;
2851 for (
TileIndex t = 0; t < map_size; t++) {
2857 FOR_ALL_TOWNS(town) {
2864 for (
TileIndex t = 0; t < map_size; t++) {
2884 FOR_ALL_COMPANIES(c) {
2890 extern uint8 _old_diff_level;
2907 for (
TileIndex t = 0; t < map_size; t++) {
2916 extern uint8 _old_units;
2927 for (
TileIndex t = 0; t < map_size; t++) {
2945 FOR_ALL_ROADVEHICLES(v) {
2947 skip_frames.
Clear();
2949 uint prev_tile_skip = 0;
2952 if (u->tile != prev_tile) {
2953 prev_tile_skip = cur_skip;
2954 prev_tile = u->tile;
2956 cur_skip = prev_tile_skip;
2959 uint *this_skip = skip_frames.
Append();
2960 *this_skip = prev_tile_skip;
2966 if (u->frame <= (roadside ? 9 : 5)) *this_skip = cur_skip;
2971 if (u->frame <= (roadside ? 5 : 9)) *this_skip = cur_skip;
2976 if (u->frame <= (roadside ? 4 : 2)) *this_skip = cur_skip;
2983 while (cur_skip > skip_frames[0]) {
2986 for (uint *it = skip_frames.
Begin(); it != skip_frames.
End(); ++it, prev = u, u = u->
Next()) {
2988 if (*it >= cur_skip) IndividualRoadVehicleController(u, prev);
3002 #ifndef DEBUG_DUMP_COMMANDS 3029 FOR_ALL_INDUSTRIES(i) {
3064 int x = s->
x_pos & 0xF;
3065 int y = s->
y_pos & 0xF;
3066 if (x == 8 && y == 8)
continue;
3071 switch (shipdiagdir) {
3072 default: NOT_REACHED();
3082 if ((shipdiagdir == slopediagdir) == second_half) {
3094 for (
TileIndex t = 0; t < map_size; t++) {
3107 AfterLoadLabelMaps();
3141 AfterLoadStations();
CargoID accepts_cargo[INDUSTRY_NUM_INPUTS]
16 accepted cargoes.
bool disable_elrails
when true, the elrails are disabled
Flag for an invalid direction.
TileIndex tile
NOSAVE: Used to identify in the owner of the array in debug output.
void SetupColoursAndInitialWindow()
Initialise the default colours (remaps and the likes), and load the main windows. ...
static TileType GetTileType(TileIndex tile)
Get the tiletype of a given tile.
static const uint TOWN_GROWTH_WINTER
The town only needs this cargo in the winter (any amount)
static void UpdateAfterLoad()
Update all caches after loading a game, changing NewGRF, etc.
VehicleSettings vehicle
options for vehicles
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner)
Change the owner of a tile.
static void Swap(T &a, T &b)
Type safe swap operation.
byte type
Type of this airport,.
Vehicle is stopped by the player.
static const int TOWN_GROWTH_TICKS
cycle duration for towns trying to grow. (this originates from the size of the town array in TTD ...
Source/destination is a town.
uint8 max_heightlevel
maximum allowed heightlevel
static void ResetSignalHandlers()
Resets signal handlers back to original handlers.
static void ClearBridgeMiddle(TileIndex t)
Removes bridges from the given, that is bridges along the X and Y axis.
static uint MapSizeX()
Get the size of the map along the X.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
static void StartNew(CompanyID company, bool rerandomise_ai=true)
Start a new AI company.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
void UpdateNearestTownForRoadTiles(bool invalidate)
Updates cached nearest town for all road tiles.
bool _networking
are we in networking mode?
Default settings for vehicles.
byte production_rate[INDUSTRY_NUM_OUTPUTS]
production rate for each cargo
void CopyTempEngineData()
Copy data from temporary engine array into the real engine pool.
static TransportType GetTunnelBridgeTransportType(TileIndex t)
Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bri...
void UpdateOldAircraft()
need to be called to load aircraft from old version
uint16 town_cn
The N-1th waypoint for this town (consecutive number)
static void SetAnimationFrame(TileIndex t, byte frame)
Set a new animation frame.
static uint MapSizeY()
Get the size of the map along the Y.
static bool IsSavegameVersionBefore(SaveLoadVersion major, byte minor=0)
Checks whether the savegame is below major.
void UpdateTownCargoes(Town *t)
Update cargo acceptance for the complete town.
static void SetTunnelBridgeReservation(TileIndex t, bool b)
Set the reservation state of the rail tunnel/bridge.
const AirportSpec * GetSpec() const
Get the AirportSpec that from the airport type of this airport.
Money old_max_loan_unround
Old: Unrounded max loan.
static byte GetLockPart(TileIndex t)
Get the part of a lock.
static void SetTileOwner(TileIndex tile, Owner owner)
Sets the owner of a tile.
static const byte TOWN_HOUSE_COMPLETED
Simple value that indicates the house has reached the final stage of construction.
char * name
Name of the company if the user changed it.
static void FixOwnerOfRailTrack(TileIndex t)
Tries to change owner of this rail tile to a valid owner.
static void MakeVoid(TileIndex t)
Make a nice void tile ;)
GRFConfig * _grfconfig
First item in list of current GRF set up.
static DiagDirection DirToDiagDir(Direction dir)
Convert a Direction to a DiagDirection.
byte landscape
the landscape we're currently in
IndustryBuildData _industry_builder
In-game manager of industries.
DirectionByte direction
facing
byte size_y
size of airport in y direction
RailType
Enumeration for all possible railtypes.
Non-existing type of vehicle.
void BuildOwnerLegend()
Completes the array for the owned property legend.
static void CDECL HandleSavegameLoadCrash(int signum)
Signal handler used to give a user a more useful report for crashes during the savegame loading proce...
SourceID src
Index of source. Either TownID or IndustryID.
static bool IsAirportTile(TileIndex t)
Is this tile a station tile and an airport tile?
2.0 0.3.0 2.1 0.3.1, 0.3.2
All GRF needed by game are present.
EconomySettings economy
settings to change the economy
Vehicle has finished loading.
void AfterLoadCompanyStats()
Rebuilding of company statistics after loading a savegame.
#define DAYS_TILL_ORIGINAL_BASE_YEAR
The offset in days from the '_date == 0' till 'ConvertYMDToDate(ORIGINAL_BASE_YEAR, 0, 1)'.
Compatible (eg. the same ID, but different checksum) GRF found in at least one case.
static bool IsWater(TileIndex t)
Is it a plain water tile?
void NORETURN SlErrorCorrupt(const char *msg)
Error handler for corrupt savegames.
static Titem * Get(size_t index)
Returns Titem with given index.
static bool IsBridgeTile(TileIndex t)
checks if there is a bridge on this tile
static bool IsInsideMM(const T x, const uint min, const uint max)
Checks if a value is in an interval.
static WaterClass GetWaterClass(TileIndex t)
Get the water class at a tile.
Town * town
Town the object is built in.
OwnerByte founder
Founder of the industry.
byte units_weight
unit system for weight
CompanyByte exclusivity
which company has exclusivity
void SetWaterClassDependingOnSurroundings(TileIndex t, bool include_invalid_water_class)
Makes a tile canal or water depending on the surroundings.
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
The vehicle is in a drive-through road stop.
Year inaugurated_year
Year of starting the company.
byte m7
Primarily used for newgrf support.
void CheckTrainsLengths()
Checks if lengths of all rail vehicles are valid.
uint16 m2
Primarily used for indices to towns, industries and stations.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
uint16 old_max_loan_unround_fract
Old: Fraction of the unrounded max loan.
static void MakeShore(TileIndex t)
Helper function to make a coast tile.
EngineRenewList engine_renew_list
Engine renewals of this company.
uint16 cur_speed
current speed
A tile with road (or tram tracks)
bool road_use_yapf
use YAPF for road
void ReserveTrackUnderConsist() const
Tries to reserve track under whole train consist.
uint32 GetGRFID(uint16 entity_id) const
Gives the GRFID of the file the entity belongs to.
static const ObjectType OBJECT_STATUE
Statue in towns.
static IndustryGfx GetIndustryGfx(TileIndex t)
Get the industry graphics ID for the given industry tile.
Maximal number of cargo types in a game.
Date intro_date
Date of introduction of the engine.
Full road along the x-axis (south-west + north-east)
uint64 inflation_prices
Cumulated inflation of prices since game start; 16 bit fractional part.
SourceID dst
Index of destination. Either TownID or IndustryID.
Tile * _m
Tiles of the map.
The Original PathFinder (only for ships)
void NORETURN SlError(StringID string, const char *extra_msg)
Error handler.
FileToSaveLoad _file_to_saveload
File to save or load in the openttd loop.
Specification of a cargo type.
static TileIndex GetOtherShipDepotTile(TileIndex t)
Get the other tile of the ship depot.
TileIndex dock_tile
The location of the dock.
OrderList * list
Pointer to the order list for this vehicle.
TileIndex dest_tile
Heading for this tile.
CompanyMask bankrupt_asked
which companies were asked about buying it?
uint16 wait_counter
Ticks waiting in front of a signal, ticks being stuck or a counter for forced proceeding through sign...
static bool IsRoadStop(TileIndex t)
Is the station at t a road station?
DistributionTypeByte distribution_mail
distribution type for mail
char * CopyFromOldName(StringID id)
Copy and convert old custom names to UTF-8.
static TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal track bits incidating with that diagdir. ...
Aircraft, helicopters, rotors and their shadows belong to this class.
char * md5sumToString(char *buf, const char *last, const uint8 md5sum[16])
Convert the md5sum to a hexadecimal string representation.
Manual distribution. No link graph calculations are run.
Date build_date
Date of construction.
void ReloadNewGRFData()
Reload all NewGRF files during a running game.
188 26169 FS#5831 Unify RV travel time
uint32 changes
Number of changes in this action.
static uint TileX(TileIndex tile)
Get the X component of a tile.
void AfterLoadStoryBook()
Called after load to trash broken pages.
PathfinderSettings pf
settings for all pathfinders
TileArea train_station
Tile area the train 'station' part covers.
Only used when retrieving move data.
static TileIndex TileAddByDiagDir(TileIndex tile, DiagDirection dir)
Adds a DiagDir to a tile.
byte colour
Colour of the object, for display purpose.
GRFListCompatibility IsGoodGRFConfigList(GRFConfig *grfconfig)
Check if all GRFs in the GRF config from a savegame can be loaded.
void UpdateAllTownVirtCoords()
Update the virtual coords needed to draw the town sign for all towns.
static bool IsExpected(const BaseStation *st)
Helper for checking whether the given station is of this type.
static void AfterLoad()
Savegame conversion for cargopackets.
void Clear()
Remove all items from the list.
void SetRefit(CargoID cargo)
Make this depot/station order also a refit order.
TownLayoutByte town_layout
select town layout,
StationRect rect
NOSAVE: Station spread out rectangle maintained by StationRect::xxx() functions.
byte units_velocity
unit system for velocity
Defines the internal data of a functional industry.
const T * Begin() const
Get the pointer to the first item (const)
DifficultySettings difficulty
settings related to the difficulty
Tindex index
Index of this pool item.
Vehicle is flying in the air.
byte months_of_bankruptcy
Number of months that the company is unable to pay its debts.
Northeast, upper right on your monitor.
char * president_name
Name of the president if the user changed it.
static const int DAY_TICKS
1 day is 74 ticks; _date_fract used to be uint16 and incremented by 885.
SourceTypeByte src_type
Source of subsidised path (ST_INDUSTRY or ST_TOWN)
T * First() const
Get the first vehicle in the chain.
Date last_cargo_accepted_at[INDUSTRY_NUM_INPUTS]
Last day each cargo type was accepted by this industry.
bool forbid_90_deg
forbid trains to make 90 deg turns
Cargo behaves water-like.
Representation of a waypoint.
StationID last_station_visited
The last station we stopped at.
static void SetRailStationReservation(TileIndex t, bool b)
Set the reservation state of the rail station.
#define lastof(x)
Get the last element of an fixed size array.
byte feature
NOSAVE: Used to identify in the owner of the array in debug output.
Simple vector template class.
const byte _tunnel_visibility_frame[DIAGDIR_END]
Frame when a vehicle should be hidden in a tunnel with a certain direction.
void GamelogPrintDebug(int level)
Prints gamelog to debug output.
void SetUnloadType(OrderUnloadFlags unload_type)
Set how the consist must be unloaded.
A game paused because a (critical) error.
uint16 tree_frame_burst
how many trees may, over a short period, be planted?
GRF file was not found in the local cache.
Cargo behaves goods/candy-like.
void AircraftNextAirportPos_and_Order(Aircraft *v)
set the right pos when heading to other airports after takeoff
void GamelogOldver()
Logs loading from savegame without gamelog.
Contains objects such as transmitters and owned land.
RoadTypes GetCompanyRoadtypes(CompanyID company)
Get the road types the given company can build.
static uint FixVehicleInclination(Vehicle *v, Direction dir)
Fixes inclination of a vehicle.
Standard non-electric rails.
static void InitializeWindowsAndCaches()
Initialization of the windows and several kinds of caches.
void ShowAIDebugWindowIfAIError()
Open the AI debug window if one of the AI scripts has crashed.
static bool IsStandardRoadStopTile(TileIndex t)
Is tile t a standard (non-drive through) road stop station?
GRFIdentifier ident
grfid and md5sum to uniquely identify newgrfs
void GetAircraftFlightLevelBounds(const Vehicle *v, int *min, int *max)
Get the 'flight level' bounds, in pixels from 'z_pos' 0 for a particular vehicle for normal flight si...
static bool IsLevelCrossing(TileIndex t)
Return whether a tile is a level crossing.
static void SetWaterClass(TileIndex t, WaterClass wc)
Set the water class at a tile.
RoadType
The different roadtypes we support.
StationCargoList cargo
The cargo packets of cargo waiting in this station.
byte units_force
unit system for force
static bool IsDriveThroughStopTile(TileIndex t)
Is tile t a drive through road stop station?
bool allow_town_roads
towns are allowed to build roads (always allowed when generating world / in SE)
Town * town
The town this station is associated with.
GRFIdentifier grfcompat
ID and new md5sum of changed GRF.
byte units_height
unit system for height
static bool IsClearGround(TileIndex t, ClearGround ct)
Set the type of clear tile.
uint32 max_loan
the maximum initial loan
Year _cur_year
Current year, starting at 0.
uint16 w
The width of the area.
bool infrastructure_maintenance
enable monthly maintenance fee for owner infrastructure
Basic data to distinguish a GRF.
static Train * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
bool IsTileFlat(TileIndex tile, int *h)
Check if a given tile is flat.
uint _gamelog_actions
number of actions
206 PR#7150 Ship/lock movement changes.
CompanySettings settings
settings specific for each company
const T * End() const
Get the pointer behind the last valid item (const)
bool AfterLoadGame()
Perform a (large) amount of savegame conversion magic in order to load older savegames and to fill th...
bool IsNormalAircraft() const
Check if the aircraft type is a normal flying device; eg not a rotor or a shadow. ...
static StationType GetStationType(TileIndex t)
Get the station type of this tile.
StationSettings station
settings related to station management
GoodsEntry goods[NUM_CARGO]
Goods at this station.
static const uint TILE_SIZE
Tile size in world coordinates.
struct GRFConfig * next
NOSAVE: Next item in the linked list.
Direction
Defines the 8 directions on the map.
Do not refit cargo of a vehicle (used in vehicle orders and auto-replace/auto-new).
void UpdateStationAcceptance(Station *st, bool show_msg)
Update the acceptance for a station.
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
TileIndex GetNorthernBridgeEnd(TileIndex t)
Finds the northern end of a bridge starting at a middle tile.
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track)
Use this function to notify YAPF that track layout (or signal configuration) has change.
static Station * From(BaseStation *st)
Converts a BaseStation to SpecializedStation with type checking.
#define FOR_ALL_CARGO_PAYMENTS(var)
Iterate over all cargo payments.
Money profit_last_year
Profit last year << 8, low 8 bits are fract.
byte m1
Primarily used for ownership information.
static bool IsLock(TileIndex t)
Is there a lock on a given water tile?
T * Append(uint to_add=1)
Append an item and return it.
bool _network_dedicated
are we a dedicated server?
Date build_date
Date of construction.
Vehicle * FirstShared() const
Get the first vehicle of this vehicle chain.
Class to backup a specific variable and restore it later.
int GetTileZ(TileIndex tile)
Get bottom height of the tile.
static bool HasStationRail(TileIndex t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint...
uint32 goal[NUM_TE]
Amount of cargo required for the town to grow.
bool freeform_edges
allow terraforming the tiles at the map edges
static bool IsHouseCompleted(TileIndex t)
Get the completion of this house.
Stop at the far end of the platform.
Slope GetTileSlope(TileIndex tile, int *h)
Return the slope of a given tile inside the map.
static const size_t MAX_SIZE
Make template parameter accessible from outside.
byte subtype
subtype (Filled with values from AircraftSubType/DisasterSubType/EffectVehicleType/GroundVehicleSubty...
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...
bool reverse_at_signals
whether to reverse at signals at all
TrackBits
Bitfield corresponding to Track.
Buses, trucks and trams belong to this class.
Fake town GrfSpecFeature for NewGRF debugging (parent scope)
Critical errors, the MessageBox is shown in all cases.
static bool IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x=0, int y=0, const GRFFile *textref_stack_grffile=NULL, uint textref_stack_size=0, const uint32 *textref_stack=NULL)
Display an error message in a window.
void UpdateAirportsNoise()
Recalculate the noise generated by the airports of each town.
Town * ClosestTownFromTile(TileIndex tile, uint threshold)
Return the town closest (in distance or ownership) to a given tile, within a given threshold...
static void SetCrossingReservation(TileIndex t, bool b)
Set the reservation state of the rail crossing.
uint16 this_month_production[INDUSTRY_NUM_OUTPUTS]
stats of this month's production per cargo
void SetDate(Date date, DateFract fract)
Set the date.
static void MakeSea(TileIndex t)
Make a sea tile.
byte acceleration
used by train & aircraft
static TileIndexDiff TileOffsByDiagDir(DiagDirection dir)
Convert a DiagDirection to a TileIndexDiff.
TileIndex xy
town center tile
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
static bool IsBuoy(TileIndex t)
Is tile t a buoy tile?
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
void MakeDefaultName(T *obj)
Set the default name for a depot/waypoint.
TYPE GetValue(uint pos) const
Gets the value from a given position.
static bool _saveload_crash_with_missing_newgrfs
Was the saveload crash because of missing NewGRFs?
The vehicle is in a road stop.
uint32 terraform_limit
Amount of tileheights we can (still) terraform (times 65536).
void SetNonStopType(OrderNonStopFlags non_stop_type)
Set whether we must stop at stations or not.
static bool IsCoast(TileIndex t)
Is it a coast tile?
RoadStop * truck_stops
All the truck stops.
Contains information about one logged action that caused at least one logged change.
This indicates whether a cargo has a rating at the station.
void ConvertOldMultiheadToNew()
Converts all trains to the new subtype format introduced in savegame 16.2 It also links multiheaded e...
PersistentStorage * psa
Persistent storage for NewGRF industries.
DateFract _date_fract
Fractional part of the day.
static Owner GetRoadOwner(TileIndex t, RoadType rt)
Get the owner of a specific road type.
#define FOR_ALL_ORDER_BACKUPS(var)
Iterator over all order backups.
void UpdateAircraftCache(Aircraft *v, bool update_range=false)
Update cached values of an aircraft.
CompanySettings company
default values for per-company settings
Information about GRF, used in the game and (part of it) in savegames.
Vehicle * front
The front vehicle to do the payment of.
void ConsistChanged(ConsistChangeFlags allowed_changes)
Recalculates the cached stuff of a train.
YAPFSettings yapf
pathfinder settings for the yet another pathfinder
static void SetStationGfx(TileIndex t, StationGfx gfx)
Set the station graphics of this tile.
static void SetRoadOwner(TileIndex t, RoadType rt, Owner o)
Set the owner of a specific road type.
int16 ratings[MAX_COMPANIES]
ratings of each company for this town
uint16 this_month_transported[INDUSTRY_NUM_OUTPUTS]
stats of this month's transport per cargo
VehicleDefaultSettings vehicle
default settings for vehicles
byte road_side
the side of the road vehicles drive on
WaterClass
classes of water (for WATER_TILE_CLEAR water tile type).
static bool IsTruckStop(TileIndex t)
Is the station at t a truck stop?
void MoveBuoysToWaypoints()
Perform all steps to upgrade from the old station buoys to the new version that uses waypoints...
static bool HasTownOwnedRoad(TileIndex t)
Checks if given tile has town owned road.
byte units_volume
unit system for volume
Year last_prod_year
last year of production
static TownID GetTownIndex(TileIndex t)
Get the index of which town this house/street is attached to.
bool IsType(OrderType type) const
Check whether this order is of the given type.
The vehicle is in a tunnel and/or bridge.
static Owner GetTileOwner(TileIndex tile)
Returns the owner of a tile.
static DiagDirection ReverseDiagDir(DiagDirection d)
Returns the reverse direction of the given DiagDirection.
void UpdateAllVirtCoords()
Update the viewport coordinates of all signs.
T * Next() const
Get next vehicle in the chain.
ClientSettings _settings_client
The current settings for this game.
byte status
Status of this cargo, see GoodsEntryStatus.
byte snow_line_height
the configured snow line height
static bool HasStationTileRail(TileIndex t)
Has this station tile a rail? In other words, is this station tile a rail station or rail waypoint...
const IndustrySpec * GetIndustrySpec(IndustryType thistype)
Accessor for array _industry_specs.
void DeleteAnimatedTile(TileIndex tile)
Removes the given tile from the animated tile table.
TileIndex location_of_HQ
Northern tile of HQ; INVALID_TILE when there is none.
void LoadStringWidthTable(bool monospace)
Initialize _stringwidth_table cache.
uint32 grfid
GRFID associated to this persistent storage. A value of zero means "default".
static const int GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET
The offset for the drive through parts.
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
Track in the lower corner of the tile (south)
IndustryType GetIndustryType(TileIndex tile)
Retrieve the type for this industry.
202 PR#6867 Increase industry cargo slots to 16 in, 16 out
IndustryType type
type of industry.
uint32 clear_limit
Amount of tiles we can (still) clear (times 65536).
TileExtended * _me
Extended Tiles of the map.
First company, same as owner.
static uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
bool dynamic_engines
enable dynamic allocation of engine data
Station * GetTargetAirportIfValid(const Aircraft *v)
Returns aircraft's target station if v->target_airport is a valid station with airport.
static void SetClearGroundDensity(TileIndex t, ClearGround type, uint density)
Sets ground type and density in one go, also sets the counter to 0.
void FreeChain(bool keep_orderlist=false)
Free a complete order chain.
void UpdateRealOrderIndex()
Skip implicit orders until cur_real_order_index is a non-implicit order.
An object, such as transmitter, on the map.
TileArea location
Location of the industry.
TYPE storage[SIZE]
Memory to for the storage array.
uint16 last_month_production[INDUSTRY_NUM_OUTPUTS]
total units produced per cargo in the last full month
The vehicle is in a depot.
uint32 engine_renew_money
minimum amount of money before autorenew is used
static const uint TILE_HEIGHT
Height of a height level in world coordinate AND in pixels in #ZOOM_LVL_BASE.
CompanyMask company_avail
Bit for each company whether the engine is available for that company.
static bool IsBuoyTile(TileIndex t)
Is tile t a buoy tile?
CargoID produced_cargo[INDUSTRY_NUM_OUTPUTS]
16 production cargo slots
uint16 load_unload_ticks
Ticks to wait before starting next cycle.
const CargoSpec * FindFirstCargoWithTownEffect(TownEffect effect)
Determines the first cargo with a certain town effect.
void GamelogGRFAddList(const GRFConfig *newg)
Logs adding of list of GRFs.
CompanyByte awarded
Subsidy is awarded to this company; INVALID_COMPANY if it's not awarded to anyone.
static void SetSignalStates(TileIndex tile, uint state)
Set the states of the signals (Along/AgainstTrackDir)
Company colour selection; Window numbers:
uint16 max_bridge_length
maximum length of bridges
bool IsFrontEngine() const
Check if the vehicle is a front engine.
static WaterTileType GetWaterTileType(TileIndex t)
Get the water tile type at a tile.
Order * GetFirstOrder() const
Get the first order of the order chain.
TileIndex tile
Current tile index.
Defines the data structure for constructing industry.
CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32 face)
Converts an old company manager's face format to the new company manager's face format.
Grass with a fence and shore or water on the free halftile.
void SetSaveLoadError(StringID str)
Set the error message from outside of the actual loading/saving of the game (AfterLoadGame and friend...
bool is_ai
If true, the company is (also) controlled by the computer (a NoAI program).
The tile has no ownership.
static void SetHouseCompleted(TileIndex t, bool status)
Mark this house as been completed.
void MarkTileDirtyByTile(TileIndex tile, int bridge_level_offset, int tile_height_override)
Mark a tile given by its index dirty for repaint.
PersistentStorage * psa
Persistent storage for NewGRF airports.
static Trackdir DiagDirToDiagTrackdir(DiagDirection diagdir)
Maps a (4-way) direction to the diagonal trackdir that runs in that direction.
const byte _road_stop_stop_frame[]
Table of road stop stop frames, when to stop at a road stop.
DistributionTypeByte distribution_pax
distribution type for passengers
void UpdateAllSignVirtCoords()
Update the coordinates of all signs.
void GamelogGRFCompatible(const GRFIdentifier *newg)
Logs loading compatible GRF (the same ID, but different MD5 hash)
void AfterLoadLinkGraphs()
Spawn the threads for running link graph calculations.
CargoID accepts_cargo[INDUSTRY_NUM_INPUTS]
16 input cargo slots
StationFacilityByte facilities
The facilities that this station has.
uint16 clear_frame_burst
how many tiles may, over a short period, be cleared?
bool renew_keep_length
sell some wagons if after autoreplace the train is longer than before
DiagDirection
Enumeration for diagonal directions.
uint16 incoming_cargo_waiting[INDUSTRY_NUM_INPUTS]
incoming cargo waiting to be processed
#define lengthof(x)
Return the length of an fixed size array.
byte last_speed
Maximum speed (up to 255) of the last vehicle that tried to load this cargo.
PauseModeByte _pause_mode
The current pause mode.
Company * DoStartupNewCompany(bool is_ai, CompanyID company=INVALID_COMPANY)
Create a new company and sets all company variables default values.
IndustryBehaviour behaviour
How this industry will behave, and how others entities can use it.
static uint TileHash(uint x, uint y)
Calculate a hash value from a tile position.
void UpdateHousesAndTowns()
Check and update town and house values.
static T min(const T a, const T b)
Returns the minimum of two values.
void GamelogTestRevision()
Finds out if current revision is different than last revision stored in the savegame.
static bool IsShipDepotTile(TileIndex t)
Is it a ship depot tile?
Helper class to perform the cargo payment.
uint16 ObjectType
Types of objects.
uint8 plane_speed
divisor for speed of aircraft
static DiagDirection GetInclinedSlopeDirection(Slope s)
Returns the direction of an inclined slope.
static void SetBridgeMiddle(TileIndex t, Axis a)
Set that there is a bridge over the given axis.
static const Year ORIGINAL_BASE_YEAR
The minimum starting year/base year of the original TTD.
static DiagDirection GetTunnelBridgeDirection(TileIndex t)
Get the direction pointing to the other end.
static bool IsPlainRailTile(TileIndex t)
Checks whether the tile is a rail tile or rail tile with signals.
byte number_towns
the amount of towns
Vehicle is currently going uphill. (Cached track information for acceleration)
a desert or snow tile, depend on landscape
Vehicle's pathfinder is lost.
RailTypes GetCompanyRailtypes(CompanyID company)
Get the rail types the given company can build.
CargoID cargo_type
Cargo type involved in this subsidy, CT_INVALID for invalid subsidy.
static StationGfx GetStationGfx(TileIndex t)
Get the station graphics of this tile.
void UpdateLevelCrossing(TileIndex tile, bool sound=true)
Sets correct crossing state.
CompanyManagerFace face
Face description of the president.
uint8 plane_crashes
number of plane crashes, 0 = none, 1 = reduced, 2 = normal
Maximum number of companies.
All ships have this type.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
RoadStop * bus_stops
All the road stops.
Year build_year
Year the vehicle has been built.
uint32 tree_limit
Amount of trees we can (still) plant (times 65536).
Transfer all cargo onto the platform.
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
Returns information about trackdirs and signal states.
byte state
State of the airport.
int16 engine_renew_months
months before/after the maximum vehicle age a vehicle should be renewed
#define FOR_ALL_SHIPS(var)
Iterate over all ships.
byte turn_counter
Ticks between each turn to prevent > 45 degree turns.
bool engine_renew
is autorenew enabled
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
static bool HasSignals(TileIndex t)
Checks if a rail tile has signals.
OrderUnloadFlags GetUnloadType() const
How must the consist be unloaded?
ScriptSettings script
settings for scripts
void MoveWaypointsToBaseStations()
Perform all steps to upgrade from the old waypoints to the new version that uses station.
void SetLoadType(OrderLoadFlags load_type)
Set how the consist must be loaded.
#define DEBUG(name, level,...)
Output a line of debugging information.
Struct about subsidies, offered and awarded.
'Train' is either a loco or a wagon.
LoggedAction * _gamelog_action
first logged action
byte units_power
unit system for power
static RoadBits GetCrossingRoadBits(TileIndex tile)
Get the road bits of a level crossing.
TileIndex tile
The base tile of the area.
static uint GetClearDensity(TileIndex t)
Get the density of a non-field clear tile.
OwnerByte owner
The owner of this station.
void StartupEngines()
Start/initialise all our engines.
void ResetOldNames()
Free the memory of the old names array.
uint8 train_slope_steepness
Steepness of hills for trains when using realistic acceleration.
void ShowNewGRFError()
Show the first NewGRF error we can find.
void UpdateAllStationVirtCoords()
Update the virtual coords needed to draw the station sign for all stations.
static Axis DiagDirToAxis(DiagDirection d)
Convert a DiagDirection to the axis.
Cargo behaves passenger-like.
union Vehicle::@47 orders
The orders currently assigned to the vehicle.
Town * CalcClosestTownFromTile(TileIndex tile, uint threshold=UINT_MAX)
Return the town closest to the given tile within threshold.
Bitflag for a wormhole (used for tunnels)
static TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
Determines type of the wormhole and returns its other end.
byte StationGfx
Copy from station_map.h.
Company infrastructure overview; Window numbers:
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
static const uint TOWN_GROWTH_DESERT
The town needs the cargo for growth when on desert (any amount)
static const uint MIN_SNOWLINE_HEIGHT
Minimum snowline height.
void ConnectMultiheadedTrains()
Link front and rear multiheaded engines to each other This is done when loading a savegame...
uint16 growth_rate
town growth rate
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
Vehicle is currently going downhill. (Cached track information for acceleration)
static uint MapSize()
Get the size of the map.
TownEffect town_effect
The effect that delivering this cargo type has on towns. Also affects destination of subsidies...
StationType
Station types.
GamelogActionType at
Type of action.
void SetAircraftPosition(Aircraft *v, int x, int y, int z)
Set aircraft position.
Flag for an invalid track.
static T ClrBit(T &x, const uint8 y)
Clears a bit in a variable.
static RoadTileType GetRoadTileType(TileIndex t)
Get the type of the road tile.
bool IsGroundVehicle() const
Check if the vehicle is a ground vehicle.
uint16 produced_cargo_waiting[INDUSTRY_NUM_OUTPUTS]
amount of cargo produced per cargo
static bool IsRailDepot(TileIndex t)
Is this rail tile a rail depot?
bool IsStationTileBlocked(TileIndex tile)
Check whether a rail station tile is NOT traversable.
Tunnel entry/exit and bridge heads.
DestinationID GetDestination() const
Gets the destination of this order.
186 25833 Objects storage
is built on water (oil rig)
static bool IsRailDepotTile(TileIndex t)
Is this tile rail tile and a rail depot?
Invisible tiles at the SW and SE border.
bool station_noise_level
build new airports when the town noise level is still within accepted limits
static DiagDirection XYNSToDiagDir(Axis xy, uint ns)
Convert an axis and a flag for north/south into a DiagDirection.
void RecomputePrices()
Computes all prices, payments and maximum loan.
int GetTileMaxZ(TileIndex t)
Get top height of the tile inside the map.
static void SetLiftPosition(TileIndex t, byte pos)
Set the position of the lift on this animated house.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
CompanyByte _current_company
Company currently doing an action.
static bool IsShipDepot(TileIndex t)
Is it a water tile with a ship depot on it?
uint32 TileIndex
The index/ID of a Tile.
void FixupTrainLengths()
Fixup old train spacing.
GRFListCompatibility
Status of post-gameload GRF compatibility check.
OwnerByte share_owners[4]
Owners of the 4 shares of the company. INVALID_OWNER if nobody has bought them yet.
static size_t GetNumItems()
Returns number of valid items in the pool.
SourceTypeByte dst_type
Destination of subsidised path (ST_INDUSTRY or ST_TOWN)
A town owns the tile, or a town is expanding.
static const uint64 MAX_INFLATION
Maximum inflation (including fractional part) without causing overflows in int64 price computations...
Date date_of_last_service
Last date the vehicle had a service at a depot.
static void IncTypeCount(ObjectType type)
Increment the count of objects for this type.
StringID name_1
Name of the company if the user did not change it.
bool ship_use_yapf
use YAPF for ships
Information about a aircraft vehicle.
static TreeGround GetTreeGround(TileIndex t)
Returns the groundtype for tree tiles.
bool modified_catchment
different-size catchment areas
At least one GRF couldn't be found (higher priority than GLC_COMPATIBLE)
CargoPayment * cargo_payment
The cargo payment we're currently in.
LoggedChange * change
First logged change in this action.
static HouseID GetHouseType(TileIndex t)
Get the type of this house, which is an index into the house spec array.
static bool IsLevelCrossingTile(TileIndex t)
Return whether a tile is a level crossing tile.
Source/destination is an industry.
StringID president_name_1
Name of the president if the user did not change it.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Only set when a vehicle has entered the stop.
static Direction AxisToDirection(Axis a)
Converts an Axis to a Direction.
void AfterLoadRoadStops()
(Re)building of road stop caches after loading a savegame.
static void MakeClear(TileIndex t, ClearGround g, uint density)
Make a clear tile.
OwnerByte owner
Which company owns the vehicle?
Contains information about one logged change.
uint8 pathfinder_for_trains
the pathfinder to use for trains
uint16 terraform_frame_burst
how many tile heights may, over a short period, be terraformed?
Old-fashioned semaphore signal.
byte size_x
size of airport in x direction
byte height
The height of the northern corner.
RoadTypes avail_roadtypes
Road types available to this company.
TileIndex xy
Base tile of the station.
TileArea location
Location of the object.
void RebuildSubsidisedSourceAndDestinationCache()
Perform a full rebuild of the subsidies cache.
TransportType
Available types of transport.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
uint16 cached_total_length
Length of the whole vehicle (valid only for the first engine).
byte wait_twoway_signal
waitingtime in days before a twoway signal
static ClearGround GetRawClearGround(TileIndex t)
Get the type of clear tile but never return CLEAR_SNOW.
static bool IsOilRig(TileIndex t)
Is tile t part of an oilrig?
ObjectType type
Type of the object.
void AfterLoadVehicles(bool part_of_load)
Called after load to update coordinates.
Growth rate is controlled by GS.
const TileTypeProcs *const _tile_type_procs[16]
Tile callback functions for each type of tile.
VehicleDefaultSettings _old_vds
Used for loading default vehicles settings from old savegames.
uint8 larger_towns
the number of cities to build. These start off larger and grow twice as fast
static const HouseID NEW_HOUSE_OFFSET
Offset for new houses.
static uint MapMaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
static TrackBits TrackStatusToTrackBits(TrackStatus ts)
Returns the present-track-information of a TrackStatus.
static void MakeCanal(TileIndex t, Owner o, uint8 random_bits)
Make a canal tile.
uint64 inflation_payment
Cumulated inflation of cargo paypent since game start; 16 bit fractional part.
Station with train station.
static bool CanAllocateItem(size_t n=1)
Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() ...
Transport by road vehicle.
static const uint16 TOWN_GROWTH_RATE_NONE
Special value for Town::growth_rate to disable town growth.
The vehicle will not stop at any stations it passes except the destination.
static const uint TILE_UNIT_MASK
For masking in/out the inner-tile world coordinate units.
LocaleSettings locale
settings related to used currency/unit system in the current game
static void RecomputeIndustriesNearForAll()
Recomputes Station::industries_near for all stations.
The vehicle is in a road stop.
184 25508 Unit localisation split
byte town_name
the town name generator used for town names
Extended original algorithm (min. 2 distance between roads)
198 PR#6763 Switch town growth rate and counter to actual game ticks
bool larger_town
if this is a larger town and should grow more quickly
char * name
Custom town name. If NULL, the town was not renamed and uses the generated name.
bool _network_server
network-server is active
A Stop for a Road Vehicle.
void GamelogGRFRemove(uint32 grfid)
Logs removal of a GRF.
void InitializeRailGUI()
Resets the rail GUI - sets default railtype to build and resets the signal GUI.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-NULL) Titem.
#define FOR_ALL_AIRCRAFT(var)
Macro for iterating over all aircraft.
static uint TileHeight(TileIndex tile)
Returns the height of a tile.
AbstractFileType abstract_ftype
Abstract type of file (scenario, heightmap, etc).
Proceed till next signal, but ignore being stuck till then. This includes force leaving depots...
uint8 train_acceleration_model
realistic acceleration for trains
Fields are planted around when built (all farms)
uint16 last_month_transported[INDUSTRY_NUM_OUTPUTS]
total units transported per cargo in the last full month
Cargo behaves food/fizzy-drinks-like.
TownLayoutByte layout
town specific road layout
static void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram)
Make a normal road tile.
ConstructionSettings construction
construction of things in-game
static const Year MIN_YEAR
The absolute minimum & maximum years in OTTD.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
VehicleOrderID GetNumOrders() const
Get the number of orders this vehicle has.
#define FOR_ALL_DISASTERVEHICLES(var)
Iterate over disaster vehicles.
static RoadTypes GetRoadTypes(TileIndex t)
Get the present road types of a tile.
192 26700 FS#6066 Fix saving of order backups
uint32 grfid
GRF ID (defined by Action 0x08)
bool IsFreeWagon() const
Check if the vehicle is a free wagon (got no engine in front of it).
static bool IsTunnelTile(TileIndex t)
Is this a tunnel (entrance)?
Airport airport
Tile area the airport covers.
uint8 roadveh_acceleration_model
realistic acceleration for road vehicles
byte running_ticks
Number of ticks this vehicle was not stopped this day.
EngineID engine_type
The type of engine used for this vehicle.
uint8 settings_profile
difficulty profile to set initial settings of scripts, esp. random AIs
RailTypes avail_railtypes
Rail types available to this company.
uint16 vehicle_flags
Used for gradual loading and other miscellaneous things (.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
void Restore()
Restore the variable.
#define FOR_ALL_VEHICLES(var)
Iterate over all vehicles.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
static bool MayHaveBridgeAbove(TileIndex t)
Checks for the possibility that a bridge may be on this tile These are in fact all the tile types on ...
bool AddInflation(bool check_year)
Add monthly inflation.
static void SetFence(TileIndex t, DiagDirection side, uint h)
Sets the type of fence (and whether there is one) for the given border.
GRF file does not exactly match the requested GRF (different MD5SUM), but grfid matches) ...
GameCreationSettings game_creation
settings used during the creation of a game (map)
static bool IsPlainRail(TileIndex t)
Returns whether this is plain rails, with or without signals.
uint AvailableCount() const
Returns sum of cargo still available for loading at the sation.
A tile without any structures, i.e. grass, rocks, farm fields etc.
void GamelogTestMode()
Finds last stored game mode or landscape.
Full road along the y-axis (north-west + south-east)
byte CargoID
Cargo slots to indicate a cargo type within a game.
IndustryType indtype
Industry type to get the name from.
182 25115 FS#5492, r25259, r25296 Goal status
uint8 roadveh_slope_steepness
Steepness of hills for road vehicles when using realistic acceleration.
static uint MapMaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
TreeGround
Enumeration for ground types of tiles with trees.
Pause mode bits when paused for network reasons.
Road vehicle is a tram/light rail vehicle.
byte wait_for_pbs_path
how long to wait for a path reservation.
static uint32 BSWAP32(uint32 x)
Perform a 32 bits endianness bitswap on x.
Owner
Enum for all companies/owners.
void ResetWindowSystem()
Reset the windowing system, by means of shutting it down followed by re-initialization.
byte remaining
Remaining months when this subsidy is valid.
static bool IsDepotTile(TileIndex tile)
Is the given tile a tile with a depot on it?
bool SaveloadCrashWithMissingNewGRFs()
Did loading the savegame cause a crash? If so, were NewGRFs missing?
uint8 md5sum[16]
MD5 checksum of file to distinguish files with the same GRF ID (eg. newer version of GRF) ...
void DeleteInvalidEngineNews()
Remove engine announcements for invalid engines.
Force unloading all cargo onto the platform, possibly not getting paid.
void ConvertFromOldSavegame()
Converts this order from an old savegame's version; it moves all bits to the new location.
byte industry_density
The industry density.
uint8 pathfinder_for_ships
the pathfinder to use for ships
bool rail_use_yapf
use YAPF for rail
byte last_month_pct_transported[INDUSTRY_NUM_OUTPUTS]
percentage transported per cargo in the last full month
static void SetTrackReservation(TileIndex t, TrackBits b)
Sets the reserved track bits of the tile.
static void SetRoadTypes(TileIndex t, RoadTypes rt)
Set the present road types of a tile.
Money profit_this_year
Profit this year << 8, low 8 bits are fract.
bool new_pathfinding_all
use the newest pathfinding algorithm for all
Data for backing up an order of a vehicle so it can be restored after a vehicle is rebuilt in the sam...
static void SetTownIndex(TileIndex t, TownID index)
Set the town index for a road or house tile.
static bool IsDock(TileIndex t)
Is tile t a dock tile?
static Station * Get(size_t index)
Gets station with given index.
Date _date
Current date in days (day counter)
void ResetCompanyLivery(Company *c)
Reset the livery schemes to the company's primary colour.
200 PR#6805 Extend railtypes to 64, adding uint16 to map array.
uint16 h
The height of the area.
static Direction ReverseDir(Direction d)
Return the reverse of a direction.
byte wait_oneway_signal
waitingtime in days before a oneway signal
VehicleOrderID cur_implicit_order_index
The index to the current implicit order.
StationID current_station
The current station.
DistributionTypeByte distribution_default
distribution type for all other goods
Track in the upper corner of the tile (north)
bool allow_town_level_crossings
towns are allowed to build level crossings
StringID string_id
Default name (town area) of station.
uint16 grow_counter
counter to count when to grow, value is smaller than or equal to growth_rate
Declaration of functions used in more save/load files.
The tile/execution is done by "water".
uint8 feeder_payment_share
percentage of leg payment to virtually pay in feeder systems
VehicleOrderID cur_real_order_index
The index to the current real (non-implicit) order.
VehicleTypeByte type
Type of vehicle.
Valid changes while vehicle is driving, and possibly changing tracks.
DistributionTypeByte distribution_armoured
distribution type for armoured cargo class
void SetStopLocation(OrderStopLocation stop_location)
Set where we must stop at the platform.
Base class for all station-ish types.
Axis
Allow incrementing of DiagDirDiff variables.
static const GRFIdentifier * GetOverriddenIdentifier(const GRFConfig *c)
Try to find the overridden GRF identifier of the given GRF.
static bool IsRoadDepot(TileIndex t)
Return whether a tile is a road depot.
static const ObjectType OBJECT_HQ
HeadQuarter of a player.
LinkGraphSettings linkgraph
settings for link graph calculations
Used for industry tiles on land (also for oilrig if newgrf says so).
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
static RailType GetRailType(TileIndex t)
Gets the rail type of the given tile.
Order current_order
The current order (+ status, like: loading)
static bool IsBridge(TileIndex t)
Checks if this is a bridge, instead of a tunnel.
static Direction DiagDirToDir(DiagDirection dir)
Convert a DiagDirection to a Direction.
#define FOR_ALL_WAYPOINTS(var)
Iterate over all waypoints.
Date build_date
Date of construction.
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
static void SetTropicZone(TileIndex tile, TropicZone type)
Set the tropic zone.
GroundVehicleCache gcache
Cache of often calculated values.
4.0 1 4.1 122 0.3.3, 0.3.4 4.2 1222 0.3.5 4.3 1417 4.4 1426
CompanyMask have_ratings
which companies have a rating
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
uint16 town_cn
The N-1th depot for this town (consecutive number)
static void SetSignalHandlers()
Replaces signal handlers of SIGSEGV and SIGABRT and stores pointers to original handlers in memory...
static void SetRailType(TileIndex t, RailType r)
Sets the rail type of the given tile.
void GfxLoadSprites()
Initialise and load all the sprites.
SmallVector< TileIndex, 256 > _animated_tiles
The table/list with animated tiles.
uint16 max_tunnel_length
maximum length of tunnels
void Reset()
Completely reset the industry build data.
uint8 pathfinder_for_roadvehs
the pathfinder to use for roadvehicles
byte currency
currency we currently use
bool SettingsDisableElrail(int32 p1)
_settings_game.disable_elrail callback
uint8 max_train_length
maximum length for trains
static void SetDepotReservation(TileIndex t, bool b)
Set the reservation state of the depot.
static Station * GetIfValid(size_t index)
Returns station if the index is a valid index for this station type.