Freeciv-3.3
Loading...
Searching...
No Matches
Macros | Functions
rscompat.c File Reference
#include "capability.h"
#include "log.h"
#include "registry.h"
#include "actions.h"
#include "effects.h"
#include "fc_types.h"
#include "game.h"
#include "movement.h"
#include "requirements.h"
#include "unittype.h"
#include "rssanity.h"
#include "ruleload.h"
#include "settings.h"
#include "rscompat.h"

Go to the source code of this file.

Macros

#define MAXIMUM_CLAIMED_OCEAN_SIZE_3_2   (20)
 
#define enough_new_user_flags(_new_flags_, _name_, _LAST_USER_FLAG_, _LAST_USER_FLAG_PREV_)
 
#define UTYF_LAST_USER_FLAG_3_2   UTYF_USER_FLAG_50
 
#define TECH_LAST_USER_FLAG_3_2   TECH_USER_7
 
#define RS_DEFAULT_CIVIL_WAR_CELEB   -5
 
#define RS_DEFAULT_CIVIL_WAR_UNHAPPY   5
 

Functions

static int first_free_unit_type_user_flag (void)
 
static int first_free_tech_user_flag (void)
 
void rscompat_init_info (struct rscompat_info *info)
 
int rscompat_check_capabilities (struct section_file *file, const char *filename, const struct rscompat_info *info)
 
bool rscompat_check_cap_and_version (struct section_file *file, const char *filename, const struct rscompat_info *info)
 
static bool rscompat_enabler_add_obligatory_hard_reqs (struct action_enabler *ae)
 
void rscompat_enablers_add_obligatory_hard_reqs (void)
 
bool rscompat_names (struct rscompat_info *info)
 
static bool effect_list_compat_cb (struct effect *peffect, void *data)
 
void rscompat_postprocess (struct rscompat_info *info)
 
const charrscompat_utype_flag_name_3_3 (const char *old_name)
 
const charrscompat_universal_name_3_3 (const char *old_name)
 
const charrscompat_effect_name_3_3 (const char *old_name)
 
const charblocked_by_old_name_3_3 (const char *new_name)
 
const charui_name_old_name_3_3 (const char *new_name)
 
void rscompat_civil_war_effects_3_3 (struct section_file *game_rs)
 
bool load_action_ui_name_3_3 (struct section_file *file, int act, const char *entry_name, struct rscompat_info *compat)
 

Macro Definition Documentation

◆ enough_new_user_flags

#define enough_new_user_flags (   _new_flags_,
  _name_,
  _LAST_USER_FLAG_,
  _LAST_USER_FLAG_PREV_ 
)
Value:
char * incite_cost
Definition comments.c:76
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:238
#define ARRAY_SIZE(x)
Definition shared.h:85

Definition at line 46 of file rscompat.c.

◆ MAXIMUM_CLAIMED_OCEAN_SIZE_3_2

#define MAXIMUM_CLAIMED_OCEAN_SIZE_3_2   (20)

Definition at line 44 of file rscompat.c.

◆ RS_DEFAULT_CIVIL_WAR_CELEB

#define RS_DEFAULT_CIVIL_WAR_CELEB   -5

Definition at line 710 of file rscompat.c.

◆ RS_DEFAULT_CIVIL_WAR_UNHAPPY

#define RS_DEFAULT_CIVIL_WAR_UNHAPPY   5

Definition at line 711 of file rscompat.c.

◆ TECH_LAST_USER_FLAG_3_2

#define TECH_LAST_USER_FLAG_3_2   TECH_USER_7

Definition at line 53 of file rscompat.c.

◆ UTYF_LAST_USER_FLAG_3_2

#define UTYF_LAST_USER_FLAG_3_2   UTYF_USER_FLAG_50

Definition at line 52 of file rscompat.c.

Function Documentation

◆ blocked_by_old_name_3_3()

const char * blocked_by_old_name_3_3 ( const char new_name)

Tell 3.2 blocked_by name matching 3.3 one

Definition at line 671 of file rscompat.c.

Referenced by load_action_blocked_by_list().

◆ effect_list_compat_cb()

static bool effect_list_compat_cb ( struct effect peffect,
void data 
)
static

