diff --git a/changelog.txt b/changelog.txt index 5d959f2472..db438d2c05 100644 --- a/changelog.txt +++ b/changelog.txt @@ -441,7 +441,7 @@ - Fix: [Win32] Some keypress combinations could be handled twice [FS#2206] (r14363) - Fix: The ownership of roadtiles was not properly set for very old savegames (including TTD's) making it impossible to remove some pieces of road [FS#2311] (r14359) - Fix: Desync due to randomly ordered vehicle hash by flooding and road vehicle overtake/following (r14356, r14258) -- Fix: Signs were not updated on company bankrupcy/sell, and thus could have the colour of invalid player (r14348) +- Fix: Signs were not updated on company bankruptcy/sell, and thus could have the colour of invalid player (r14348) - Fix: Delete the RenameSignWindow when 'its' sign is deleted (r14345) - Fix: Signs from old savegames were lost (causing little memory leaks) (r14340) - Fix: When a company was renamed and then manager was renamed before building anything, company name changed (r14328) @@ -549,7 +549,7 @@ - Fix: Clear the memory for the new AI during the loading of a savegame so it does not try to execute commands generated in a different savegame, which could be resulting in the AI trying to give orders to stations that do not exist (r13505) - Fix: Drawing of zoomed out partial sprites could cause deadlocks or crashes (r13502) - Fix: First determine where to *exactly* build a house before asking a NewGRF whether the location is good instead of possibly moving the house a tile after the NewGRF said the location is good (r13489) -- Fix: Track was not removed on company bankrupcy when there was a ship on lower halftile (r13488) +- Fix: Track was not removed on company bankrupcty when there was a ship on lower halftile (r13488) - Fix: Let ships also navigate on half-tile sloped watery rail tiles (r13485) - Fix: Division by zero when one would press 'd' (skip order) when there's no order (r13409) - Fix: Do not crash when resolving vehicle sprite groups with zero sprites (r13397) @@ -1471,7 +1471,7 @@ - Fix: Some keyboard events possibly lost under high CPU load, handle keyboard input in place instead of global variables magic [FS#279] (r7153) - Fix: "Position of Main Toolbar" option is not honored when starting new game or loading saved [FS#172] (r7130) - Fix: Synchronize the engine-renew settings of a player when joining a multiplayer game (r7126) -- Fix: Several errors/glitches related to multiplayer and bankrupcy (mainly server), and non-updated company-information (r7125) +- Fix: Several errors/glitches related to multiplayer and bankrupcty (mainly server), and non-updated company-information (r7125) - Fix: Cloning a vehicle that has been refitted would incur the expense as running costs, not new vehicles [FS#371] (r7115) - Fix: Do not let ships enter partial water tiles under bridges; they will travel up land... (r7110) - Fix: AI tried to build road from the back or side of road stop/depot (r7069) diff --git a/readme.txt b/readme.txt index 9c514c0564..00b18aa796 100644 --- a/readme.txt +++ b/readme.txt @@ -192,8 +192,18 @@ Do NOT copy files included with OpenTTD into "shared" directories (explained in the following sections) as sooner or later you will run into graphical glitches when using other versions of the game. -If you want AIs use the in-game content downloader to download some or download -some from the internet and place them in the ai/ directory. +If you want AIs use the in-game content downloader. If for some reason that is +not possible or you want to use an AI that has not been uploaded to the content +download system download the tar file and place it in the ai/ directory. If the +AI needs libraries you'll have to download those too and put them in the +ai/library/ directory. All AIs and AI Libraries that have been uploaded to +the content download system can be found at http://noai.openttd.org/downloads/ +The AIs and libraries can be found their in the form of .tar.gz packages. +OpenTTD can read inside tar files but it does not extract .tar.gz files by +itself. +To figure out which libraries you need for an AI you have to start the AI and +wait for an error message to pop up. The error message will tell you +"couldn't find library 'lib-name'". Download that library and try again. 4.2) OpenTTD directories ---- ------------------------------- @@ -502,6 +512,7 @@ Thanks to: Richard Kempton (RichK67) - Additional airports, initial TGP implementation Alberto Demichelis - Squirrel scripting language Markus F.X.J. Oberhumer - MiniLZO for loading old savegames + L. Peter Deutsch - MD5 implementation Michael Blunck - For revolutionizing TTD with awesome graphics George - Canal graphics David Dallaston (Pikka) - Tram tracks diff --git a/src/ai/api/ai_rail.cpp b/src/ai/api/ai_rail.cpp index 519d23162a..1c5774d853 100644 --- a/src/ai/api/ai_rail.cpp +++ b/src/ai/api/ai_rail.cpp @@ -221,7 +221,7 @@ /* static */ bool AIRail::RemoveRailTrack(TileIndex tile, RailTrack rail_track) { EnforcePrecondition(false, ::IsValidTile(tile)); - EnforcePrecondition(false, ::IsTileType(tile, MP_RAILWAY) && ::IsPlainRailTile(tile)); + EnforcePrecondition(false, ::IsPlainRailTile(tile) || ::IsLevelCrossingTile(tile)); EnforcePrecondition(false, GetRailTracks(tile) & rail_track); EnforcePrecondition(false, KillFirstBit((uint)rail_track) == 0); @@ -404,7 +404,7 @@ static bool IsValidSignalType(int signal_type) /* static */ bool AIRail::BuildSignal(TileIndex tile, TileIndex front, SignalType signal) { EnforcePrecondition(false, AIMap::DistanceManhattan(tile, front) == 1) - EnforcePrecondition(false, ::IsTileType(tile, MP_RAILWAY) && ::IsPlainRailTile(tile)); + EnforcePrecondition(false, ::IsPlainRailTile(tile)); EnforcePrecondition(false, ::IsValidSignalType(signal)); Track track = INVALID_TRACK; diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp index b170b718f8..e3ddec00e1 100644 --- a/src/disaster_cmd.cpp +++ b/src/disaster_cmd.cpp @@ -626,8 +626,7 @@ static void DisasterTick_Big_Ufo(Vehicle *v) tile_org = tile = RandomTile(); do { - if (IsTileType(tile, MP_RAILWAY) && - IsPlainRailTile(tile) && + if (IsPlainRailTile(tile) && IsHumanCompany(GetTileOwner(tile))) { break; } diff --git a/src/economy.cpp b/src/economy.cpp index b4727cb7a0..199d2bbf72 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -469,6 +469,7 @@ static void CompanyCheckBankrupt(Company *c) /* If the company has money again, it does not go bankrupt */ if (c->money >= 0) { c->quarters_of_bankrupcy = 0; + c->bankrupt_asked = 0; return; } @@ -521,7 +522,7 @@ static void CompanyCheckBankrupt(Company *c) * he/she is no long in control of this company. However... when you * join another company (cheat) the "unowned" company can bankrupt. */ c->bankrupt_asked = MAX_UVALUE(CompanyMask); - c->bankrupt_timeout = 0x456; + free(cni); break; } diff --git a/src/elrail.cpp b/src/elrail.cpp index 69c9dc6e30..432ae60ba3 100644 --- a/src/elrail.cpp +++ b/src/elrail.cpp @@ -116,7 +116,7 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override) */ static TrackBits MaskWireBits(TileIndex t, TrackBits tracks) { - if (!IsTileType(t, MP_RAILWAY) || !IsPlainRailTile(t)) return tracks; + if (!IsPlainRail(t)) return tracks; TrackdirBits neighbour_tdb = TRACKDIR_BIT_NONE; for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) { diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 269bd6ef8e..2f3e6bfa58 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -320,7 +320,7 @@ struct AboutWindow : public Window { " Owen Rudge (orudge) - Forum host, OS/2 port", " Peter Nelson (peter1138) - Spiritual descendant from newGRF gods", " Remko Bijker (Rubidium) - Lead coder and way more", - " Zdenek Sojka (SmatZ) - Bug finder and fixer", + " Zden\xC4\x9Bk Sojka (SmatZ) - Bug finder and fixer", " Thijs Marinussen (Yexo) - AI Framework", "", "Inactive Developers:", @@ -334,23 +334,24 @@ struct AboutWindow : public Window { " Ludvig Strigeus (ludde) - OpenTTD author, main coder (0.1 - 0.3.3)", " Serge Paquet (vurlix) - Assistant project manager, coder (0.1 - 0.3.3)", " Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3.0 - 0.3.6)", - " Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker", + " Benedikt Br\xC3\xBCggemeier (skidd13) - Bug fixer and code reworker", " Patric Stout (TrueLight) - Programmer (0.3 - pre0.7), sys op (active)", "", "Special thanks go out to:", " Josef Drexler - For his great work on TTDPatch", " Marcin Grzegorczyk - For his documentation of TTD internals", " Petr Baudis (pasky) - Many patches, newGRF support", - " Stefan Meißner (sign_de) - For his work on the console", + " Stefan Mei\xC3\x9Fner (sign_de) - For his work on the console", " Simon Sasburg (HackyKid) - Many bugfixes he has blessed us with", " Cian Duffy (MYOB) - BeOS port / manual writing", " Christian Rosentreter (tokai) - MorphOS / AmigaOS port", " Richard Kempton (richK) - additional airports, initial TGP implementation", "", - " Alberto Demichelis - Squirrel scripting language © 2003-2008", - " Markus F.X.J. Oberhumer - (Mini)LZO for loading old savegames © 1996-2002", - " Michael Blunck - Pre-Signals and Semaphores © 2003", - " George - Canal/Lock graphics © 2003-2004", + " Alberto Demichelis - Squirrel scripting language \xC2\xA9 2003-2008", + " Markus F.X.J. Oberhumer - (Mini)LZO for loading old savegames \xC2\xA9 1996-2008", + " L. Peter Deutsch - MD5 implementation \xC2\xA9 1999, 2000, 2002", + " Michael Blunck - Pre-Signals and Semaphores \xC2\xA9 2003", + " George - Canal/Lock graphics \xC2\xA9 2003-2004", " David Dallaston - Tram tracks", " Marcin Grzegorczyk - Foundations for Tracks on Slopes", " All Translators - Who made OpenTTD a truly international game", diff --git a/src/pathfind.cpp b/src/pathfind.cpp index d5f48cde7c..921c9c6841 100644 --- a/src/pathfind.cpp +++ b/src/pathfind.cpp @@ -611,7 +611,7 @@ start_at: /* Not a regular rail tile? * Then we can't use the code below, but revert to more general code. */ - if (!IsTileType(tile, MP_RAILWAY) || !IsPlainRailTile(tile)) { + if (!IsPlainRailTile(tile)) { /* We found a tile which is not a normal railway tile. * Determine which tracks that exist on this tile. */ bits = TrackdirBitsToTrackBits(TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & DiagdirReachesTrackdirs(direction)); diff --git a/src/pbs.cpp b/src/pbs.cpp index 5adccaea6f..a738da913c 100644 --- a/src/pbs.cpp +++ b/src/pbs.cpp @@ -18,7 +18,7 @@ TrackBits GetReservedTrackbits(TileIndex t) switch (GetTileType(t)) { case MP_RAILWAY: if (IsRailWaypoint(t) || IsRailDepot(t)) return GetRailWaypointReservation(t); - if (IsPlainRailTile(t)) return GetTrackReservation(t); + if (IsPlainRail(t)) return GetTrackReservation(t); break; case MP_ROAD: @@ -79,7 +79,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t) switch (GetTileType(tile)) { case MP_RAILWAY: - if (IsPlainRailTile(tile)) return TryReserveTrack(tile, t); + if (IsPlainRail(tile)) return TryReserveTrack(tile, t); if (IsRailWaypoint(tile) || IsRailDepot(tile)) { if (!GetDepotWaypointReservation(tile)) { SetDepotWaypointReservation(tile, true); @@ -139,7 +139,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t) MarkTileDirtyByTile(tile); break; } - if (IsPlainRailTile(tile)) UnreserveTrack(tile, t); + if (IsPlainRail(tile)) UnreserveTrack(tile, t); break; case MP_ROAD: diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index fe454f716d..0cb7e0d8c7 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -118,7 +118,7 @@ static bool CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags TrackBits future; // The track layout we want to build _error_message = STR_1001_IMPOSSIBLE_TRACK_COMBINATION; - if (!IsPlainRailTile(tile)) return false; + if (!IsPlainRail(tile)) return false; /* So, we have a tile with tracks on it (and possibly signals). Let's see * what tracks first */ @@ -321,7 +321,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u case MP_RAILWAY: if (!CheckTileOwnership(tile)) return CMD_ERROR; - if (!IsPlainRailTile(tile)) return CMD_ERROR; + if (!IsPlainRail(tile)) return CMD_ERROR; if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error(STR_1001_IMPOSSIBLE_TRACK_COMBINATION); @@ -481,7 +481,7 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, case MP_RAILWAY: { TrackBits present; - if (!IsPlainRailTile(tile) || + if (!IsPlainRail(tile) || (_current_company != OWNER_WATER && !CheckTileOwnership(tile)) || !EnsureNoTrainOnTrack(tile, track)) { return CMD_ERROR; @@ -825,15 +825,15 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, if (sigtype > SIGTYPE_LAST) return CMD_ERROR; - if (!ValParamTrackOrientation(track) || !IsTileType(tile, MP_RAILWAY) || !EnsureNoTrainOnTrack(tile, track)) + /* You can only build signals on plain rail tiles, and the selected track must exist */ + if (!ValParamTrackOrientation(track) || !IsPlainRailTile(tile) || + !EnsureNoTrainOnTrack(tile, track) || !HasTrack(tile, track)) { return CMD_ERROR; + } /* Protect against invalid signal copying */ if (p2 != 0 && (p2 & SignalOnTrack(track)) == 0) return CMD_ERROR; - /* You can only build signals on plain rail tiles, and the selected track must exist */ - if (!IsPlainRailTile(tile) || !HasTrack(tile, track)) return CMD_ERROR; - if (!CheckTileOwnership(tile)) return CMD_ERROR; { @@ -1047,7 +1047,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin end_tile = p1; if (signal_density == 0 || signal_density > 20) return CMD_ERROR; - if (!IsTileType(tile, MP_RAILWAY) || !IsPlainRailTile(tile)) return CMD_ERROR; + if (!IsPlainRailTile(tile)) return CMD_ERROR; /* for vertical/horizontal tracks, double the given signals density * since the original amount will be too dense (shorter tracks) */ @@ -1172,7 +1172,6 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1 Track track = (Track)GB(p1, 0, 3); if (!ValParamTrackOrientation(track) || - !IsTileType(tile, MP_RAILWAY) || !IsPlainRailTile(tile) || !HasTrack(tile, track) || !EnsureNoTrainOnTrack(tile, track) || @@ -1456,10 +1455,11 @@ static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags) CommandCost ret; if (flags & DC_AUTO) { - if (!IsTileOwner(tile, _current_company)) + if (!IsTileOwner(tile, _current_company)) { return_cmd_error(STR_1024_AREA_IS_OWNED_BY_ANOTHER); + } - if (IsPlainRailTile(tile)) { + if (IsPlainRail(tile)) { return_cmd_error(STR_1008_MUST_REMOVE_RAILROAD_TRACK); } else { return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED); @@ -1890,7 +1890,7 @@ static void DrawTile_Track(TileInfo *ti) _drawtile_track_palette = COMPANY_SPRITE_COLOUR(GetTileOwner(ti->tile)); - if (IsPlainRailTile(ti->tile)) { + if (IsPlainRail(ti->tile)) { TrackBits rails = GetTrackBits(ti->tile); DrawTrackBits(ti, rails); @@ -2060,7 +2060,7 @@ static uint GetSlopeZ_Track(TileIndex tile, uint x, uint y) Slope tileh = GetTileSlope(tile, &z); if (tileh == SLOPE_FLAT) return z; - if (IsPlainRailTile(tile)) { + if (IsPlainRail(tile)) { z += ApplyFoundationToSlope(GetRailFoundation(tileh, GetTrackBits(tile)), &tileh); return z + GetPartialZ(x & 0xF, y & 0xF, tileh); } else { @@ -2070,7 +2070,7 @@ static uint GetSlopeZ_Track(TileIndex tile, uint x, uint y) static Foundation GetFoundation_Track(TileIndex tile, Slope tileh) { - return IsPlainRailTile(tile) ? GetRailFoundation(tileh, GetTrackBits(tile)) : FlatteningFoundation(tileh); + return IsPlainRail(tile) ? GetRailFoundation(tileh, GetTrackBits(tile)) : FlatteningFoundation(tileh); } static void GetAcceptedCargo_Track(TileIndex tile, AcceptedCargo ac) @@ -2096,7 +2096,7 @@ static void TileLoop_Track(TileIndex tile) /* for non-flat track, use lower part of track * in other cases, use the highest part with track */ - if (IsPlainRailTile(tile)) { + if (IsPlainRail(tile)) { TrackBits track = GetTrackBits(tile); Foundation f = GetRailFoundation(slope, track); @@ -2154,7 +2154,7 @@ static void TileLoop_Track(TileIndex tile) break; } - if (!IsPlainRailTile(tile)) return; + if (!IsPlainRail(tile)) return; new_ground = RAIL_GROUND_GRASS; @@ -2176,7 +2176,7 @@ static void TileLoop_Track(TileIndex tile) (rail & TRACK_BIT_X) )) { TileIndex n = tile + TileDiffXY(0, -1); - TrackBits nrail = (IsTileType(n, MP_RAILWAY) && IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE); + TrackBits nrail = (IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE); if (!IsTileType(n, MP_RAILWAY) || !IsTileOwner(n, owner) || @@ -2191,7 +2191,7 @@ static void TileLoop_Track(TileIndex tile) (rail & TRACK_BIT_X) )) { TileIndex n = tile + TileDiffXY(0, 1); - TrackBits nrail = (IsTileType(n, MP_RAILWAY) && IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE); + TrackBits nrail = (IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE); if (!IsTileType(n, MP_RAILWAY) || !IsTileOwner(n, owner) || @@ -2207,7 +2207,7 @@ static void TileLoop_Track(TileIndex tile) (rail & TRACK_BIT_Y) )) { TileIndex n = tile + TileDiffXY(-1, 0); - TrackBits nrail = (IsTileType(n, MP_RAILWAY) && IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE); + TrackBits nrail = (IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE); if (!IsTileType(n, MP_RAILWAY) || !IsTileOwner(n, owner) || @@ -2222,7 +2222,7 @@ static void TileLoop_Track(TileIndex tile) (rail & TRACK_BIT_Y) )) { TileIndex n = tile + TileDiffXY(1, 0); - TrackBits nrail = (IsTileType(n, MP_RAILWAY) && IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE); + TrackBits nrail = (IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE); if (!IsTileType(n, MP_RAILWAY) || !IsTileOwner(n, owner) || @@ -2248,7 +2248,7 @@ set_ground: static TrackStatus GetTileTrackStatus_Track(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) { /* Case of half tile slope with water. */ - if (mode == TRANSPORT_WATER && IsPlainRailTile(tile) && GetRailGroundType(tile) == RAIL_GROUND_WATER) { + if (mode == TRANSPORT_WATER && IsPlainRail(tile) && GetRailGroundType(tile) == RAIL_GROUND_WATER) { TrackBits tb = GetTrackBits(tile); switch (tb) { default: NOT_REACHED(); @@ -2551,7 +2551,7 @@ static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, uint { uint z_old; Slope tileh_old = GetTileSlope(tile, &z_old); - if (IsPlainRailTile(tile)) { + if (IsPlainRail(tile)) { TrackBits rail_bits = GetTrackBits(tile); /* Is there flat water on the lower halftile, that must be cleared expensively? */ bool was_water = (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh_old)); diff --git a/src/rail_map.h b/src/rail_map.h index 195aef9f57..bfdc19f6d6 100644 --- a/src/rail_map.h +++ b/src/rail_map.h @@ -42,12 +42,23 @@ static inline RailTileType GetRailTileType(TileIndex t) * @pre IsTileType(t, MP_RAILWAY) * @return true if and only if the tile is normal rail (with or without signals) */ -static inline bool IsPlainRailTile(TileIndex t) +static inline bool IsPlainRail(TileIndex t) { RailTileType rtt = GetRailTileType(t); return rtt == RAIL_TILE_NORMAL || rtt == RAIL_TILE_SIGNALS; } +/** + * Checks whether the tile is a rail tile or rail tile with signals. + * @param t the tile to get the information from + * @return true if and only if the tile is normal rail (with or without signals) + */ +static inline bool IsPlainRailTile(TileIndex t) +{ + return IsTileType(t, MP_RAILWAY) && IsPlainRail(t); +} + + /** * Checks if a rail tile has signals. * @param t the tile to get the information from diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index cc89dfb7c2..69b113ed93 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -745,7 +745,7 @@ bool AfterLoadGame() for (TileIndex t = 0; t < map_size; t++) { switch (GetTileType(t)) { case MP_RAILWAY: - if (IsPlainRailTile(t)) { + if (IsPlainRail(t)) { /* Swap ground type and signal type for plain rail tiles, so the * ground type uses the same bits as for depots and waypoints. */ uint tmp = GB(_m[t].m4, 0, 4); @@ -1605,7 +1605,7 @@ bool AfterLoadGame() if (IsLevelCrossing(t)) { if (!IsValidCompanyID(GetTileOwner(t))) FixOwnerOfRailTrack(t); } - } else if (IsTileType(t, MP_RAILWAY) && IsPlainRailTile(t)) { + } else if (IsPlainRailTile(t)) { if (!IsValidCompanyID(GetTileOwner(t))) FixOwnerOfRailTrack(t); } } diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index de575f8a36..f540a58343 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -969,7 +969,7 @@ static const OldChunks _company_chunk[] = { OCL_SVAR( OC_UINT8, Company, colour ), OCL_SVAR( OC_UINT8, Company, money_fraction ), OCL_SVAR( OC_UINT8, Company, quarters_of_bankrupcy ), - OCL_SVAR( OC_UINT8, Company, bankrupt_asked ), + OCL_SVAR( OC_FILE_U8 | OC_VAR_U16, Company, bankrupt_asked ), OCL_SVAR( OC_FILE_U32 | OC_VAR_I64, Company, bankrupt_value ), OCL_SVAR( OC_UINT16, Company, bankrupt_timeout ), diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 392a0dfc2d..dbba10639a 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -2705,7 +2705,7 @@ static PBSTileInfo ExtendTrainReservation(const Vehicle *v, TrackBits *new_track } /* Station, depot or waypoint are a possible target. */ - bool target_seen = ft.m_is_station || (IsTileType(ft.m_new_tile, MP_RAILWAY) && !IsPlainRailTile(ft.m_new_tile)); + bool target_seen = ft.m_is_station || (IsTileType(ft.m_new_tile, MP_RAILWAY) && !IsPlainRail(ft.m_new_tile)); if (target_seen || KillFirstBit(ft.m_new_td_bits) != TRACKDIR_BIT_NONE) { /* Choice found or possible target encountered. * On finding a possible target, we need to stop and let the pathfinder handle the diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 5737546442..b8f1c5fb3a 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -394,7 +394,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u break; case MP_RAILWAY: - if (!IsPlainRailTile(tile)) goto not_valid_below; + if (!IsPlainRail(tile)) goto not_valid_below; break; case MP_ROAD: diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index f90a5c4c2a..c7ec9d3541 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -434,7 +434,7 @@ static bool IsWateredTile(TileIndex tile, Direction from) case MP_RAILWAY: if (GetRailGroundType(tile) == RAIL_GROUND_WATER) { - assert(IsPlainRailTile(tile)); + assert(IsPlainRail(tile)); switch (GetTileSlope(tile, NULL)) { case SLOPE_W: return (from == DIR_SE) || (from == DIR_E) || (from == DIR_NE); case SLOPE_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW); @@ -905,7 +905,7 @@ void DoFloodTile(TileIndex target) /* make coast.. */ switch (GetTileType(target)) { case MP_RAILWAY: { - if (!IsPlainRailTile(target)) break; + if (!IsPlainRail(target)) break; FloodVehicles(target); flooded = FloodHalftile(target); break; @@ -962,7 +962,7 @@ static void DoDryUp(TileIndex tile) switch (GetTileType(tile)) { case MP_RAILWAY: - assert(IsPlainRailTile(tile)); + assert(IsPlainRail(tile)); assert(GetRailGroundType(tile) == RAIL_GROUND_WATER); RailGroundType new_ground; diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp index 8953cddfc1..531e548a6f 100644 --- a/src/yapf/follow_track.hpp +++ b/src/yapf/follow_track.hpp @@ -202,7 +202,7 @@ protected: FORCEINLINE bool QueryNewTileTrackStatus() { CPerfStart perf(*m_pPerf); - if (IsRailTT() && GetTileType(m_new_tile) == MP_RAILWAY && IsPlainRailTile(m_new_tile)) { + if (IsRailTT() && IsPlainRailTile(m_new_tile)) { m_new_td_bits = (TrackdirBits)(GetTrackBits(m_new_tile) * 0x101); } else { m_new_td_bits = TrackStatusToTrackdirBits(GetTileTrackStatus(m_new_tile, TT(), m_veh != NULL ? m_veh->u.road.compatible_roadtypes : 0)); diff --git a/src/yapf/yapf_costrail.hpp b/src/yapf/yapf_costrail.hpp index b4792db872..6eefc08c08 100644 --- a/src/yapf/yapf_costrail.hpp +++ b/src/yapf/yapf_costrail.hpp @@ -115,7 +115,7 @@ public: FORCEINLINE int SwitchCost(TileIndex tile1, TileIndex tile2, DiagDirection exitdir) { - if (IsTileType(tile1, MP_RAILWAY) && IsTileType(tile2, MP_RAILWAY) && IsPlainRailTile(tile1) && IsPlainRailTile(tile2)) { + if (IsPlainRailTile(tile1) && IsPlainRailTile(tile2)) { bool t1 = KillFirstBit(GetTrackBits(tile1) & DiagdirReachesTracks(ReverseDiagDir(exitdir))) != TRACK_BIT_NONE; bool t2 = KillFirstBit(GetTrackBits(tile2) & DiagdirReachesTracks(exitdir)) != TRACK_BIT_NONE; if (t1 && t2) return Yapf().PfGetSettings().rail_doubleslip_penalty;