![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <string.h>#include "capability.h"#include "fcintl.h"#include "registry.h"#include "section_file.h"#include "actions.h"#include "effects.h"#include "movement.h"#include "requirements.h"#include "unittype.h"#include "rssanity.h"#include "ruleset.h"#include "rscompat.h"
Include dependency graph for rscompat.cpp:Go to the source code of this file.
Classes | |
| struct | new_flags |
Macros | |
| #define | UTYF_LAST_USER_FLAG_3_0 UTYF_USER_FLAG_40 |
| #define | UCF_LAST_USER_FLAG_3_0 UCF_USER_FLAG_8 |
| #define | TER_LAST_USER_FLAG_3_0 TER_USER_8 |
Functions | |
| static void | rscompat_optional_capabilities (rscompat_info *info) |
| Handles compatibility with older versions when the new behavior is tied to the presence of an optional ruleset capability. More... | |
| int | rscompat_check_capabilities (struct section_file *file, const char *filename, struct rscompat_info *info) |
| Ruleset files should have a capabilities string datafile.options This checks the string and that the required capabilities are satisfied. More... | |
| static bool | rscompat_enabler_add_obligatory_hard_reqs (struct action_enabler *ae) |
| Add all hard obligatory requirements to an action enabler or disable it. More... | |
| void | rscompat_enablers_add_obligatory_hard_reqs () |
| Update existing action enablers for new hard obligatory requirements. More... | |
| static int | first_free_unit_type_user_flag () |
| Find and return the first unused unit type user flag. More... | |
| static int | first_free_unit_class_user_flag () |
| Find and return the first unused unit class user flag. More... | |
| static int | first_free_terrain_user_flag () |
| Find and return the first unused terrain user flag. More... | |
| bool | rscompat_names (struct rscompat_info *info) |
| Do compatibility things with names before they are referred to. More... | |
| static bool | effect_handle_split_universal (struct effect *peffect, struct universal original, struct universal separated) |
| Handle a universal being separated from an original universal. More... | |
| static bool | effect_list_compat_cb (struct effect *peffect, void *data) |
| Adjust effects. More... | |
| static void | effect_to_enabler (action_id action, struct section_file *file, const char *sec_name, struct rscompat_info *compat, const char *type) |
| Turn old effect to an action enabler. More... | |
| bool | rscompat_old_effect_3_1 (const char *type, struct section_file *file, const char *sec_name, struct rscompat_info *compat) |
| Check if effect name refers to one of the removed effects, and handle it if it does. More... | |
| void | rscompat_postprocess (struct rscompat_info *info) |
| Do compatibility things after regular ruleset loading. More... | |
| static bool | rscompat_vision_effect_cb (struct effect *peffect, void *data) |
Adds VisionLayer, Main, Local, True req to all unit/city vision reqs, as compat for missing CAP_VUT_VISIONLAYER. More... | |
| static void | rscompat_migrate_eft_nation_intelligence () |
| Adds effects to reproduce the traditional visibility of intelligence depending on the diplomatic status (EFT_NATION_INTELLIGENCE). More... | |
| bool | rscompat_auto_attack_3_1 (struct rscompat_info *compat, struct action_auto_perf *auto_perf, size_t psize, enum unit_type_flag_id *protecor_flag) |
| Replace deprecated auto_attack configuration. More... | |
| bool | rscompat_old_slow_invasions_3_1 (struct rscompat_info *compat, bool slow_invasions) |
| Replace slow_invasions and friends. More... | |
| const char * | rscompat_req_name_3_1 (const char *type, const char *old_name) |
| Replace deprecated requirement type names with currently valid ones. More... | |
| const char * | rscompat_utype_flag_name_3_1 (struct rscompat_info *compat, const char *old_type) |
| Replace deprecated unit type flag names with currently valid ones. More... | |
| void | rscompat_extra_adjust_3_1 (struct rscompat_info *compat, struct extra_type *pextra) |
| Adjust freeciv-3.0 ruleset extra definitions to freeciv-3.1. More... | |
| #define TER_LAST_USER_FLAG_3_0 TER_USER_8 |
Definition at line 42 of file rscompat.cpp.
| #define UCF_LAST_USER_FLAG_3_0 UCF_USER_FLAG_8 |
Definition at line 41 of file rscompat.cpp.
| #define UTYF_LAST_USER_FLAG_3_0 UTYF_USER_FLAG_40 |
Definition at line 40 of file rscompat.cpp.
|
static |
Handle a universal being separated from an original universal.
A universal may be split into two new universals. An effect may mention the universal that now has been split in its requirement list. In that case two effect - one for the original and one for the universal being separated from it - are needed.
Check if the original universal is mentioned in the requirement list of peffect. Handle creating one effect for the original and one for the universal that has been separated out if it is.
Definition at line 472 of file rscompat.cpp.
Referenced by effect_list_compat_cb().
|
static |
|
static |
Turn old effect to an action enabler.
Definition at line 553 of file rscompat.cpp.
Referenced by rscompat_old_effect_3_1().
|
static |
Find and return the first unused terrain user flag.
If all terrain user flags are taken MAX_NUM_USER_TER_FLAGS is returned.
Definition at line 299 of file rscompat.cpp.
Referenced by rscompat_names().
|
static |
Find and return the first unused unit class user flag.
If all unit class user flags are taken MAX_NUM_USER_UCLASS_FLAGS is returned.
Definition at line 278 of file rscompat.cpp.
Referenced by rscompat_names().
|
static |
Find and return the first unused unit type user flag.
If all unit type user flags are taken MAX_NUM_USER_UNIT_FLAGS is returned.
Definition at line 258 of file rscompat.cpp.
Referenced by rscompat_names().
| bool rscompat_auto_attack_3_1 | ( | struct rscompat_info * | compat, |
| struct action_auto_perf * | auto_perf, | ||
| size_t | psize, | ||
| enum unit_type_flag_id * | protecor_flag | ||
| ) |
Replace deprecated auto_attack configuration.
Definition at line 1239 of file rscompat.cpp.
Referenced by load_ruleset_game().
| int rscompat_check_capabilities | ( | struct section_file * | file, |
| const char * | filename, | ||
| struct rscompat_info * | info | ||
| ) |
Ruleset files should have a capabilities string datafile.options This checks the string and that the required capabilities are satisfied.
Definition at line 50 of file rscompat.cpp.
Referenced by load_building_names(), load_game_names(), load_government_names(), load_nation_names(), load_ruleset_cities(), load_ruleset_effects(), load_style_names(), load_tech_names(), load_terrain_names(), and load_unit_names().
|
static |
Add all hard obligatory requirements to an action enabler or disable it.
| ae | the action enabler to add requirements to. |
Definition at line 125 of file rscompat.cpp.
Referenced by rscompat_enablers_add_obligatory_hard_reqs().
| void rscompat_enablers_add_obligatory_hard_reqs | ( | ) |
Update existing action enablers for new hard obligatory requirements.
Disable those that can't be upgraded.
Definition at line 227 of file rscompat.cpp.
Referenced by rscompat_postprocess().
| void rscompat_extra_adjust_3_1 | ( | struct rscompat_info * | compat, |
| struct extra_type * | pextra | ||
| ) |
Adjust freeciv-3.0 ruleset extra definitions to freeciv-3.1.
Definition at line 1524 of file rscompat.cpp.
Referenced by load_ruleset_terrain().
|
static |
Adds effects to reproduce the traditional visibility of intelligence depending on the diplomatic status (EFT_NATION_INTELLIGENCE).
Definition at line 1097 of file rscompat.cpp.
Referenced by rscompat_optional_capabilities().
| bool rscompat_names | ( | struct rscompat_info * | info | ) |
Do compatibility things with names before they are referred to.
Runs after names are loaded from the ruleset but before the ruleset objects that may refer to them are loaded.
This is needed when previously hard coded items that are referred to in the ruleset them self becomes ruleset defined.
Returns FALSE if an error occurs.
Definition at line 325 of file rscompat.cpp.
Referenced by load_rulesetdir().
| bool rscompat_old_effect_3_1 | ( | const char * | type, |
| struct section_file * | file, | ||
| const char * | sec_name, | ||
| struct rscompat_info * | compat | ||
| ) |
Check if effect name refers to one of the removed effects, and handle it if it does.
Returns TRUE iff name was a valid old name.
Definition at line 606 of file rscompat.cpp.
Referenced by load_ruleset_effects().
| bool rscompat_old_slow_invasions_3_1 | ( | struct rscompat_info * | compat, |
| bool | slow_invasions | ||
| ) |
Replace slow_invasions and friends.
Definition at line 1277 of file rscompat.cpp.
Referenced by load_ruleset_game().
|
static |
Handles compatibility with older versions when the new behavior is tied to the presence of an optional ruleset capability.
Definition at line 1146 of file rscompat.cpp.
Referenced by rscompat_postprocess().
| void rscompat_postprocess | ( | struct rscompat_info * | info | ) |
Do compatibility things after regular ruleset loading.
Definition at line 640 of file rscompat.cpp.
Referenced by load_rulesetdir().
| const char* rscompat_req_name_3_1 | ( | const char * | type, |
| const char * | old_name | ||
| ) |
Replace deprecated requirement type names with currently valid ones.
The extra arguments are for situation where some, but not all, instances of a requirement type should become something else.
Definition at line 1502 of file rscompat.cpp.
Referenced by lookup_req_list().
| const char* rscompat_utype_flag_name_3_1 | ( | struct rscompat_info * | compat, |
| const char * | old_type | ||
| ) |
Replace deprecated unit type flag names with currently valid ones.
Definition at line 1515 of file rscompat.cpp.
Referenced by load_ruleset_units(), load_unit_names(), lookup_cbonus_list(), and lookup_req_list().
|
static |
Adds VisionLayer, Main, Local, True req to all unit/city vision reqs, as compat for missing CAP_VUT_VISIONLAYER.
| peffect | The effect to change. |
| data | A struct rscompat_info *. |
Definition at line 1082 of file rscompat.cpp.
Referenced by rscompat_optional_capabilities().