Freeciv21
Develop your civilization from humble roots to a global empire
rssanity.cpp File Reference
#include "deprecations.h"
#include "registry_ini.h"
#include "achievements.h"
#include "actions.h"
#include "effects.h"
#include "game.h"
#include "government.h"
#include "movement.h"
#include "nation.h"
#include "road.h"
#include "server_settings.h"
#include "specialist.h"
#include "style.h"
#include "tech.h"
#include "ruleset.h"
#include "settings.h"
#include "rssanity.h"
+ Include dependency graph for rssanity.cpp:

Go to the source code of this file.

Functions

static bool sanity_check_metadata ()
 Is non-rule data in ruleset sane? More...
 
static bool nation_has_initial_tech (const nation_type *pnation, struct advance *tech)
 Does nation have tech initially? More...
 
static bool sanity_check_setting_is_seen (struct setting *pset)
 Returns TRUE iff the given server setting is visible enough to be allowed to appear in ServerSetting requirements. More...
 
static bool sanity_check_setting_is_game_rule (struct setting *pset)
 Returns TRUE iff the specified server setting is a game rule and therefore may appear in a requirement. More...
 
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. More...
 
static bool sanity_check_req_individual (struct requirement *preq, const char *list_for)
 Sanity checks on a requirement in isolation. More...
 
static bool sanity_check_req_set (int reqs_of_type[], int local_reqs_of_type[], struct requirement *preq, bool conjunctive, int max_tiles, const char *list_for)
 Helper function for sanity_check_req_list() and sanity_check_req_vec() More...
 
static bool sanity_check_req_vec (const struct requirement_vector *preqs, bool conjunctive, int max_tiles, const char *list_for)
 Sanity check requirement vector, including whether it's free of conflicting requirements. More...
 
static bool effect_list_sanity_cb (struct effect *peffect, void *data)
 Sanity check callback for iterating effects cache. More...
 
static bool rs_barbarian_units ()
 Sanity check barbarian unit types. More...
 
static bool rs_common_units ()
 Sanity check common unit types. More...
 
static bool rs_buildings ()
 Sanity check buildings. More...
 
static bool sanity_check_boolean_effects ()
 Check that boolean effect types have sensible effects. More...
 
bool sanity_check_ruleset_data (bool ignore_retired)
 Some more sanity checking once all rulesets are loaded. More...
 
bool autoadjust_ruleset_data ()
 Apply some automatic defaults to already loaded rulesets. More...
 
bool autolock_settings ()
 Set and lock settings that must have certain value. More...
 

Function Documentation

◆ autoadjust_ruleset_data()

bool autoadjust_ruleset_data ( )

Apply some automatic defaults to already loaded rulesets.

Returns TRUE iff everything ok.

Definition at line 1389 of file rssanity.cpp.

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

◆ autolock_settings()

bool autolock_settings ( )

Set and lock settings that must have certain value.

Definition at line 1481 of file rssanity.cpp.

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 454 of file rssanity.cpp.

Referenced by sanity_check_ruleset_data().

◆ nation_has_initial_tech()

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

Does nation have tech initially?

Definition at line 57 of file rssanity.cpp.

Referenced by sanity_check_ruleset_data().

◆ rs_barbarian_units()

static bool rs_barbarian_units ( )
static

Sanity check barbarian unit types.

Definition at line 522 of file rssanity.cpp.

Referenced by sanity_check_ruleset_data().

◆ rs_buildings()

static bool rs_buildings ( )
static

Sanity check buildings.

Definition at line 651 of file rssanity.cpp.

Referenced by sanity_check_ruleset_data().

◆ rs_common_units()

static bool rs_common_units ( )
static

Sanity check common unit types.

Definition at line 599 of file rssanity.cpp.

Referenced by sanity_check_ruleset_data().

◆ sanity_check_boolean_effects()

static bool sanity_check_boolean_effects ( )
static

Check that boolean effect types have sensible effects.

Definition at line 681 of file rssanity.cpp.

Referenced by sanity_check_ruleset_data().

◆ sanity_check_metadata()

static bool sanity_check_metadata ( )
static

Is non-rule data in ruleset sane?

Definition at line 41 of file rssanity.cpp.

Referenced by sanity_check_ruleset_data().

◆ sanity_check_req_individual()

static bool sanity_check_req_individual ( 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 149 of file rssanity.cpp.

Referenced by sanity_check_req_set().

◆ sanity_check_req_set()

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

Helper function for sanity_check_req_list() and sanity_check_req_vec()

Definition at line 233 of file rssanity.cpp.

Referenced by sanity_check_req_vec().

◆ sanity_check_req_vec()

static bool sanity_check_req_vec ( 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 419 of file rssanity.cpp.

Referenced by effect_list_sanity_cb(), and sanity_check_ruleset_data().

◆ sanity_check_ruleset_data()

bool sanity_check_ruleset_data ( bool  ignore_retired)

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 716 of file rssanity.cpp.

Referenced by load_rulesetdir(), 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 122 of file rssanity.cpp.

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 95 of file rssanity.cpp.

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 86 of file rssanity.cpp.

Referenced by sanity_check_req_individual(), and sanity_check_server_setting_value_in_req().