afterload.cpp File Reference

Code updating data after game load. More...

#include "../stdafx.h"
#include "../void_map.h"
#include "../signs_base.h"
#include "../depot_base.h"
#include "../window_func.h"
#include "../fios.h"
#include "../gamelog_internal.h"
#include "../network/network.h"
#include "../gfxinit.h"
#include "../viewport_func.h"
#include "../industry.h"
#include "../clear_map.h"
#include "../vehicle_func.h"
#include "../string_func.h"
#include "../date_func.h"
#include "../roadveh.h"
#include "../train.h"
#include "../station_base.h"
#include "../waypoint_base.h"
#include "../roadstop_base.h"
#include "../tunnelbridge_map.h"
#include "../pathfinder/yapf/yapf_cache.h"
#include "../elrail_func.h"
#include "../signs_func.h"
#include "../aircraft.h"
#include "../object_map.h"
#include "../object_base.h"
#include "../tree_map.h"
#include "../company_func.h"
#include "../road_cmd.h"
#include "../ai/ai.hpp"
#include "../ai/ai_gui.hpp"
#include "../town.h"
#include "../economy_base.h"
#include "../animated_tile_func.h"
#include "../subsidy_base.h"
#include "../subsidy_func.h"
#include "../newgrf.h"
#include "../engine_func.h"
#include "../rail_gui.h"
#include "../core/backup_type.hpp"
#include "../smallmap_gui.h"
#include "../news_func.h"
#include "table/strings.h"
#include "saveload_internal.h"
#include <signal.h>

Go to the source code of this file.

Typedefs

typedef void(CDECL * SignalHandlerPointer )(int)

Functions

CompanyDoStartupNewCompany (bool is_ai, CompanyID company=INVALID_COMPANY)
 Create a new company and sets all company variables default values.
void SetWaterClassDependingOnSurroundings (TileIndex t, bool include_invalid_water_class)
 Makes a tile canal or water depending on the surroundings.
static void ConvertTownOwner ()
static void UpdateExclusiveRights ()
static void UpdateCurrencies ()
static void UpdateVoidTiles ()
static RailType UpdateRailType (RailType rt, RailType min)
void UpdateAllVirtCoords ()
 Update the viewport coordinates of all signs.
static void InitializeWindowsAndCaches ()
 Initialization of the windows and several kinds of caches.
static void CDECL HandleSavegameLoadCrash (int signum)
 Signal handler used to give a user a more useful report for crashes during the savegame loading process; especially when there's problems with the NewGRFs that are required by the savegame.
static void SetSignalHandlers ()
 Replaces signal handlers of SIGSEGV and SIGABRT and stores pointers to original handlers in memory.
static void ResetSignalHandlers ()
 Resets signal handlers back to original handlers.
static const GRFIdentifierGetOverriddenIdentifier (const GRFConfig *c)
 Try to find the overridden GRF identifier of the given GRF.
bool SaveloadCrashWithMissingNewGRFs ()
 Did loading the savegame cause a crash? If so, were NewGRFs missing?
static void FixOwnerOfRailTrack (TileIndex t)
 Tries to change owner of this rail tile to a valid owner.
static uint FixVehicleInclination (Vehicle *v, Direction dir)
 Fixes inclination of a vehicle.
bool AfterLoadGame ()
 Perform a (large) amount of savegame conversion *magic* in order to load older savegames and to fill the caches for various purposes.
void ReloadNewGRFData ()
 Reload all NewGRF files during a running game.

Variables

StringID _switch_mode_errorstr
static const byte convert_currency []
static SignalHandlerPointer _prev_segfault = NULL
static SignalHandlerPointer _prev_abort = NULL
static SignalHandlerPointer _prev_fpe = NULL
static bool _saveload_crash_with_missing_newgrfs = false
 Was the saveload crash because of missing NewGRFs?

Detailed Description

Code updating data after game load.

Definition in file afterload.cpp.


Function Documentation

bool AfterLoadGame (  ) 

Perform a (large) amount of savegame conversion *magic* in order to load older savegames and to fill the caches for various purposes.

Returns:
True iff conversion went without a problem.

Definition at line 482 of file afterload.cpp.

