saveload_internal.h File Reference

Declaration of functions used in more save/load files. More...

#include "../strings_type.h"
#include "../company_manager_face.h"
#include "../order_base.h"
#include "../engine_type.h"
#include "saveload.h"

Go to the source code of this file.

Functions

void InitializeOldNames ()
 Initialize the old names table memory.
StringID RemapOldStringID (StringID s)
 Remap a string ID from the old format to the new format.
char * CopyFromOldName (StringID id)
 Copy and convert old custom names to UTF-8.
void ResetOldNames ()
 Free the memory of the old names array.
void FixOldWaypoints ()
 Fix savegames which stored waypoints in their old format.
void AfterLoadWaypoints ()
 Update waypoint graphics id against saved GRFID/localidx.
void AfterLoadVehicles (bool part_of_load)
 Called after load to update coordinates.
void AfterLoadStations ()
void UpdateHousesAndTowns ()
 Check and update town and house values.
void UpdateOldAircraft ()
 need to be called to load aircraft from old version
void SaveViewportBeforeSaveGame ()
void ResetViewportAfterLoadGame ()
void ConvertOldMultiheadToNew ()
 Converts all trains to the new subtype format introduced in savegame 16.2 It also links multiheaded engines or make them forget they are multiheaded if no suitable partner is found.
void ConnectMultiheadedTrains ()
Engine * GetTempDataEngine (EngineID index)
void CopyTempEngineData ()
 Copy data from temporary engine array into the real engine pool.
CompanyManagerFace ConvertFromOldCompanyManagerFace (uint32 face)
 Converts an old company manager's face format to the new company manager's face format.
Order UnpackOldOrder (uint16 packed)
 Unpacks a order from savegames made with TTD(Patch).

Variables

int32 _saved_scrollpos_x
int32 _saved_scrollpos_y
ZoomLevelByte _saved_scrollpos_zoom
SavegameType _savegame_type
 type of savegame we are loading
uint32 _ttdp_version
 version of TTDP savegame (if applicable)


Detailed Description

Declaration of functions used in more save/load files.

Definition in file saveload_internal.h.


Function Documentation

void AfterLoadVehicles ( bool  part_of_load  ) 

Called after load to update coordinates.

So we can set the previous and first pointers while loading.

For instantiating the shared vehicle chain.

Definition at line 240 of file vehicle_sl.cpp.

References AIR_HELICOPTER, CheckSavegameVersion(), CheckSavegameVersionOldStyle(), CheckValidVehicles(), EF_ROAD_TRAM, HasBit(), IsFreeWagon(), IsFrontEngine(), IsNormalAircraft(), IsTrainEngine(), ROADTYPE_ROAD, ROADTYPE_TRAM, RoadTypeToRoadTypes(), TrainConsistChanged(), UpdateAircraftCache(), and VehicleMove().

Referenced by ReloadNewGRFData().

void AfterLoadWaypoints (  ) 

Update waypoint graphics id against saved GRFID/localidx.

This is to ensure the chosen graphics are correct if GRF files are changed.

Definition at line 18 of file waypoint_sl.cpp.

References GetCustomStationSpec(), GetNumCustomStations(), and STAT_CLASS_WAYP.

Referenced by ReloadNewGRFData().

CompanyManagerFace ConvertFromOldCompanyManagerFace ( uint32  face  ) 

Converts an old company manager's face format to the new company manager's face format.

Meaning of the bits in the old face (some bits are used in several times):

  • 4 and 5: chin
  • 6 to 9: eyebrows
  • 10 to 13: nose
  • 13 to 15: lips (also moustache for males)
  • 16 to 19: hair
  • 20 to 22: eye colour
  • 20 to 27: tie, ear rings etc.
  • 28 to 30: glasses
  • 19, 26 and 27: race (bit 27 set and bit 19 equal to bit 26 = black, otherwise white)
  • 31: gender (0 = male, 1 = female)

Parameters:
face the face in the old format
Returns:
the face in the new format

Definition at line 30 of file company_sl.cpp.

References ClampU(), ETHNICITY_BLACK, GB(), GE_WF, GE_WM, GENDER_FEMALE, HasBit(), max(), ScaleCompanyManagerFaceValue(), SetBit(), and SetCompanyManagerFaceBits().

char* CopyFromOldName ( StringID  id  ) 

Copy and convert old custom names to UTF-8.

They were all stored in a 512 by 32 (200 by 24 for TTO) long string array and are now stored with stations, waypoints and other places with names.

Parameters:
id the StringID of the custom name to clone.
Returns:
the clones custom name.

Definition at line 48 of file strings_sl.cpp.

References _old_name_array, _savegame_type, CheckSavegameVersion(), GB(), lastof, SGT_TTO, and Utf8CharLen().

Referenced by WriteValue().

StringID RemapOldStringID ( StringID  s  ) 

Remap a string ID from the old format to the new format.

Parameters:
s StringID that requires remapping
Returns:
translated ID

Definition at line 17 of file strings_sl.cpp.

References IsInsideMM().

Referenced by SlSaveLoadConv().

void ResetOldNames (  ) 

Free the memory of the old names array.

Should be called once the old names have all been converted.

Definition at line 97 of file strings_sl.cpp.

References _old_name_array.

Order UnpackOldOrder ( uint16  packed  ) 

Unpacks a order from savegames made with TTD(Patch).

Parameters:
packed packed order
Returns:
unpacked order

Definition at line 74 of file order_sl.cpp.

References UnpackVersion4Order().

void UpdateHousesAndTowns (  ) 

Check and update town and house values.

Checked are the HouseIDs. Updated are the town population the number of houses per town, the town radius and the max passengers of the town.

Definition at line 23 of file town_sl.cpp.

References GetHouseNorthPart(), GetHouseType(), GetTownByTile(), IncreaseBuildingCount(), IsHouseCompleted(), IsTileType(), MapSize(), MP_HOUSE, and SetHouseType().

Referenced by ReloadNewGRFData().


Generated on Wed Dec 23 20:13:00 2009 for OpenTTD by  doxygen 1.5.6