Freeciv-3.2
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 "ruleset.h"
#include "settings.h"
#include "rscompat.h"

Go to the source code of this file.

Macros

#define enough_new_user_flags(_new_flags_, _name_, _LAST_USER_FLAG_, _LAST_USER_FLAG_PREV_)
 
#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
 
#define SET_INT_SETTING(name, value, lock)
 

Functions

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)
 
enum impr_genus_id rscompat_genus_3_2 (struct rscompat_info *compat, const bv_impr_flags flags, enum impr_genus_id old_genus)
 
const charrscompat_req_range_3_2 (struct rscompat_info *compat, const char *type, const char *old_range)
 
void rscompat_req_adjust_3_2 (const struct rscompat_info *compat, const char **ptype, const char **pname, bool *ppresent, const char *sec_name)
 
int add_user_extra_flags_3_2 (int start)
 
const charrscompat_extra_rmcause_3_2 (struct extra_type *pextra, const char *old_name)
 
void rscompat_extra_adjust_3_2 (struct extra_type *pextra)
 
bool rscompat_setting_needs_special_handling (const char *name)
 
void rscompat_settings_do_special_handling (struct section_file *file, const char *section, void(*setdef)(struct setting *pset))
 
bool rscompat_terrain_extra_rmtime_3_2 (struct section_file *file, const char *tsection, struct terrain *pterrain)
 
const charrscompat_action_rule_name_3_2 (struct rscompat_info *compat, const char *orig)
 
void rscompat_action_enabler_adjust_3_2 (struct rscompat_info *compat, struct action_enabler *enabler, const char *orig_name)
 
const charrscompat_action_ui_name_3_2 (struct rscompat_info *compat, int act_id)
 

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:75
#define FC_STATIC_ASSERT(cond, tag)
Definition log.h:235
#define ARRAY_SIZE(x)
Definition shared.h:85

Definition at line 44 of file rscompat.c.

◆ SET_INT_SETTING

#define SET_INT_SETTING (   name,
  value,
  lock 
)
Value:
sizeof(reject_msg))) { \
log_normal(_("Ruleset: '%s' has been set to %s."), \
} else { \
} \
if (lock) { \
log_normal(_("Ruleset: '%s' has been locked by the ruleset."), \
}
#define _(String)
Definition fcintl.h:67
const char * name
Definition inputfile.c:127
struct setting * setting_by_name(const char *name)
Definition settings.c:3306
const char * setting_value_name(const struct setting *pset, bool pretty, char *buf, size_t buf_len)
Definition settings.c:4264
bool setting_int_set(struct setting *pset, int val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
Definition settings.c:3740
enum sset_type setting_type(const struct setting *pset)
Definition settings.c:3359
const char * setting_name(const struct setting *pset)
Definition settings.c:3330
#define TRUE
Definition support.h:46

◆ TER_LAST_USER_FLAG_3_0

#define TER_LAST_USER_FLAG_3_0   TER_USER_8

Definition at line 52 of file rscompat.c.

◆ UCF_LAST_USER_FLAG_3_0

#define UCF_LAST_USER_FLAG_3_0   UCF_USER_FLAG_8

Definition at line 51 of file rscompat.c.

◆ UTYF_LAST_USER_FLAG_3_0

#define UTYF_LAST_USER_FLAG_3_0   UTYF_USER_FLAG_40

Definition at line 50 of file rscompat.c.

Function Documentation

◆ add_user_extra_flags_3_2()

int add_user_extra_flags_3_2 ( int  start)

Add user extra flags needed in ruleset update from 3.1 to 3.2

Returns
Number of flags added

Definition at line 564 of file rscompat.c.

Referenced by load_terrain_names().

◆ effect_list_compat_cb()

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

Adjust effects

Definition at line 339 of file rscompat.c.

Referenced by rscompat_postprocess().

◆ rscompat_action_enabler_adjust_3_2()

void rscompat_action_enabler_adjust_3_2 ( struct rscompat_info compat,
struct action_enabler enabler,
const char orig_name 
)

Adjust freeciv-3.1 ruleset action enabler to freeciv-3.2

Definition at line 768 of file rscompat.c.

Referenced by load_ruleset_actions().

◆ rscompat_action_rule_name_3_2()

const char * rscompat_action_rule_name_3_2 ( struct rscompat_info compat,
const char orig 
)

Adjust freeciv-3.1 ruleset action rule name to freeciv-3.2

Definition at line 753 of file rscompat.c.

Referenced by load_ruleset_actions().

◆ rscompat_action_ui_name_3_2()

const char * rscompat_action_ui_name_3_2 ( struct rscompat_info compat,
int  act_id 
)

Adjust freeciv-3.1 ruleset action ui_name to freeciv-3.2

Definition at line 783 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 131 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 66 of file rscompat.c.

Referenced by load_game_names(), and rscompat_check_cap_and_version().

◆ 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 166 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 286 of file rscompat.c.

Referenced by rscompat_postprocess(), and ruleset_purge_redundant_reqs().

◆ rscompat_extra_adjust_3_2()

void rscompat_extra_adjust_3_2 ( struct extra_type pextra)

Adjust values of an extra loaded from a 3.1 ruleset.

Definition at line 603 of file rscompat.c.

Referenced by load_ruleset_terrain().

◆ rscompat_extra_rmcause_3_2()

const char * rscompat_extra_rmcause_3_2 ( struct extra_type pextra,
const char old_name 
)

Adjust rmcause name of an extra loaded from a 3.1 ruleset.

Definition at line 577 of file rscompat.c.

Referenced by load_ruleset_terrain().

◆ rscompat_genus_3_2()

enum impr_genus_id rscompat_genus_3_2 ( struct rscompat_info compat,
const bv_impr_flags  flags,
enum impr_genus_id  old_genus 
)

Update improvement genus for coinage improvements.

Definition at line 455 of file rscompat.c.

Referenced by load_ruleset_buildings().

◆ rscompat_init_info()

void rscompat_init_info ( struct rscompat_info info)

Initialize rscompat information structure

Definition at line 57 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 330 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 386 of file rscompat.c.

Referenced by load_rulesetdir().

◆ rscompat_req_adjust_3_2()

void rscompat_req_adjust_3_2 ( const struct rscompat_info compat,
const char **  ptype,
const char **  pname,
bool ppresent,
const char sec_name 
)

Update individual requirements.

Definition at line 498 of file rscompat.c.

Referenced by lookup_req_list().

◆ rscompat_req_range_3_2()

const char * rscompat_req_range_3_2 ( struct rscompat_info compat,
const char type,
const char old_range 
)

Update requirement range for certain requirement types.

Definition at line 471 of file rscompat.c.

Referenced by lookup_req_list().

◆ rscompat_setting_needs_special_handling()

bool rscompat_setting_needs_special_handling ( const char name)

Determine whether the given setting should be skipped and rscompat_settings_do_special_handling should be called.

Definition at line 623 of file rscompat.c.

Referenced by settings_ruleset().

◆ rscompat_settings_do_special_handling()

void rscompat_settings_do_special_handling ( struct section_file file,
const char section,
void(*)(struct setting *pset setdef 
)

Special handling for complex server setting changes.

Definition at line 637 of file rscompat.c.

Referenced by settings_ruleset().

◆ rscompat_terrain_extra_rmtime_3_2()

bool rscompat_terrain_extra_rmtime_3_2 ( struct section_file file,
const char tsection,
struct terrain pterrain 
)

Migrate pollution and fallout time to extra specific removal times.

Definition at line 713 of file rscompat.c.

Referenced by load_ruleset_terrain().