![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include "capability.h"#include "fcintl.h"#include "log.h"#include "registry_ini.h"#include "map.h"#include "specialist.h"#include "aiiface.h"#include "unittools.h"#include "savecompat.h"
Include dependency graph for savecompat.cpp:Go to the source code of this file.
Classes | |
| struct | compatibility |
Macros | |
| #define | compat_current (compat_num - 1) |
Typedefs | |
| typedef void(* | load_version_func_t) (struct loaddata *loading, enum sgf_version format_class) |
Functions | |
| static void | compat_load_020400 (struct loaddata *loading, enum sgf_version format_class) |
| Translate savegame secfile data from 2.3.x to 2.4.0 format. More... | |
| static void | compat_load_020500 (struct loaddata *loading, enum sgf_version format_class) |
| Translate savegame secfile data from 2.4.x to 2.5.0 format. More... | |
| static void | compat_load_020600 (struct loaddata *loading, enum sgf_version format_class) |
| Translate savegame secfile data from 2.5.x to 2.6.0 format. More... | |
| static void | compat_load_030000 (struct loaddata *loading, enum sgf_version format_class) |
| Translate savegame secfile data from 2.6.x to 3.0.0 format. More... | |
| static void | compat_load_030100 (struct loaddata *loading, enum sgf_version format_class) |
| Translate savegame secfile data from 3.0.x to 3.1.0 format. More... | |
| static void | compat_post_load_030100 (struct loaddata *loading, enum sgf_version format_class) |
| Update loaded game data from 3.0.x to something usable by 3.1.0. More... | |
| void | sg_load_compat (struct loaddata *loading, enum sgf_version format_class) |
| Compatibility functions for loaded game. More... | |
| void | sg_load_post_load_compat (struct loaddata *loading, enum sgf_version format_class) |
| Compatibility functions for loaded game that needs game state. More... | |
| int | current_compat_ver () |
| Return current compatibility version. More... | |
| char | bin2ascii_hex (int value, int halfbyte_wanted) |
| This returns an ascii hex value of the given half-byte of the binary integer. More... | |
| int | ascii_hex2bin (char ch, int halfbyte) |
| This returns a binary integer value of the ascii hex char, offset by the given number of half-bytes. More... | |
| int | char2num (char ch) |
| Converts single character into numerical value. More... | |
| enum tile_special_type | special_by_rule_name (const char *name) |
| Return the special with the given name, or S_LAST. More... | |
| const char * | special_rule_name (enum tile_special_type type) |
| Return the untranslated name of the given special. More... | |
| struct extra_type * | special_extra_get (int spe) |
| Get extra of the given special. More... | |
| struct extra_type * | resource_by_identifier (const char identifier) |
| Return the resource type matching the identifier, or nullptr when none matches. More... | |
| static const char * | killcitizen_enum_str (secfile_data_t data, int bit) |
| Callback to get name of old killcitizen setting bit. More... | |
| static const char * | revolentype_str (enum revolen_type type) |
| Return string representation of revolentype. More... | |
| static int | increase_secfile_turn_int (struct loaddata *loading, const char *key, int old_def, bool keep_default) |
| Increase turn value in secfile by one. More... | |
| static void | insert_server_side_agent (struct loaddata *loading, enum sgf_version format_class) |
| static void | unit_order_activity_to_action (struct unit *act_unit) |
| Upgrade unit activity orders to unit action orders. More... | |
| static enum direction8 | dir_opposite (enum direction8 dir) |
| Returns the opposite direction. More... | |
| static void | upgrade_unit_order_targets (struct unit *act_unit) |
| Upgrade unit action order target encoding. More... | |
| static void | upgrade_server_side_agent (struct loaddata *loading) |
| enum ai_level | ai_level_convert (int old_level) |
| Translate savegame secfile data from earlier development version format to current one. More... | |
| enum barbarian_type | barb_type_convert (int old_type) |
| Convert old barbarian type value to barbarian_type. More... | |
| void | set_unit_activity_base (struct unit *punit, Base_type_id base) |
| Assign a new base building task to unit. More... | |
| void | set_unit_activity_road (struct unit *punit, Road_type_id road) |
| Assign a new road building task to unit. More... | |
| int | sg_order_to_action (int order, struct unit *act_unit, struct tile *tgt_tile) |
| Returns the action id corresponding to the specified order id. More... | |
Variables | |
| bool | sg_success |
| static const char * | special_names [] |
| static struct compatibility | compat [] |
| static const int | compat_num = ARRAY_SIZE(compat) |
| static const char | num_chars [] |
| #define compat_current (compat_num - 1) |
Definition at line 131 of file savecompat.cpp.
| typedef void(* load_version_func_t) (struct loaddata *loading, enum sgf_version format_class) |
Definition at line 88 of file savecompat.cpp.
| enum ai_level ai_level_convert | ( | int | old_level | ) |
Translate savegame secfile data from earlier development version format to current one.
Convert old ai level value to ai_level
Definition at line 1739 of file savecompat.cpp.
Referenced by sg_load_game(), and sg_load_player_main().
| int ascii_hex2bin | ( | char | ch, |
| int | halfbyte | ||
| ) |
This returns a binary integer value of the ascii hex char, offset by the given number of half-bytes.
See bin2ascii_hex(). example: ascii_hex2bin('a', 2) == 0xa00 This is only used in loading games, and it requires some error checking so it's done as a function.
Definition at line 239 of file savecompat.cpp.
Referenced by compat_load_020400(), sg_load_map_known(), and sg_load_player_vision().
| enum barbarian_type barb_type_convert | ( | int | old_type | ) |
Convert old barbarian type value to barbarian_type.
Definition at line 1739 of file savecompat.cpp.
Referenced by compat_load_020600().
| char bin2ascii_hex | ( | int | value, |
| int | halfbyte_wanted | ||
| ) |
This returns an ascii hex value of the given half-byte of the binary integer.
See ascii_hex2bin(). example: bin2ascii_hex(0xa00, 2) == 'a'
Definition at line 227 of file savecompat.cpp.
Referenced by compat_load_020400(), sg_save_map_known(), and sg_save_player_vision().
| int char2num | ( | char | ch | ) |
Converts single character into numerical value.
This is not hex conversion.
Definition at line 264 of file savecompat.cpp.
Referenced by compat_load_030100(), and sg_load_player_unit().
|
static |
Translate savegame secfile data from 2.3.x to 2.4.0 format.
Definition at line 341 of file savecompat.cpp.
|
static |
Translate savegame secfile data from 2.4.x to 2.5.0 format.
Definition at line 575 of file savecompat.cpp.
|
static |
Translate savegame secfile data from 2.5.x to 2.6.0 format.
Definition at line 685 of file savecompat.cpp.
|
static |
Translate savegame secfile data from 2.6.x to 3.0.0 format.
Note that even after 2.6 savegame has gone through this compatibility function, it's still 2.6 savegame in the sense that savegame2.c, and not savegame3.c, handles it.
Definition at line 1307 of file savecompat.cpp.
|
static |
Translate savegame secfile data from 3.0.x to 3.1.0 format.
Note that even after 2.6 savegame has gone through all the compatibility functions, it's still 2.6 savegame in the sense that savegame2.c, and not savegame3.c, handles it.
Definition at line 1495 of file savecompat.cpp.
|
static |
Update loaded game data from 3.0.x to something usable by 3.1.0.
Definition at line 1739 of file savecompat.cpp.
| int current_compat_ver | ( | ) |
Return current compatibility version.
Definition at line 220 of file savecompat.cpp.
Referenced by sg_save_savefile().
|
static |
Returns the opposite direction.
Definition at line 1565 of file savecompat.cpp.
Referenced by upgrade_unit_order_targets().
|
static |
Increase turn value in secfile by one.
Definition at line 1285 of file savecompat.cpp.
Referenced by compat_load_030000().
|
static |
Definition at line 1413 of file savecompat.cpp.
Referenced by compat_load_030100().
|
static |
Callback to get name of old killcitizen setting bit.
Definition at line 558 of file savecompat.cpp.
Referenced by compat_load_020500().
| struct extra_type* resource_by_identifier | ( | const char | identifier | ) |
Return the resource type matching the identifier, or nullptr when none matches.
Definition at line 321 of file savecompat.cpp.
Referenced by char2resource().
|
static |
Return string representation of revolentype.
Definition at line 666 of file savecompat.cpp.
Referenced by compat_load_020600().
| void set_unit_activity_base | ( | struct unit * | punit, |
| Base_type_id | base | ||
| ) |
Assign a new base building task to unit.
Definition at line 2276 of file savecompat.cpp.
Referenced by sg_load_player_unit().
| void set_unit_activity_road | ( | struct unit * | punit, |
| Road_type_id | road | ||
| ) |
Assign a new road building task to unit.
Definition at line 2285 of file savecompat.cpp.
Referenced by sg_load_player_unit().
| void sg_load_compat | ( | struct loaddata * | loading, |
| enum sgf_version | format_class | ||
| ) |
Compatibility functions for loaded game.
This function is called at the beginning of loading a savegame. The data in loading->file should be change such, that the current loading functions can be executed without errors.
Definition at line 140 of file savecompat.cpp.
Referenced by savegame2_load(), and savegame3_load().
| void sg_load_post_load_compat | ( | struct loaddata * | loading, |
| enum sgf_version | format_class | ||
| ) |
Compatibility functions for loaded game that needs game state.
Some compatibility needs access to game state not available in sg_load_compat(). Do those here.
This function is called after a savegame has loaded the game state. The data should be changed in the game state since the game already is done loading. Prefer using sg_load_compat() when possible.
Definition at line 191 of file savecompat.cpp.
Referenced by savegame2_load(), and savegame3_load().
Returns the action id corresponding to the specified order id.
If no corresponding action is found ACTION_NONE is returned.
Relevant tile content information must be loaded before this function is called. Tile content information is relevant if it determines what action an old order result in. Example: a 2.6 ORDER_BUILD_CITY would result in Join City inside a domestic city and in Found City on a tile without a city. That makes domestic cities relevant tile content information.
Intended to be used while loading unit orders from pre Freeciv 3.0.0 save games (savegame and savegame2). Should be deleted with savegame2.
Temporarily used to provide development version internal save game compatibility for what will become Freeciv21. This use should cease before Freeciv21 3.0.0 is released.
Should never be called from savegame3 after the 3.0 development version internal save game compatibility is removed.
Definition at line 2311 of file savecompat.cpp.
Referenced by sg_load_player_unit().
| enum tile_special_type special_by_rule_name | ( | const char * | name | ) |
Return the special with the given name, or S_LAST.
Definition at line 264 of file savecompat.cpp.
Referenced by sg_load_savefile().
| struct extra_type* special_extra_get | ( | int | spe | ) |
Get extra of the given special.
Definition at line 305 of file savecompat.cpp.
Referenced by sg_load_player_unit().
| const char* special_rule_name | ( | enum tile_special_type | type | ) |
Return the untranslated name of the given special.
Definition at line 295 of file savecompat.cpp.
Referenced by sg_special_set().
|
static |
Upgrade unit activity orders to unit action orders.
Definition at line 1565 of file savecompat.cpp.
Referenced by ai_level_convert().
|
static |
Definition at line 1721 of file savecompat.cpp.
Referenced by ai_level_convert().
|
static |
Upgrade unit action order target encoding.
Definition at line 1652 of file savecompat.cpp.
Referenced by ai_level_convert().
|
static |
Definition at line 88 of file savecompat.cpp.
Referenced by current_compat_ver(), effect_to_enabler(), load_building_names(), load_game_names(), load_government_names(), load_nation_names(), load_ruleset_buildings(), load_ruleset_cities(), load_ruleset_effects(), load_ruleset_game(), load_ruleset_governments(), load_ruleset_styles(), load_ruleset_techs(), load_ruleset_terrain(), load_ruleset_units(), load_ruleset_veteran(), load_style_names(), load_tech_names(), load_terrain_names(), load_unit_names(), lookup_cbonus_list(), lookup_req_list(), road_by_compat_special(), rscompat_auto_attack_3_1(), rscompat_extra_adjust_3_1(), rscompat_old_effect_3_1(), rscompat_old_slow_invasions_3_1(), sg_load_compat(), and sg_load_post_load_compat().
|
static |
Definition at line 130 of file savecompat.cpp.
Referenced by sg_load_compat(), and sg_load_post_load_compat().
|
static |
Definition at line 257 of file savecompat.cpp.
Referenced by char2num().
| bool sg_success |
Definition at line 30 of file savecompat.cpp.
Referenced by savegame2_load(), savegame3_load(), savegame3_save_real(), and sg_load_savefile().
|
static |
Definition at line 32 of file savecompat.cpp.
Referenced by special_rule_name().