Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Functions | Variables
rssanity.c File Reference
#include "astring.h"
#include "deprecations.h"
#include "achievements.h"
#include "actions.h"
#include "effects.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "movement.h"
#include "nation.h"
#include "player.h"
#include "specialist.h"
#include "tech.h"
#include "ruleset.h"
#include "settings.h"
#include "rssanity.h"

Go to the source code of this file.

Data Structures

struct  els_data
 

Functions

static bool sanity_check_metadata (rs_conversion_logger logger)
 
static bool nation_has_initial_tech (struct nation_type *pnation, struct advance *tech)
 
static bool sanity_check_setting_is_seen (struct setting *pset)
 
static bool sanity_check_setting_is_game_rule (struct setting *pset)
 
bool sanity_check_server_setting_value_in_req (ssetv ssetval)
 
static bool sanity_check_req_individual (rs_conversion_logger logger, struct requirement *preq, const char *list_for)
 
static bool sanity_check_req_set (rs_conversion_logger logger, int reqs_of_type[], int local_reqs_of_type[], int tile_reqs_of_type[], struct requirement *preq, bool conjunctive, int max_tiles, const char *list_for)
 
static bool sanity_check_req_vec (rs_conversion_logger logger, const struct requirement_vector *preqs, bool conjunctive, int max_tiles, const char *list_for)
 
static bool effect_list_sanity_cb (struct effect *peffect, void *data)
 
static bool rs_barbarian_units (rs_conversion_logger logger)
 
static bool rs_common_units (rs_conversion_logger logger)
 
static bool rs_buildings (rs_conversion_logger logger)
 
static bool sanity_check_boolean_effects (rs_conversion_logger logger)
 
bool sanity_check_ruleset_data (struct rscompat_info *compat)
 
bool autoadjust_ruleset_data (void)
 
bool autolock_settings (void)
 

Variables

enum effect_type req_base_effects []
 
enum effect_type req_base_effects_3_2 []
 

Function Documentation

◆ autoadjust_ruleset_data()

bool autoadjust_ruleset_data ( void  )

Apply some automatic defaults to already loaded rulesets.

Returns TRUE iff everything ok.

Definition at line 1576 of file rssanity.c.

Referenced by load_rulesetdir(), rscompat_postprocess(), and tab_misc::save_now().

◆ autolock_settings()

bool autolock_settings ( void  )

Set and lock settings that must have certain value.

Definition at line 1673 of file rssanity.c.

Referenced by settings_ruleset().

◆ effect_list_sanity_cb()

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

Sanity check callback for iterating effects cache.

Definition at line 535 of file rssanity.c.

Referenced by sanity_check_ruleset_data().

◆ nation_has_initial_tech()

static bool nation_has_initial_tech ( struct nation_type pnation,
struct advance tech 
)
static

Does nation have tech initially?

Definition at line 77 of file rssanity.c.

Referenced by sanity_check_ruleset_data().

◆ rs_barbarian_units()

static bool rs_barbarian_units ( rs_conversion_logger  logger)
static

Sanity check barbarian unit types

Definition at line 628 of file rssanity.c.

Referenced by sanity_check_ruleset_data().

◆ rs_buildings()

static bool rs_buildings ( rs_conversion_logger  logger)
static

Sanity check buildings

Definition at line 779 of file rssanity.c.

Referenced by sanity_check_ruleset_data().

◆ rs_common_units()

static bool rs_common_units ( rs_conversion_logger  logger)
static

Sanity check common unit types

Definition at line 700 of file rssanity.c.

Referenced by sanity_check_ruleset_data().

◆ sanity_check_boolean_effects()

static bool sanity_check_boolean_effects ( rs_conversion_logger  logger)
static

Check that boolean effect types have sensible effects.

Definition at line 826 of file rssanity.c.

Referenced by sanity_check_ruleset_data().

◆ sanity_check_metadata()

static bool sanity_check_metadata ( rs_conversion_logger  logger)
static

Is non-rule data in ruleset sane?

Definition at line 59 of file rssanity.c.

Referenced by sanity_check_ruleset_data().

◆ sanity_check_req_individual()

static bool sanity_check_req_individual ( rs_conversion_logger  logger,
struct requirement preq,
const char list_for 
)
static

Sanity checks on a requirement in isolation. This will generally be things that could only not be checked at ruleset load time because they would have referenced things not yet loaded from the ruleset.

Definition at line 169 of file rssanity.c.

Referenced by sanity_check_req_set().

◆ sanity_check_req_set()

static bool sanity_check_req_set ( rs_conversion_logger  logger,
int  reqs_of_type[],
int  local_reqs_of_type[],
int  tile_reqs_of_type[],
struct requirement preq,
bool  conjunctive,
int  max_tiles,
const char list_for 
)
static

Helper function for sanity_check_req_vec()

Definition at line 256 of file rssanity.c.

Referenced by sanity_check_req_vec().

◆ sanity_check_req_vec()

static bool sanity_check_req_vec ( rs_conversion_logger  logger,
const struct requirement_vector preqs,
bool  conjunctive,
int  max_tiles,
const char list_for 
)
static

Sanity check requirement vector, including whether it's free of conflicting requirements. 'conjunctive' should be TRUE if the vector is an AND vector (all requirements must be active), FALSE if it's a disjunctive (OR) vector. max_tiles is number of tiles that can provide requirement. Value -1 disables checking based on number of tiles.

Returns TRUE iff everything ok.

TODO: This is based on current hardcoded range limitations.

  • There should be method of automatically determining these limitations for each requirement type
  • This function should check also problems caused by defining range to less than hardcoded max for requirement type

Definition at line 493 of file rssanity.c.

Referenced by effect_list_sanity_cb(), and sanity_check_ruleset_data().

◆ sanity_check_ruleset_data()

bool sanity_check_ruleset_data ( struct rscompat_info compat)

Some more sanity checking once all rulesets are loaded. These check for some cross-referencing which was impossible to do while only one party was loaded in load_ruleset_xxx()

Returns TRUE iff everything ok.

Definition at line 878 of file rssanity.c.

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

◆ sanity_check_server_setting_value_in_req()

bool sanity_check_server_setting_value_in_req ( ssetv  ssetval)

Returns TRUE iff the given server setting and value combination is allowed to appear in ServerSetting requirements.

Definition at line 142 of file rssanity.c.

Referenced by universal_kind_values().

◆ sanity_check_setting_is_game_rule()

static bool sanity_check_setting_is_game_rule ( struct setting pset)
static

Returns TRUE iff the specified server setting is a game rule and therefore may appear in a requirement.

Definition at line 115 of file rssanity.c.

Referenced by sanity_check_req_individual(), and sanity_check_server_setting_value_in_req().

◆ sanity_check_setting_is_seen()

static bool sanity_check_setting_is_seen ( struct setting pset)
static

Returns TRUE iff the given server setting is visible enough to be allowed to appear in ServerSetting requirements.

Definition at line 106 of file rssanity.c.

Referenced by sanity_check_req_individual(), and sanity_check_server_setting_value_in_req().

Variable Documentation

◆ req_base_effects

enum effect_type req_base_effects[]
Initial value:
=
{
}
char * incite_cost
Definition comments.c:75

Definition at line 43 of file rssanity.c.

Referenced by effect_list_sanity_cb(), and sanity_check_ruleset_data().

◆ req_base_effects_3_2

enum effect_type req_base_effects_3_2[]
Initial value:

Definition at line 50 of file rssanity.c.

Referenced by effect_list_sanity_cb(), and sanity_check_ruleset_data().