![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <fc_config.h>#include <QBitArray>#include <cstdarg>#include <cstdio>#include <cstdlib>#include <cstring>#include <sstream>#include "bitvector.h"#include "fcintl.h"#include "idex.h"#include "log.h"#include "rand.h"#include "registry.h"#include "shared.h"#include "support.h"#include "achievements.h"#include "ai.h"#include "capability.h"#include "citizens.h"#include "city.h"#include "game.h"#include "government.h"#include "map.h"#include "mapimg.h"#include "movement.h"#include "multipliers.h"#include "packets.h"#include "research.h"#include "rgbcolor.h"#include "specialist.h"#include "style.h"#include "unit.h"#include "unitlist.h"#include "version.h"#include "citizenshand.h"#include "citytools.h"#include "cityturn.h"#include "diplhand.h"#include "maphand.h"#include "meta.h"#include "notify.h"#include "plrhand.h"#include "report.h"#include "ruleset.h"#include "sanitycheck.h"#include "savecompat.h"#include "score.h"#include "settings.h"#include "spacerace.h"#include "srv_main.h"#include "techtools.h"#include "unittools.h"#include "advbuilding.h"#include "advdata.h"#include "infracache.h"#include "mapgen_utils.h"#include "script_server.h"#include "aitraits.h"#include "difficulty.h"#include "savegame2.h"Go to the source code of this file.
Macros | |
| #define | SAVE_MAP_CHAR(ptile, GET_XY_CHAR, secfile, secpath, ...) |
| #define | LOAD_MAP_CHAR(ch, ptile, SET_XY_CHAR, secfile, secpath, ...) |
| #define | halfbyte_iterate_extras(e, num_extras_types) |
| #define | halfbyte_iterate_extras_end |
| #define | halfbyte_iterate_special(s, num_specials_types) |
| #define | halfbyte_iterate_special_end |
| #define | halfbyte_iterate_bases(b, num_bases_types) |
| #define | halfbyte_iterate_bases_end |
| #define | halfbyte_iterate_roads(r, num_roads_types) |
| #define | halfbyte_iterate_roads_end |
| #define | TOKEN_SIZE 10 |
Functions | |
| static struct loaddata * | loaddata_new (struct section_file *file) |
| Create new loaddata item for given section file. More... | |
| static void | loaddata_destroy (struct loaddata *loading) |
| Free resources allocated for loaddata item. More... | |
| static enum unit_orders | char2order (char order) |
| Returns an order for a character identifier. More... | |
| static enum direction8 | char2dir (char dir) |
| Returns a direction for a character identifier. More... | |
| static char | activity2char (enum unit_activity activity) |
| Returns a character identifier for an activity. More... | |
| static enum unit_activity | char2activity (char activity) |
| Returns an activity for a character identifier. More... | |
| static int | unquote_block (const char *const quoted_, void *dest, int dest_length) |
| Unquote a string. More... | |
| static void | worklist_load (struct section_file *file, struct worklist *pwl, const char *path,...) |
| Load the worklist elements specified by path to the worklist pointed to by 'pwl'. More... | |
| static void | unit_ordering_apply () |
| For each city and tile, sort unit lists according to ord_city and ord_map values. More... | |
| static void | sg_extras_set (bv_extras *extras, char ch, struct extra_type **idx) |
| Helper function for loading extras from a savegame. More... | |
| static void | sg_special_set (struct tile *ptile, bv_extras *extras, char ch, const enum tile_special_type *idx, bool rivers_overlay) |
| Complicated helper function for loading specials from a savegame. More... | |
| static void | sg_bases_set (bv_extras *extras, char ch, struct base_type **idx) |
| Helper function for loading bases from a savegame. More... | |
| static void | sg_roads_set (bv_extras *extras, char ch, struct road_type **idx) |
| Helper function for loading roads from a savegame. More... | |
| static struct extra_type * | char2resource (char c) |
| Return the resource for the given identifier. More... | |
| static struct terrain * | char2terrain (char ch) |
| Dereferences the terrain character. More... | |
| static Tech_type_id | technology_load (struct section_file *file, const char *path, int plrno) |
| Load technology from path_name and if doesn't exist (because savegame is too old) load from path. More... | |
| static void | sg_load_ruleset (struct loaddata *loading) |
| Set up correct ruleset for the savegame. More... | |
| static void | sg_load_savefile (struct loaddata *loading) |
| Load '[savefile]'. More... | |
| static void | sg_load_game (struct loaddata *loading) |
| Load '[game]'. More... | |
| static void | sg_load_ruledata (struct loaddata *loading) |
| Load '[ruledata]'. More... | |
| static void | sg_load_random (struct loaddata *loading) |
| Load '[random]'. More... | |
| static void | sg_load_script (struct loaddata *loading) |
| Load '[script]'. More... | |
| static void | sg_load_scenario (struct loaddata *loading) |
| Load '[scenario]'. More... | |
| static void | sg_load_settings (struct loaddata *loading) |
| Load '[settings]'. More... | |
| static void | sg_load_map (struct loaddata *loading) |
| Load '[map']. More... | |
| static void | sg_load_map_tiles (struct loaddata *loading) |
| Load tiles of the map. More... | |
| static void | sg_load_map_tiles_extras (struct loaddata *loading) |
| Load extras to map. More... | |
| static void | sg_load_map_tiles_bases (struct loaddata *loading) |
| Load bases to map. More... | |
| static void | sg_load_map_tiles_roads (struct loaddata *loading) |
| Load roads to map. More... | |
| static void | sg_load_map_tiles_specials (struct loaddata *loading, bool rivers_overlay) |
| Load information about specials on map. More... | |
| static void | sg_load_map_tiles_resources (struct loaddata *loading) |
| Load information about resources on map. More... | |
| static void | sg_load_map_startpos (struct loaddata *loading) |
| Load starting positions for the players from a savegame file. More... | |
| static void | sg_load_map_owner (struct loaddata *loading) |
| Load tile owner information. More... | |
| static void | sg_load_map_worked (struct loaddata *loading) |
| Load worked tiles information. More... | |
| static void | sg_load_map_known (struct loaddata *loading) |
| Load tile known status. More... | |
| static void | sg_load_players_basic (struct loaddata *loading) |
| Load '[player]' (basic data). More... | |
| static void | sg_load_players (struct loaddata *loading) |
| Load '[player]'. More... | |
| static void | sg_load_player_main (struct loaddata *loading, struct player *plr) |
| Main player data loading function. More... | |
| static void | sg_load_player_cities (struct loaddata *loading, struct player *plr) |
| Load city data. More... | |
| static bool | sg_load_player_city (struct loaddata *loading, struct player *plr, struct city *pcity, const char *citystr) |
| Load data for one city. More... | |
| static void | sg_load_player_city_citizens (struct loaddata *loading, struct player *plr, struct city *pcity, const char *citystr) |
| Load nationality data for one city. More... | |
| static void | sg_load_player_units (struct loaddata *loading, struct player *plr) |
| Load unit data. More... | |
| static bool | sg_load_player_unit (struct loaddata *loading, struct player *plr, struct unit *punit, const char *unitstr) |
| Load one unit. More... | |
| static void | sg_load_player_units_transport (struct loaddata *loading, struct player *plr) |
| Load the transport status of all units. More... | |
| static void | sg_load_player_attributes (struct loaddata *loading, struct player *plr) |
| Load player (client) attributes data. More... | |
| static void | sg_load_player_vision (struct loaddata *loading, struct player *plr) |
| Load vision data. More... | |
| static bool | sg_load_player_vision_city (struct loaddata *loading, struct player *plr, struct vision_site *pdcity, const char *citystr) |
| Load data for one seen city. More... | |
| static void | sg_load_researches (struct loaddata *loading) |
| Load '[research]'. More... | |
| static void | sg_load_event_cache (struct loaddata *loading) |
| Load '[event_cache]'. More... | |
| static void | sg_load_treaties (struct loaddata *loading) |
| Load '[treaty_xxx]'. More... | |
| static void | sg_load_history (struct loaddata *loading) |
| Load '[history]'. More... | |
| static void | sg_load_mapimg (struct loaddata *loading) |
| Load '[mapimg]'. More... | |
| static void | sg_load_sanitycheck (struct loaddata *loading) |
| Sanity check for loaded game. More... | |
| void | savegame2_load (struct section_file *file) |
| Really loading the savegame. More... | |
Variables | |
| bool | sg_success |
| #define halfbyte_iterate_bases | ( | b, | |
| num_bases_types | |||
| ) |
Definition at line 257 of file savegame2.cpp.
| #define halfbyte_iterate_bases_end |
Definition at line 262 of file savegame2.cpp.
| #define halfbyte_iterate_extras | ( | e, | |
| num_extras_types | |||
| ) |
Definition at line 237 of file savegame2.cpp.
| #define halfbyte_iterate_extras_end |
Definition at line 242 of file savegame2.cpp.
| #define halfbyte_iterate_roads | ( | r, | |
| num_roads_types | |||
| ) |
Definition at line 267 of file savegame2.cpp.
| #define halfbyte_iterate_roads_end |
Definition at line 272 of file savegame2.cpp.
| #define halfbyte_iterate_special | ( | s, | |
| num_specials_types | |||
| ) |
Definition at line 247 of file savegame2.cpp.
| #define halfbyte_iterate_special_end |
Definition at line 252 of file savegame2.cpp.
| #define LOAD_MAP_CHAR | ( | ch, | |
| ptile, | |||
| SET_XY_CHAR, | |||
| secfile, | |||
| secpath, | |||
| ... | |||
| ) |
Definition at line 200 of file savegame2.cpp.
| #define SAVE_MAP_CHAR | ( | ptile, | |
| GET_XY_CHAR, | |||
| secfile, | |||
| secpath, | |||
| ... | |||
| ) |
Definition at line 151 of file savegame2.cpp.
| #define TOKEN_SIZE 10 |
Definition at line 276 of file savegame2.cpp.
|
static |
Returns a character identifier for an activity.
See also char2activity.
Definition at line 578 of file savegame2.cpp.
|
static |
Returns an activity for a character identifier.
See also activity2char.
Definition at line 578 of file savegame2.cpp.
Referenced by sg_load_player_unit().
|
static |
Returns a direction for a character identifier.
Definition at line 485 of file savegame2.cpp.
Referenced by sg_load_player_unit().
|
static |
Returns an order for a character identifier.
Definition at line 485 of file savegame2.cpp.
Referenced by sg_load_player_unit().
|
static |
Return the resource for the given identifier.
Definition at line 986 of file savegame2.cpp.
Referenced by sg_load_map_tiles_resources(), and sg_load_player_vision().
|
static |
Dereferences the terrain character.
See terrains[].identifier example: char2terrain('a') => T_ARCTIC
Definition at line 1000 of file savegame2.cpp.
Referenced by sg_load_map_tiles(), and sg_load_player_vision().
|
static |
Free resources allocated for loaddata item.
Definition at line 485 of file savegame2.cpp.
Referenced by savegame2_load().
|
static |
Create new loaddata item for given section file.
Definition at line 446 of file savegame2.cpp.
Referenced by savegame2_load().
| void savegame2_load | ( | struct section_file * | file | ) |
Really loading the savegame.
Definition at line 377 of file savegame2.cpp.
Referenced by savegame_load().
|
static |
Helper function for loading bases from a savegame.
'ch' gives the character loaded from the savegame. Bases are packed in four to a character in hex notation. 'index' is a mapping of savegame bit -> base bit.
Definition at line 928 of file savegame2.cpp.
Referenced by sg_load_map_tiles_bases(), and sg_load_player_vision().
|
static |
Helper function for loading extras from a savegame.
'ch' gives the character loaded from the savegame. Extras are packed in four to a character in hex notation. 'index' is a mapping of savegame bit -> base bit.
Definition at line 754 of file savegame2.cpp.
Referenced by sg_load_map_tiles_extras(), and sg_load_player_vision().
|
static |
Load '[event_cache]'.
Definition at line 4862 of file savegame2.cpp.
Referenced by savegame2_load().
|
static |
|
static |
|
static |
|
static |
|
static |
Load tile owner information.
Definition at line 2105 of file savegame2.cpp.
Referenced by sg_load_map().
|
static |
Load starting positions for the players from a savegame file.
There should be at least enough for every player.
Definition at line 2018 of file savegame2.cpp.
Referenced by sg_load_map().
|
static |
|
static |
|
static |
|
static |
Load information about resources on map.
Definition at line 1988 of file savegame2.cpp.
Referenced by sg_load_map().
|
static |
|
static |
Load information about specials on map.
Definition at line 1954 of file savegame2.cpp.
Referenced by sg_load_map().
|
static |
Load worked tiles information.
Definition at line 2193 of file savegame2.cpp.
Referenced by sg_load_map().
|
static |
Load player (client) attributes data.
Definition at line 4369 of file savegame2.cpp.
Referenced by sg_load_players().
|
static |
Load data for one city.
Definition at line 3346 of file savegame2.cpp.
Referenced by sg_load_player_cities().
|
static |
Load nationality data for one city.
Definition at line 3607 of file savegame2.cpp.
Referenced by sg_load_player_cities().
Main player data loading function.
Definition at line 2760 of file savegame2.cpp.
Referenced by sg_load_players().
|
static |
Load the transport status of all units.
This is seperated from the other code as all units must be known.
Definition at line 4321 of file savegame2.cpp.
Referenced by sg_load_players().
|
static |
Load data for one seen city.
Definition at line 4668 of file savegame2.cpp.
Referenced by sg_load_player_vision().
|
static |
|
static |
Load '[player]' (basic data).
Definition at line 2307 of file savegame2.cpp.
Referenced by savegame2_load().
|
static |
|
static |
|
static |
|
static |
Set up correct ruleset for the savegame.
Definition at line 1061 of file savegame2.cpp.
Referenced by savegame2_load().
|
static |
Sanity check for loaded game.
Definition at line 5036 of file savegame2.cpp.
Referenced by savegame2_load().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Helper function for loading roads from a savegame.
'ch' gives the character loaded from the savegame. Roads are packed in four to a character in hex notation. 'index' is a mapping of savegame bit -> road bit.
Definition at line 959 of file savegame2.cpp.
Referenced by sg_load_map_tiles_roads(), and sg_load_player_vision().
|
static |
Complicated helper function for loading specials from a savegame.
'ch' gives the character loaded from the savegame. Specials are packed in four to a character in hex notation. 'index' is a mapping of savegame bit -> special bit. S_LAST is used to mark unused savegame bits.
Definition at line 788 of file savegame2.cpp.
Referenced by sg_load_map_tiles_specials(), and sg_load_player_vision().
|
static |
Load technology from path_name and if doesn't exist (because savegame is too old) load from path.
Definition at line 1022 of file savegame2.cpp.
Referenced by sg_load_researches().
|
static |
For each city and tile, sort unit lists according to ord_city and ord_map values.
Definition at line 728 of file savegame2.cpp.
Referenced by sg_load_players().
|
static |
Unquote a string.
The unquoted data is written into dest. If the unquoted data will be larger than dest_length the function aborts. It returns the actual length of the unquoted block.
Definition at line 656 of file savegame2.cpp.
Referenced by sg_load_player_attributes().
|
static |
Load the worklist elements specified by path to the worklist pointed to by 'pwl'.
'pwl' should be a pointer to an existing worklist.
Definition at line 688 of file savegame2.cpp.
Referenced by sg_load_player_city().
|
extern |
Definition at line 30 of file savecompat.cpp.
Referenced by savegame2_load().