Adjust effects

Definition at line 448 of file rscompat.c.

Referenced by rscompat_postprocess().

◆ first_free_tech_user_flag()

static int first_free_tech_user_flag ( void  )
static

Find and return the first unused tech user flag. If all tech user flags are taken MAX_NUM_USER_TECH_FLAGS is returned.

Definition at line 617 of file rscompat.c.

Referenced by rscompat_names().

◆ first_free_unit_type_user_flag()

static int first_free_unit_type_user_flag ( void  )
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 598 of file rscompat.c.

Referenced by rscompat_names().

◆ load_action_ui_name_3_3()

bool load_action_ui_name_3_3 ( struct section_file file,
int  act,
const char entry_name,
struct rscompat_info compat 
)

Load ui_name of one action

Definition at line 748 of file rscompat.c.

Referenced by load_ruleset_actions().

◆ rscompat_check_cap_and_version()

bool rscompat_check_cap_and_version ( struct section_file file,
const char filename,
const struct rscompat_info info 
)

Different ruleset files within a ruleset directory should all have identical datafile.format_version This checks the file version against the expected version.

See also rscompat_check_capabilities

Definition at line 135 of file rscompat.c.

Referenced by load_action_names(), load_building_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().

◆ rscompat_check_capabilities()

int rscompat_check_capabilities ( struct section_file file,
const char filename,
const 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 70 of file rscompat.c.

Referenced by load_game_names(), and rscompat_check_cap_and_version().

◆ rscompat_civil_war_effects_3_3()

void rscompat_civil_war_effects_3_3 ( struct section_file game_rs)

Add civil war bonus effects matching old civstyle values.

Definition at line 716 of file rscompat.c.

Referenced by load_ruleset_game().

◆ rscompat_effect_name_3_3()

const char * rscompat_effect_name_3_3 ( const char old_name)

Convert 3.2 effect name to a 3.3 one.

Definition at line 659 of file rscompat.c.

Referenced by load_ruleset_effects().

◆ rscompat_enabler_add_obligatory_hard_reqs()

static bool rscompat_enabler_add_obligatory_hard_reqs ( struct action_enabler ae)
static

Add all hard obligatory requirements to an action enabler or disable it.

Parameters
aethe action enabler to add requirements to.
Returns
TRUE iff adding obligatory hard reqs for the enabler's action needs to restart - say if an enabler was added or removed.

Definition at line 170 of file rscompat.c.

Referenced by rscompat_enablers_add_obligatory_hard_reqs().

◆ rscompat_enablers_add_obligatory_hard_reqs()

void rscompat_enablers_add_obligatory_hard_reqs ( void  )

Update existing action enablers for new hard obligatory requirements. Disable those that can't be upgraded.

Definition at line 290 of file rscompat.c.

Referenced by rscompat_postprocess(), and ruleset_purge_redundant_reqs().

◆ rscompat_init_info()

void rscompat_init_info ( struct rscompat_info info)

Initialize rscompat information structure

Definition at line 61 of file rscompat.c.

Referenced by load_rulesetdir(), and tab_misc::sanity_check().

◆ rscompat_names()

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 345 of file rscompat.c.

Referenced by load_rulesetdir().

◆ rscompat_postprocess()

void rscompat_postprocess ( struct rscompat_info info)

Do compatibility things after regular ruleset loading.

Definition at line 457 of file rscompat.c.

Referenced by load_rulesetdir().

◆ rscompat_universal_name_3_3()

const char * rscompat_universal_name_3_3 ( const char old_name)

Convert 3.2 universal name to a 3.3 one.

Definition at line 647 of file rscompat.c.

Referenced by lookup_req_list().

◆ rscompat_utype_flag_name_3_3()

const char * rscompat_utype_flag_name_3_3 ( const char old_name)

Convert 3.2 unit type flag name to 3.3 one.

Definition at line 635 of file rscompat.c.

Referenced by load_ruleset_units().

◆ ui_name_old_name_3_3()

const char * ui_name_old_name_3_3 ( const char new_name)

Tell 3.2 ui_name matching 3.3 one

Definition at line 692 of file rscompat.c.

Referenced by load_action_ui_name_3_3().