Freeciv-3.1
|
#include "capability.h"
#include "log.h"
#include "map.h"
#include "specialist.h"
#include "aiiface.h"
#include "unittools.h"
#include "savecompat.h"
Go to the source code of this file.
Data Structures | |
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) |
static void | compat_load_020500 (struct loaddata *loading, enum sgf_version format_class) |
static void | compat_load_020600 (struct loaddata *loading, enum sgf_version format_class) |
static void | compat_load_030000 (struct loaddata *loading, enum sgf_version format_class) |
static void | compat_load_030100 (struct loaddata *loading, enum sgf_version format_class) |
static void | compat_post_load_030100 (struct loaddata *loading, enum sgf_version format_class) |
void | sg_load_compat (struct loaddata *loading, enum sgf_version format_class) |
void | sg_load_post_load_compat (struct loaddata *loading, enum sgf_version format_class) |
int | current_compat_ver (void) |
char | bin2ascii_hex (int value, int halfbyte_wanted) |
int | ascii_hex2bin (char ch, int halfbyte) |
int | char2num (char ch) |
enum tile_special_type | special_by_rule_name (const char *name) |
const char * | special_rule_name (enum tile_special_type type) |
struct extra_type * | special_extra_get (int spe) |
struct extra_type * | resource_by_identifier (const char identifier) |
static const char * | killcitizen_enum_str (secfile_data_t data, int bit) |
static char * | revolentype_str (enum revolen_type type) |
static int | increase_secfile_turn_int (struct loaddata *loading, const char *key, int old_def, bool keep_default) |
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) |
static enum direction8 | dir_opposite (enum direction8 dir) |
static void | upgrade_unit_order_targets (struct unit *act_unit) |
static void | upgrade_server_side_agent (struct loaddata *loading) |
enum ai_level | ai_level_convert (int old_level) |
enum barbarian_type | barb_type_convert (int old_type) |
void | set_unit_activity_base (struct unit *punit, Base_type_id base) |
void | set_unit_activity_road (struct unit *punit, Road_type_id road) |
Variables | |
bool | sg_success |
static 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 123 of file savecompat.c.
typedef void(* load_version_func_t) (struct loaddata *loading, enum sgf_version format_class) |
Definition at line 81 of file savecompat.c.
enum ai_level ai_level_convert | ( | int | old_level | ) |
Convert old ai level value to ai_level
Definition at line 1883 of file savecompat.c.
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 221 of file savecompat.c.
Referenced by compat_load_020400(), sg_load_map_known(), sg_load_map_known(), sg_load_player_vision(), 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 1912 of file savecompat.c.
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 209 of file savecompat.c.
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 245 of file savecompat.c.
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 318 of file savecompat.c.
|
static |
Translate savegame secfile data from 2.4.x to 2.5.0 format.
Definition at line 548 of file savecompat.c.
|
static |
Translate savegame secfile data from 2.5.x to 2.6.0 format.
Definition at line 674 of file savecompat.c.
|
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 1277 of file savecompat.c.
|
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 1483 of file savecompat.c.
|
static |
Update loaded game data from 3.0.x to something usable by 3.1.0.
Definition at line 1795 of file savecompat.c.
int current_compat_ver | ( | void | ) |
Return current compatibility version
Definition at line 199 of file savecompat.c.
Referenced by sg_save_savefile().
|
static |
Returns the opposite direction.
Definition at line 1673 of file savecompat.c.
Referenced by upgrade_unit_order_targets().
|
static |
Increase turn value in secfile by one.
Definition at line 1256 of file savecompat.c.
Referenced by compat_load_030000().
|
static |
Insert server side agent information.
Definition at line 1392 of file savecompat.c.
Referenced by compat_load_030100().
|
static |
Callback to get name of old killcitizen setting bit.
Definition at line 531 of file savecompat.c.
Referenced by compat_load_020500().
struct extra_type * resource_by_identifier | ( | const char | identifier | ) |
Return the resource type matching the identifier, or NULL when none matches.
Definition at line 300 of file savecompat.c.
Referenced by char2resource().
|
static |
Return string representation of revolentype
Definition at line 655 of file savecompat.c.
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 1929 of file savecompat.c.
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 1939 of file savecompat.c.
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 132 of file savecompat.c.
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 177 of file savecompat.c.
Referenced by savegame2_load(), and savegame3_load().
enum tile_special_type special_by_rule_name | ( | const char * | name | ) |
Return the special with the given name, or S_LAST.
Definition at line 260 of file savecompat.c.
Referenced by sg_load_savefile().
struct extra_type * special_extra_get | ( | int | spe | ) |
Get extra of the given special
Definition at line 286 of file savecompat.c.
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 276 of file savecompat.c.
Referenced by sg_special_set().
|
static |
Upgrade unit activity orders to unit action orders.
Definition at line 1614 of file savecompat.c.
Referenced by compat_post_load_030100().
|
static |
Correct the server side agent information.
Definition at line 1781 of file savecompat.c.
Referenced by compat_post_load_030100().
|
static |
Upgrade unit action order target encoding.
Definition at line 1700 of file savecompat.c.
Referenced by compat_post_load_030100().
|
static |
Definition at line 101 of file savecompat.c.
Referenced by current_compat_ver(), effect_to_enabler(), load_action_range(), load_action_range_max(), 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(), real_menus_update(), receive_packet_ruleset_road_100(), road_by_compat_special(), rscompat_action_max_range_name_S3_1(), rscompat_action_ui_name_S3_1(), rscompat_auto_attack_3_1(), rscompat_combat_bonus_name_3_1(), rscompat_extra_adjust_3_1(), rscompat_old_effect_3_1(), rscompat_old_slow_invasions_3_1(), rscompat_req_vec_adjust_3_1(), rscompat_uclass_flags_3_1(), rscompat_utype_flag_name_3_1(), sanity_check_ruleset_data(), sg_load_compat(), and sg_load_post_load_compat().
|
static |
Definition at line 122 of file savecompat.c.
Referenced by sg_load_compat(), and sg_load_post_load_compat().
|
static |
Definition at line 239 of file savecompat.c.
Referenced by char2num().
bool sg_success |
Definition at line 32 of file savecompat.c.
Referenced by savegame2_load(), savegame3_load(), savegame3_save_real(), and sg_load_savefile().
|
static |
Definition at line 34 of file savecompat.c.
Referenced by special_by_rule_name(), and special_rule_name().