References _animated_tile_count, _animated_tile_list, _cur_year, _current_company, _date, _grfconfig, _industry_builder, _m, _me, _network_dedicated, _network_server, _networking, _old_vds, _pause_mode, _road_stop_stop_frame, _settings_client, _settings_game, _tile_type_procs, _tunnel_visibility_frame, Vehicle::acceleration, IndustrySpec::accepts_cargo, Industry::accepts_cargo, AddInflation(), AfterLoadRoadStops(), AfterLoadVehicles(), AIR_AIRCRAFT, AircraftNextAirportPos_and_Order(), Station::airport, EconomySettings::allow_town_roads, AT_OILRIG, CompanyProperties::avail_railtypes, Company::avail_roadtypes, Subsidy::awarded, AXIS_X, AXIS_Y, AxisToDirection(), CompanyProperties::bankrupt_asked, IndustrySpec::behaviour, Depot::build_date, Object::build_date, BaseStation::build_date, Vehicle::build_year, Station::bus_stops, GroundVehicleCache::cached_total_length, CalcClosestTownFromTile(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_cargo_payment_pool >::CanAllocateItem(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_object_pool >::CanAllocateItem(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_roadstop_pool >::CanAllocateItem(), GoodsEntry::cargo, Vehicle::cargo_payment, Subsidy::cargo_type, CeilDiv(), ChangeTileOwner(), Clamp(), CLEAR_FIELDS, ConstructionSettings::clear_frame_burst, CLEAR_GRASS, CompanyProperties::clear_limit, CLEAR_SNOW, ClearBridgeMiddle(), ClosestTownFromTile(), ClrBit(), Object::colour, ClientSettings::company, COMPANY_FIRST, ConnectMultiheadedTrains(), Train::ConsistChanged(), GameSettings::construction, ConvertFromOldCompanyManagerFace(), Order::ConvertFromOldSavegame(), ConvertOldMultiheadToNew(), CopyFromOldName(), CopyTempEngineData(), CargoList< Tinst >::Count(), CT_NO_REFIT, Vehicle::cur_auto_order_index, Vehicle::cur_real_order_index, Vehicle::cur_speed, Vehicle::current_order, CargoPayment::current_station, Vehicle::date_of_last_service, DAY_TICKS, DAYS_TILL_ORIGINAL_BASE_YEAR, DEBUG, DeleteAnimatedTile(), Vehicle::dest_tile, DIAGDIR_END, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, DiagDirToAxis(), DiagDirToDiagTrackBits(), DiagDirToDiagTrackdir(), DiagDirToDir(), GameSettings::difficulty, Vehicle::direction, DirToDiagDir(), VehicleSettings::disable_elrails, Station::dock_tile, DoStartupNewCompany(), Subsidy::dst, Subsidy::dst_type, VehicleSettings::dynamic_engines, GameSettings::economy, EF_ROAD_TRAM, CompanySettings::engine_renew, Company::engine_renew_list, CompanySettings::engine_renew_money, CompanySettings::engine_renew_months, Vehicle::engine_type, CompanyProperties::face, FACIL_DOCK, FACIL_TRAIN, BaseStation::facilities, SpecializedVehicle< T, Type >::First(), Vehicle::FirstShared(), FixOwnerOfRailTrack(), FixVehicleInclination(), FLYING, FOR_ALL_AIRCRAFT, FOR_ALL_DISASTERVEHICLES, FOR_ALL_VEHICLES, Industry::founder, OrderList::FreeChain(), ConstructionSettings::freeform_edges, SpecializedVehicle< RoadVehicle, Type >::From(), SpecializedVehicle< Train, Type >::From(), SpecializedStation< Station, false >::From(), CargoPayment::front, GameSettings::game_creation, GamelogGRFAddList(), GamelogGRFCompatible(), GamelogGRFRemove(), GamelogOldver(), GamelogPrintDebug(), GamelogTestMode(), GamelogTestRevision(), GB(), GroundVehicle< T, Type >::gcache, GCF_COMPATIBLE, GCS_NOT_FOUND, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), CargoSpec::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_town_pool >::Get(), SpecializedStation< Station, false >::Get(), GetAircraftFlyingAltitude(), SpecializedStation< Waypoint, true >::GetByTile(), SpecializedStation< Station, false >::GetByTile(), BaseStation::GetByTile(), GetClearDensity(), GetCompanyRailtypes(), GetCompanyRoadtypes(), Order::GetDestination(), OrderList::GetFirstOrder(), GetHouseType(), SpecializedStation< Station, false >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), GetIndustryGfx(), GetIndustrySpec(), GetIndustryType(), GetNorthernBridgeEnd(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_town_pool >::GetNumItems(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_object_pool >::GetNumItems(), Vehicle::GetNumOrders(), GetObjectType(), GetOtherShipDepotTile(), GetOtherTunnelBridgeEnd(), GetRailType(), GetRawClearGround(), GetRoadOwner(), GetRoadTileType(), Airport::GetSpec(), GetStationGfx(), GetStationType(), GetTargetAirportIfValid(), GetTileOwner(), GetTileSlope(), GetTileTrackStatus(), GetTileType(), GetTunnelBridgeDirection(), GetTunnelBridgeTransportType(), Order::GetUnloadType(), GetWaterClass(), GetWaterTileType(), GLC_ALL_GOOD, GLC_COMPATIBLE, GLC_NOT_FOUND, Station::goods, GroundVehicle< T, Type >::gv_flags, TileArea::h, HasBit(), HasSignals(), HasStationRail(), HasTownOwnedRoad(), CompanyProperties::inaugurated_year, Object::IncTypeCount(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::index, Station::indtype, DifficultySettings::industry_density, INDUSTRYBEH_BUILT_ONWATER, INDUSTRYBEH_PLANT_ON_BUILT, Economy::inflation_prices, InitializeRailGUI(), InitializeWindowsAndCaches(), INVALID_COMPANY, INVALID_DIR, INVALID_OWNER, INVALID_STRING_ID, INVALID_TILE, INVALID_TRACK, CompanyProperties::is_ai, IsAirportTile(), IsBridge(), IsBridgeTile(), IsBuoy(), IsBuoyTile(), IsClearGround(), IsDock(), IsDriveThroughStopTile(), SpecializedStation< Station, false >::IsExpected(), GroundVehicle< T, Type >::IsFreeWagon(), Vehicle::IsFrontEngine(), IsGoodGRFConfigList(), Vehicle::IsGroundVehicle(), IsHouseCompleted(), IsInsideMM(), IsLevelCrossing(), IsLevelCrossingTile(), IsLock(), Aircraft::IsNormalAircraft(), IsOilRig(), IsPlainRail(), IsPlainRailTile(), Vehicle::IsPrimaryVehicle(), IsRailDepot(), IsRailDepotTile(), IsRoadDepot(), IsRoadStop(), IsSavegameVersionBefore(), IsShipDepot(), IsStatueTile(), IsTileOwner(), IsTileType(), IsTruckStop(), IsTunnelTile(), Order::IsType(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_industry_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_town_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), IsWater(), EconomySettings::larger_towns, Industry::last_prod_year, Vehicle::last_station_visited, Town::layout, lengthof, Vehicle::list, Vehicle::load_unload_ticks, LoadStringWidthTable(), Object::location, CompanyProperties::location_of_HQ, Tile::m1, Tile::m2, Tile::m3, Tile::m4, Tile::m5, TileExtended::m7, MakeCanal(), MakeClear(), MakeDefaultName(), MakeRoadNormal(), MakeSea(), MakeShore(), MapMaxX(), MapMaxY(), MapSize(), MAX_COMPANIES, MAX_INFLATION, DifficultySettings::max_loan, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::MAX_SIZE, VehicleSettings::max_train_length, MayHaveBridgeAbove(), min(), MoveBuoysToWaypoints(), MoveWaypointsToBaseStations(), MP_CLEAR, MP_HOUSE, MP_INDUSTRY, MP_OBJECT, MP_RAILWAY, MP_ROAD, MP_STATION, MP_TREES, MP_TUNNELBRIDGE, MP_VOID, MP_WATER, BaseStation::name, CompanyProperties::name, CompanyProperties::name_1, PathfinderSettings::new_pathfinding_all, GRFConfig::next, NUM_CARGO, DifficultySettings::number_towns, OBJECT_HQ, OBJECT_STATUE, Economy::old_max_loan_unround, Economy::old_max_loan_unround_fract, OLFB_NO_LOAD, ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, Vehicle::orders, ORIGINAL_BASE_YEAR, OSL_PLATFORM_FAR_END, OUFB_TRANSFER, OUFB_UNLOAD, BaseStation::owner, OWNER_NONE, OWNER_TOWN, OWNER_WATER, PathfinderSettings::pathfinder_for_roadvehs, PathfinderSettings::pathfinder_for_ships, PathfinderSettings::pathfinder_for_trains, GameSettings::pf, PM_PAUSED_ERROR, PM_PAUSED_NORMAL, PM_UNPAUSED, CompanyProperties::president_name, CompanyProperties::president_name_1, Industry::produced_cargo, Vehicle::profit_last_year, Vehicle::profit_this_year, YAPFSettings::rail_use_yapf, RAILTYPE_ELECTRIC, RAILTYPE_RAIL, RATING_INITIAL, Town::ratings, BaseStation::rect, Subsidy::remaining, CompanySettings::renew_keep_length, Train::ReserveTrackUnderConsist(), IndustryBuildData::Reset(), ResetCompanyLivery(), ResetOldNames(), ResetSignalHandlers(), Backup< T >::Restore(), PathfinderSettings::reverse_at_signals, ReverseDiagDir(), ReverseDir(), VehicleSettings::road_side, ROAD_TILE_CROSSING, ROAD_TILE_DEPOT, ROAD_TILE_NORMAL, YAPFSettings::road_use_yapf, ROAD_X, ROAD_Y, ROADTYPE_END, ROADTYPE_ROAD, ROADTYPES_ROAD, Vehicle::running_ticks, RVS_DRIVE_SIDE, RVS_ENTERED_STOP, RVS_IN_DT_ROAD_STOP, RVS_IN_ROAD_STOP, RVSB_IN_DEPOT, RVSB_IN_ROAD_STOP, RVSB_WORMHOLE, SB(), SetAircraftPosition(), SetAnimationFrame(), SetBit(), SetBridgeMiddle(), SetClearGroundDensity(), SetCrossingReservation(), SetDate(), SetDepotReservation(), SetFenceSE(), SetFenceSW(), SetHouseCompleted(), SetLiftPosition(), Order::SetLoadType(), Order::SetNonStopType(), SetRailStationReservation(), SetRailType(), Order::SetRefit(), SetRoadOwner(), SetRoadTypes(), SetSaveLoadError(), SetSignalHandlers(), SetSignalStates(), SetStationGfx(), Order::SetStopLocation(), SetTileOwner(), Company::settings, SettingsDisableElrail(), SetTownIndex(), SetTrackReservation(), SetTropicZone(), SetTunnelBridgeReservation(), Order::SetUnloadType(), SetWaterClass(), SetWaterClassDependingOnSurroundings(), CompanyProperties::share_owners, YAPFSettings::ship_use_yapf, SIG_ELECTRIC, SIG_SEMAPHORE, SIGTYPE_COMBO, AirportSpec::size_x, AirportSpec::size_y, SlError(), SlErrorCorrupt(), SLOPE_FLAT, Subsidy::src, Subsidy::src_type, ST_INDUSTRY, ST_TOWN, AI::StartNew(), Aircraft::state, RoadVehicle::state, BaseStation::string_id, Vehicle::subtype, Swap(), TE_FOOD, TE_GOODS, TE_MAIL, TE_PASSENGERS, ConstructionSettings::terraform_frame_burst, CompanyProperties::terraform_limit, TFP_NONE, TFP_STUCK, Vehicle::tile, TileArea::tile, TILE_ADDXY, TILE_SIZE, TILE_UNIT_MASK, TileHash(), TileHeight(), TileX(), TileXY(), TileY(), TL_BETTER_ROADS, TL_RANDOM, BaseStation::town, Object::town, Waypoint::town_cn, Depot::town_cn, CargoSpec::town_effect, TOWN_HOUSE_COMPLETED, EconomySettings::town_layout, GameCreationSettings::town_name, TRACK_BIT_NONE, TRACK_BIT_WORMHOLE, TRACK_BIT_X, TRACK_BIT_Y, TRACK_LOWER, TRACK_UPPER, TRACK_X, TrackStatusToTrackBits(), BaseStation::train_station, TRANSPORT_RAIL, TRANSPORT_ROAD, TREE_GROUND_SNOW_DESERT, TROPICZONE_NORMAL, Station::truck_stops, Aircraft::turn_counter, Industry::type, BaseVehicle::type, Airport::type, UpdateAircraftCache(), UpdateHousesAndTowns(), UpdateLevelCrossing(), UpdateNearestTownForRoadTiles(), UpdateOldAircraft(), Vehicle::UpdateRealOrderIndex(), UpdateStationAcceptance(), VEH_INVALID, VEH_ROAD, VEH_SHIP, VEH_TRAIN, CompanySettings::vehicle, GameSettings::vehicle, Vehicle::vehicle_flags, Vehicle::vehstatus, VF_LOADING_FINISHED, VF_PATHFINDER_LOST, VPF_NPF, VPF_OPF, VPF_YAPF, VS_CRASHED, VS_HIDDEN, VS_STOPPED, TileArea::w, Train::wait_counter, PathfinderSettings::wait_for_pbs_path, PathfinderSettings::wait_oneway_signal, PathfinderSettings::wait_twoway_signal, WATER_CLASS_CANAL, WATER_CLASS_INVALID, WATER_CLASS_RIVER, WATER_CLASS_SEA, Vehicle::x_pos, BaseStation::xy, XYNSToDiagDir(), Vehicle::y_pos, PathfinderSettings::yapf, YapfNotifyTrackLayoutChange(), and Vehicle::z_pos.

Referenced by DoLoad(), and SaveOrLoad().

Company* DoStartupNewCompany ( bool  is_ai,
CompanyID  company = INVALID_COMPANY 
)
static void FixOwnerOfRailTrack ( TileIndex  t  )  [static]

Tries to change owner of this rail tile to a valid owner.

In very old versions it could happen that a rail track had an invalid owner. When conversion isn't possible, track is removed.

Parameters:
t tile to update

Definition at line 400 of file afterload.cpp.

References CLEAR_GRASS, DIAGDIR_BEGIN, DIAGDIR_END, GetCrossingRoadBits(), GetRoadOwner(), GetRoadTypes(), GetTileOwner(), GetTileTrackStatus(), GetTownIndex(), IsLevelCrossingTile(), IsPlainRailTile(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), MakeClear(), MakeRoadNormal(), Vehicle::owner, ReverseDiagDir(), ROADTYPE_ROAD, ROADTYPE_TRAM, SetTileOwner(), TileOffsByDiagDir(), and TRANSPORT_RAIL.

Referenced by AfterLoadGame().

static uint FixVehicleInclination ( Vehicle v,
Direction  dir 
) [static]

Fixes inclination of a vehicle.

Older OpenTTD versions didn't update the bits correctly.

Parameters:
v vehicle
dir vehicle's direction, or # INVALID_DIR if it can be ignored
Returns:
inclination bits to set

Definition at line 447 of file afterload.cpp.

References DIR_NE, DIR_NW, DIR_SE, DIR_SW, HALF_TILE_SIZE, INVALID_DIR, TILE_UNIT_MASK, Vehicle::x_pos, and Vehicle::y_pos.

Referenced by AfterLoadGame().

static const GRFIdentifier* GetOverriddenIdentifier ( const GRFConfig c  )  [static]

Try to find the overridden GRF identifier of the given GRF.

Parameters:
c the GRF to get the 'previous' version of.
Returns:
the GRF identifier or c if none could be found.

Definition at line 306 of file afterload.cpp.

References _gamelog_action, _gamelog_actions, LoggedAction::at, LoggedAction::change, LoggedAction::changes, GLAT_LOAD, GLCT_GRFCOMPAT, LoggedChange::grfcompat, GRFIdentifier::grfid, and GRFConfig::ident.

Referenced by HandleSavegameLoadCrash().

static void CDECL HandleSavegameLoadCrash ( int  signum  )  [static]

Signal handler used to give a user a more useful report for crashes during the savegame loading process; especially when there's problems with the NewGRFs that are required by the savegame.

Parameters:
signum received signal

Definition at line 338 of file afterload.cpp.

References _grfconfig, BSWAP32(), GCF_COMPATIBLE, GCS_NOT_FOUND, GetOverriddenIdentifier(), HasBit(), lastof, GRFIdentifier::md5sum, md5sumToString(), GRFConfig::next, ResetSignalHandlers(), and seprintf().

Referenced by SetSignalHandlers().

static void InitializeWindowsAndCaches (  )  [static]

Initialization of the windows and several kinds of caches.

This is not done directly in AfterLoadGame because these functions require that all saveload conversions have been done. As people tend to add savegame conversion stuff after the intialization of the windows and caches quite some bugs had been made. Moving this out of there is both cleaner and less bug-prone.

Definition at line 233 of file afterload.cpp.

References _cur_year, BuildOwnerLegend(), CheckTrainsLengths(), SmallFiosItem::filetype, FT_SCENARIO, CompanyProperties::inaugurated_year, MIN_YEAR, Station::RecomputeIndustriesNearForAll(), RecomputePrices(), ResetWindowSystem(), SetCachedEngineCounts(), ShowAIDebugWindowIfAIError(), ShowNewGRFError(), UpdateAirportsNoise(), and UpdateAllVirtCoords().

Referenced by AfterLoadGame().

void ReloadNewGRFData (  ) 

Reload all NewGRF files during a running game.

This is a cut-down version of AfterLoadGame(). XXX - We need to reset the vehicle position hash because with a non-empty hash AfterLoadVehicles() will loop infinitely. We need AfterLoadVehicles() to recalculate vehicle data as some NewGRF vehicle sets could have been removed or added and changed statistics

Definition at line 2618 of file afterload.cpp.

References AfterLoadVehicles(), CheckTrainsLengths(), COMPANY_FIRST, DeleteInvalidEngineNews(), InvalidateWindowData(), LoadStringWidthTable(), MarkWholeScreenDirty(), MAX_COMPANIES, RecomputePrices(), SetCachedEngineCounts(), and UpdateHousesAndTowns().

Referenced by ClickChangeClimateCheat(), NewGRFConfirmationCallback(), NewGRFWindow::OnClick(), and EngineOverrideManager::ResetToCurrentNewGRFConfig().

bool SaveloadCrashWithMissingNewGRFs (  ) 

Did loading the savegame cause a crash? If so, were NewGRFs missing?

Returns:
when the saveload crashed due to missing NewGRFs.

Definition at line 327 of file afterload.cpp.

Referenced by HandleCrash().

void SetWaterClassDependingOnSurroundings ( TileIndex  t,
bool  include_invalid_water_class 
)

Makes a tile canal or water depending on the surroundings.

Must only be used for converting old savegames. Use WaterClass now.

This as for example docks and shipdepots do not store whether the tile used to be canal or 'normal' water.

Parameters:
t the tile to change.
include_invalid_water_class Also consider WATER_CLASS_INVALID, i.e. industry tiles on land

Definition at line 75 of file afterload.cpp.

References _m, DIAGDIR_BEGIN, DIAGDIR_END, GB(), GetTileSlope(), GetTileType(), GetWaterClass(), IsCoast(), IsLock(), MapMaxX(), MapMaxY(), MarkTileDirtyByTile(), MP_RAILWAY, MP_TREES, MP_WATER, RAIL_GROUND_WATER, SetWaterClass(), SlErrorCorrupt(), SLOPE_FLAT, TileAddByDiagDir(), TileX(), TileY(), TREE_GROUND_SHORE, WATER_CLASS_CANAL, WATER_CLASS_INVALID, WATER_CLASS_RIVER, and WATER_CLASS_SEA.

Referenced by AfterLoadGame().


Variable Documentation

const byte convert_currency[] [static]
Initial value:
 {
   0,  1, 12,  8,  3,
  10, 14, 19,  4,  5,
   9, 11, 13,  6, 17,
  16, 22, 21,  7, 15,
  18,  2, 20,
}

Definition at line 184 of file afterload.cpp.


Generated on Fri Mar 4 21:37:17 2011 for OpenTTD by  doxygen 1.6.1