![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <cstdarg>#include <cstdlib>#include <cstring>#include "bitvector.h"#include "deprecations.h"#include "fcintl.h"#include "registry.h"#include "registry_ini.h"#include "shared.h"#include "support.h"#include "achievements.h"#include "actions.h"#include "ai.h"#include "base.h"#include "city.h"#include "effects.h"#include "extras.h"#include "fc_types.h"#include "featured_text.h"#include "game.h"#include "government.h"#include "map.h"#include "movement.h"#include "multipliers.h"#include "name_translation.h"#include "nation.h"#include "packets.h"#include "player.h"#include "requirements.h"#include "rgbcolor.h"#include "road.h"#include "specialist.h"#include "style.h"#include "tech.h"#include "traderoutes.h"#include "notify.h"#include "plrhand.h"#include "rscompat.h"#include "rssanity.h"#include "settings.h"#include "srv_main.h"#include "advruleset.h"#include "script_server.h"#include "ruleset.h"#include "unittype.h"
Include dependency graph for ruleset.cpp:Go to the source code of this file.
Functions | |
| static bool | load_rulesetdir (const char *rsdir, bool compat_mode, rs_conversion_logger logger, bool act, bool buffer_script, bool load_luadata) |
| Loads the rulesets from directory. More... | |
| static struct section_file * | openload_ruleset_file (const char *whichset, const char *rsdir) |
| Do initial section_file_load on a ruleset file. More... | |
| static bool | load_game_names (struct section_file *file, struct rscompat_info *compat) |
| Load names from game.ruleset so other rulesets can refer to objects with their name. More... | |
| static bool | load_tech_names (struct section_file *file, struct rscompat_info *compat) |
| Load names of technologies so other rulesets can refer to techs with their name. More... | |
| static bool | load_unit_names (struct section_file *file, struct rscompat_info *compat) |
| Load names of units so other rulesets can refer to units with their name. More... | |
| static bool | load_building_names (struct section_file *file, struct rscompat_info *compat) |
| Load names of buildings so other rulesets can refer to buildings with their name. More... | |
| static bool | load_government_names (struct section_file *file, struct rscompat_info *compat) |
| Load names of governments so other rulesets can refer to governments with their name. More... | |
| static bool | load_terrain_names (struct section_file *file, struct rscompat_info *compat) |
| Load names of terrain types so other rulesets can refer to terrains with their name. More... | |
| static bool | load_style_names (struct section_file *file, struct rscompat_info *compat) |
| Load names of nation styles so other rulesets can refer to styles with their name. More... | |
| static bool | load_nation_names (struct section_file *file, struct rscompat_info *compat) |
| Load names of nations so other rulesets can refer to nations with their name. More... | |
| static bool | load_city_name_list (struct section_file *file, struct nation_type *pnation, const char *secfile_str1, const char *secfile_str2, const char **allowed_terrains, size_t atcount) |
| This function loads a city name list from a section file. More... | |
| static bool | load_ruleset_techs (struct section_file *file, struct rscompat_info *compat) |
| Load technologies related ruleset data. More... | |
| static bool | load_ruleset_units (struct section_file *file, struct rscompat_info *compat) |
| Load units related ruleset data. More... | |
| static bool | load_ruleset_buildings (struct section_file *file, struct rscompat_info *compat) |
| Load buildings related ruleset data. More... | |
| static bool | load_ruleset_governments (struct section_file *file, struct rscompat_info *compat) |
| This loads information from given governments.ruleset. More... | |
| static bool | load_ruleset_terrain (struct section_file *file, struct rscompat_info *compat) |
| Load terrain types related ruleset data. More... | |
| static bool | load_ruleset_styles (struct section_file *file, struct rscompat_info *compat) |
| Load styles.ruleset file. More... | |
| static bool | load_ruleset_cities (struct section_file *file, struct rscompat_info *compat) |
| Load cities.ruleset file. More... | |
| static bool | load_ruleset_effects (struct section_file *file, struct rscompat_info *compat) |
| Load effects.ruleset file. More... | |
| static bool | load_ruleset_game (struct section_file *file, bool act, struct rscompat_info *compat) |
| Load ruleset file. More... | |
| static void | send_ruleset_tech_classes (struct conn_list *dest) |
| Send the techs class information to the specified connections. More... | |
| static void | send_ruleset_techs (struct conn_list *dest) |
| Send the techs ruleset information (all individual advances) to the specified connections. More... | |
| static void | send_ruleset_unit_classes (struct conn_list *dest) |
| Send the units ruleset information (all individual unit classes) to the specified connections. More... | |
| static void | send_ruleset_units (struct conn_list *dest) |
| Send the units ruleset information (all individual units) to the specified connections. More... | |
| static void | send_ruleset_buildings (struct conn_list *dest) |
| Send the buildings ruleset information (all individual improvements and wonders) to the specified connections. More... | |
| static void | send_ruleset_terrain (struct conn_list *dest) |
| Send the terrain ruleset information (terrain_control, and the individual terrain types) to the specified connections. More... | |
| static void | send_ruleset_resources (struct conn_list *dest) |
| Send the resource ruleset information to the specified connections. More... | |
| static void | send_ruleset_extras (struct conn_list *dest) |
| Send the extra ruleset information (all individual extra types) to the specified connections. More... | |
| static void | send_ruleset_bases (struct conn_list *dest) |
| Send the base ruleset information (all individual base types) to the specified connections. More... | |
| static void | send_ruleset_roads (struct conn_list *dest) |
| Send the road ruleset information (all individual road types) to the specified connections. More... | |
| static void | send_ruleset_goods (struct conn_list *dest) |
| Send the goods ruleset information (all individual goods types) to the specified connections. More... | |
| static void | send_ruleset_governments (struct conn_list *dest) |
| Send the government ruleset information to the specified connections. More... | |
| static void | send_ruleset_styles (struct conn_list *dest) |
| Send the nation style ruleset information (each style) to the specified connections. More... | |
| static void | send_ruleset_clauses (struct conn_list *dest) |
| Send the clause type ruleset information to the specified connections. More... | |
| static void | send_ruleset_musics (struct conn_list *dest) |
| Send the music-style ruleset information (each style) to the specified connections. More... | |
| static void | send_ruleset_cities (struct conn_list *dest) |
| Send the city-style ruleset information (each style) to the specified connections. More... | |
| static void | send_ruleset_game (struct conn_list *dest) |
| Send information in packet_ruleset_game (miscellaneous rules) to the specified connections. More... | |
| static void | send_ruleset_team_names (struct conn_list *dest) |
| Send all team names defined in the ruleset file(s) to the specified connections. More... | |
| static bool | load_ruleset_veteran (struct section_file *file, const char *path, struct veteran_system **vsystem, char *err, size_t err_len, bool compat) |
| Load veteran levels. More... | |
| static int | secfile_lookup_int_default_min_max (struct section_file *file, int def, int min, int max, const char *path,...) |
| Print an error message if the value is out of range. More... | |
| static QString | valid_ruleset_filename (const char *subdir, const char *name, const char *extension, bool optional) |
| datafilename() wrapper: tries to match in two ways. More... | |
| char * | get_script_buffer () |
| Return current script.lua buffer. More... | |
| char * | get_parser_buffer () |
| Return current parser.lua buffer. More... | |
| static enum fc_tristate | openload_script_file (const char *whichset, const char *rsdir, char **buffer, bool optional) |
| Parse script file. More... | |
| static struct section_file * | openload_luadata_file (const char *rsdir) |
| Load optional luadata.txt. More... | |
| struct requirement_vector * | lookup_req_list (struct section_file *file, struct rscompat_info *compat, const char *sec, const char *sub, const char *rfor) |
| Load a requirement list. More... | |
| static bool | lookup_cbonus_list (struct rscompat_info *compat, struct combat_bonus_list *list, struct section_file *file, const char *sec, const char *sub) |
| Load combat bonus list. More... | |
| static bool | lookup_tech (struct section_file *file, struct advance **result, const char *prefix, const char *entry, const char *filename, const char *description) |
| Lookup a string prefix.entry in the file and return the corresponding advances pointer. More... | |
| static bool | lookup_building (struct section_file *file, const char *prefix, const char *entry, struct impr_type **result, const char *filename, const char *description) |
| Lookup a string prefix.entry in the file and return the corresponding improvement pointer. More... | |
| static bool | lookup_unit_list (struct section_file *file, const char *prefix, const char *entry, std::array< unit_type *, MAX_NUM_UNIT_LIST > &output, const char *filename) |
| Lookup a prefix.entry string vector in the file and fill in the array, which should hold MAX_NUM_UNIT_LIST items. More... | |
| static bool | lookup_tech_list (struct section_file *file, const char *prefix, const char *entry, int *output, const char *filename) |
| Lookup a prefix.entry string vector in the file and fill in the array, which should hold MAX_NUM_TECH_LIST items. More... | |
| static bool | lookup_building_list (struct section_file *file, const char *prefix, const char *entry, int *output, const char *filename) |
| Lookup a prefix.entry string vector in the file and fill in the array, which should hold MAX_NUM_BUILDING_LIST items. More... | |
| static bool | lookup_unit_type (struct section_file *file, const char *prefix, const char *entry, const struct unit_type **result, const char *filename, const char *description) |
| Lookup a string prefix.entry in the file and set result to the corresponding unit_type. More... | |
| static struct government * | lookup_government (struct section_file *file, const char *entry, const char *filename, struct government *fallback) |
| Lookup entry in the file and return the corresponding government index. More... | |
| static char * | lookup_string (struct section_file *file, const char *prefix, const char *suffix) |
| Lookup optional string, returning allocated memory or nullptr. More... | |
| static void | strvec_store (QVector< QString > *psv, const char *const *vec, size_t size) |
| Stores the string vector from a normal vector. More... | |
| static QVector< QString > * | lookup_strvec (struct section_file *file, const char *prefix, const char *suffix) |
| Lookup optional string vector, returning allocated memory or nullptr. More... | |
| static struct extra_type * | lookup_resource (const char *filename, const char *name, const char *jsection) |
| Look up the resource section name and return its pointer. More... | |
| static bool | lookup_terrain (struct section_file *file, const char *entry, const char *filename, struct terrain *pthis, struct terrain **result) |
| Look up the terrain by name and return its pointer. More... | |
| static bool | lookup_time (const struct section_file *secfile, int *turns, const char *sec_name, const char *property_name, const char *filename, const char *item_name, bool *ok) |
| Look up a value comparable to activity_count (road_time, etc). More... | |
| static bool | ruleset_load_names (struct name_translation *pname, const char *domain, struct section_file *file, const char *sec_name) |
| Load "name" and (optionally) "rule_name" into a struct name_translation. More... | |
| static void | ruleset_load_traits (struct trait_limits *out, struct section_file *file, const char *secname, const char *field_prefix) |
| Load trait values to array. More... | |
| static void | send_ruleset_control (struct conn_list *dest) |
| Send information in packet_ruleset_control (numbers of units etc, and other miscellany) to specified connections. More... | |
| static const char * | check_leader_names (struct nation_type *pnation) |
| Check for duplicate leader names in nation. More... | |
| static bool | is_on_allowed_list (const char *name, const char **list, size_t len) |
| Check if a string is in a vector (case-insensitively). More... | |
| static bool | load_ruleset_nations (struct section_file *file, struct rscompat_info *compat) |
| Load nations.ruleset file. More... | |
| static bool | load_action_auto_uflag_block (struct section_file *file, struct action_auto_perf *auto_perf, const char *uflags_path, const char *filename) |
| Load a list of unit type flags that must be absent from the actor unit if an action auto performer should be triggered into an action auto performer. More... | |
| static bool | load_action_auto_actions (struct section_file *file, struct action_auto_perf *auto_perf, const char *actions_path, const char *filename) |
| Load the list of actions an action auto performer should try. More... | |
| static bool | load_muuk_as_action_auto (struct section_file *file, struct action_auto_perf *auto_perf, const char *item, const char *filename) |
| Load missing unit upkeep ruleset settings as action auto performers. More... | |
| static bool | load_action_ui_name (struct section_file *file, int act, const char *entry_name) |
| Load ui_name of one action. More... | |
| static bool | load_action_range_max (struct section_file *file, action_id act) |
| Load max range of an action. More... | |
| static bool | load_action_range (struct section_file *file, action_id act) |
| Load range of an action. More... | |
| static bool | load_action_kind (struct section_file *file, action_id act) |
| Load kind of an action. More... | |
| static bool | load_action_actor_consuming_always (struct section_file *file, action_id act) |
| Load if the action always consumes the actor. More... | |
| static void | send_ruleset_specialists (struct conn_list *dest) |
| Send the specialists ruleset information (all individual specialist types) to the specified connections. More... | |
| static void | send_ruleset_disasters (struct conn_list *dest) |
| Send the disaster ruleset information (all individual disaster types) to the specified connections. More... | |
| static void | send_ruleset_achievements (struct conn_list *dest) |
| Send the achievement ruleset information (all individual achievement types) to the specified connections. More... | |
| static void | send_ruleset_actions (struct conn_list *dest) |
| Send action ruleset information to the specified connections. More... | |
| static void | send_ruleset_action_enablers (struct conn_list *dest) |
| Send the action enabler ruleset information to the specified connections. More... | |
| static void | send_ruleset_action_auto_performers (struct conn_list *dest) |
| Send action auto performer ruleset information to the specified connections. More... | |
| static void | send_ruleset_trade_routes (struct conn_list *dest) |
| Send the trade route types ruleset information (all individual trade route types) to the specified connections. More... | |
| static void | send_ruleset_nations (struct conn_list *dest) |
| Send the nations ruleset information (info on each nation) to the specified connections. More... | |
| static void | send_ruleset_multipliers (struct conn_list *dest) |
| Send the multiplier ruleset information to the specified connections. More... | |
| static void | notify_ruleset_fallback (const char *msg) |
| Make it clear to everyone that requested ruleset has not been loaded. More... | |
| bool | load_rulesets (const char *restore, const char *alt, bool compat_mode, rs_conversion_logger logger, bool act, bool buffer_script, bool load_luadata) |
| Loads the rulesets. More... | |
| static void | nullcheck_secfile_destroy (struct section_file *file) |
| Destroy secfile. More... | |
| void | rulesets_deinit () |
| Completely deinitialize ruleset system. More... | |
| bool | reload_rulesets_settings () |
| Reload the game settings saved in the ruleset file. More... | |
| void | send_rulesets (struct conn_list *dest) |
| Send all ruleset information to the specified connections. More... | |
Variables | |
| static const char | name_too_long [] = "Name \"%s\" too long; truncating." |
| static char(* | resource_sections )[MAX_SECTION_LABEL] = nullptr |
| static char(* | terrain_sections )[MAX_SECTION_LABEL] = nullptr |
| static char(* | extra_sections )[MAX_SECTION_LABEL] = nullptr |
| static char(* | base_sections )[MAX_SECTION_LABEL] = nullptr |
| static char(* | road_sections )[MAX_SECTION_LABEL] = nullptr |
| static struct requirement_vector | reqs_list |
| static int char * | script_buffer = nullptr |
| char * | parser_buffer = nullptr |
| #define ACHIEVEMENT_SECTION_PREFIX "achievement_" |
Definition at line 96 of file ruleset.cpp.
| #define ACTION_ENABLER_SECTION_PREFIX "actionenabler_" |
Definition at line 97 of file ruleset.cpp.
| #define ADVANCE_SECTION_PREFIX "advance_" |
Definition at line 74 of file ruleset.cpp.
| #define BASE_SECTION_PREFIX "base_" |
Definition at line 87 of file ruleset.cpp.
| #define BUILDING_SECTION_PREFIX "building_" |
Definition at line 76 of file ruleset.cpp.
| #define check_cityname | ( | name | ) | (check_strlen(name, MAX_LEN_CITYNAME, nullptr)) |
Definition at line 101 of file ruleset.cpp.
| #define check_name | ( | name | ) | (check_strlen(name, MAX_LEN_NAME, nullptr)) |
Definition at line 100 of file ruleset.cpp.
| #define CITYSTYLE_SECTION_PREFIX "citystyle_" |
Definition at line 77 of file ruleset.cpp.
| #define CLAUSE_SECTION_PREFIX "clause_" |
Definition at line 85 of file ruleset.cpp.
| #define DISASTER_SECTION_PREFIX "disaster_" |
Definition at line 95 of file ruleset.cpp.
| #define EFFECT_SECTION_PREFIX "effect_" |
Definition at line 79 of file ruleset.cpp.
| #define EXTRA_SECTION_PREFIX "extra_" |
Definition at line 86 of file ruleset.cpp.
| #define GOODS_SECTION_PREFIX "goods_" |
Definition at line 90 of file ruleset.cpp.
| #define GOVERNMENT_SECTION_PREFIX "government_" |
Definition at line 80 of file ruleset.cpp.
| #define MAX_SECTION_LABEL 64 |
Definition at line 105 of file ruleset.cpp.
| #define MULTIPLIER_SECTION_PREFIX "multiplier_" |
Definition at line 98 of file ruleset.cpp.
| #define MUSICSTYLE_SECTION_PREFIX "musicstyle_" |
Definition at line 78 of file ruleset.cpp.
| #define NATION_GROUP_SECTION_PREFIX "ngroup" |
Definition at line 82 of file ruleset.cpp.
| #define NATION_SECTION_PREFIX "nation" |
Definition at line 83 of file ruleset.cpp.
| #define NATION_SET_SECTION_PREFIX "nset" |
Definition at line 81 of file ruleset.cpp.
| #define RESOURCE_SECTION_PREFIX "resource_" |
Definition at line 89 of file ruleset.cpp.
| #define ROAD_SECTION_PREFIX "road_" |
Definition at line 88 of file ruleset.cpp.
| #define rs_sanity_veteran | ( | _path, | |
| _entry, | |||
| _i, | |||
| _condition, | |||
| _action | |||
| ) |
| #define RULES_SUFFIX "ruleset" |
Definition at line 71 of file ruleset.cpp.
| #define SCRIPT_SUFFIX "lua" |
Definition at line 72 of file ruleset.cpp.
| #define section_strlcpy | ( | dst, | |
| src | |||
| ) | (void) loud_strlcpy(dst, src, MAX_SECTION_LABEL, name_too_long) |
Definition at line 106 of file ruleset.cpp.
| #define SPECIALIST_SECTION_PREFIX "specialist_" |
Definition at line 91 of file ruleset.cpp.
| #define STYLE_SECTION_PREFIX "style_" |
Definition at line 84 of file ruleset.cpp.
| #define TECH_CLASS_SECTION_PREFIX "techclass_" |
Definition at line 75 of file ruleset.cpp.
| #define TERRAIN_SECTION_PREFIX "terrain_" |
Definition at line 92 of file ruleset.cpp.
| #define UNIT_CLASS_SECTION_PREFIX "unitclass_" |
Definition at line 93 of file ruleset.cpp.
| #define UNIT_SECTION_PREFIX "unit_" |
Definition at line 94 of file ruleset.cpp.
|
static |
Check for duplicate leader names in nation.
If no duplicates return nullptr; if yes return pointer to name which is repeated.
Definition at line 4250 of file ruleset.cpp.
Referenced by load_ruleset_nations().
| char* get_parser_buffer | ( | ) |
Return current parser.lua buffer.
Definition at line 249 of file ruleset.cpp.
Referenced by save_ruleset().
| char* get_script_buffer | ( | ) |
Return current script.lua buffer.
Definition at line 244 of file ruleset.cpp.
Referenced by save_ruleset().
|
static |
Check if a string is in a vector (case-insensitively).
Definition at line 4412 of file ruleset.cpp.
Referenced by load_city_name_list(), and load_ruleset_nations().
|
static |
Load if the action always consumes the actor.
Definition at line 6024 of file ruleset.cpp.
Referenced by load_ruleset_game().
|
static |
Load the list of actions an action auto performer should try.
The actions will be tried in the given order.
Definition at line 5515 of file ruleset.cpp.
Referenced by load_muuk_as_action_auto(), and load_ruleset_game().
|
static |
Load a list of unit type flags that must be absent from the actor unit if an action auto performer should be triggered into an action auto performer.
Definition at line 5474 of file ruleset.cpp.
Referenced by load_muuk_as_action_auto().
|
static |
Load kind of an action.
Definition at line 6008 of file ruleset.cpp.
Referenced by load_ruleset_game().
|
static |
Load range of an action.
Definition at line 5986 of file ruleset.cpp.
Referenced by load_ruleset_game().
|
static |
Load max range of an action.
Definition at line 5951 of file ruleset.cpp.
Referenced by load_action_range().
|
static |
Load ui_name of one action.
Definition at line 5936 of file ruleset.cpp.
Referenced by load_ruleset_game().
|
static |
Load names of buildings so other rulesets can refer to buildings with their name.
Definition at line 2334 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
This function loads a city name list from a section file.
The file and two section names (which will be concatenated) are passed in.
Definition at line 4430 of file ruleset.cpp.
Referenced by load_ruleset_nations().
|
static |
Load names from game.ruleset so other rulesets can refer to objects with their name.
Definition at line 1032 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load names of governments so other rulesets can refer to governments with their name.
Also load multiplier names/count from governments.ruleset.
Definition at line 3937 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load missing unit upkeep ruleset settings as action auto performers.
Definition at line 5551 of file ruleset.cpp.
Referenced by load_ruleset_cities().
|
static |
Load names of nations so other rulesets can refer to nations with their name.
Definition at line 4274 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load buildings related ruleset data.
Definition at line 2389 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load cities.ruleset file.
Definition at line 5571 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load effects.ruleset file.
Definition at line 5780 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
|
static |
This loads information from given governments.ruleset.
Definition at line 4020 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load nations.ruleset file.
Definition at line 4597 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load styles.ruleset file.
Definition at line 5385 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load technologies related ruleset data.
Definition at line 1251 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load terrain types related ruleset data.
Definition at line 2833 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load units related ruleset data.
Definition at line 1765 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load veteran levels.
Definition at line 1645 of file ruleset.cpp.
Referenced by load_ruleset_units().
|
static |
Loads the rulesets from directory.
This may be called more than once and it will free any stale data.
Definition at line 8661 of file ruleset.cpp.
Referenced by load_rulesets().
| bool load_rulesets | ( | const char * | restore, |
| const char * | alt, | ||
| bool | compat_mode, | ||
| rs_conversion_logger | logger, | ||
| bool | act, | ||
| bool | buffer_script, | ||
| bool | load_luadata | ||
| ) |
Loads the rulesets.
Definition at line 8582 of file ruleset.cpp.
Referenced by ruledit_gui::launch_now(), main(), manual_command(), savegame2_load(), savegame3_load(), set_rulesetdir(), sg_load_ruleset(), sg_load_savefile(), and freeciv::server::shut_game_down().
|
static |
Load names of nation styles so other rulesets can refer to styles with their name.
Definition at line 5318 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load names of technologies so other rulesets can refer to techs with their name.
Definition at line 1125 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load names of terrain types so other rulesets can refer to terrains with their name.
Definition at line 2501 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load names of units so other rulesets can refer to units with their name.
Definition at line 1475 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Lookup a string prefix.entry in the file and return the corresponding improvement pointer.
Return B_NEVER for match "None" or can't match. If description is not nullptr, it is used in the warning message instead of prefix (eg pass unit->name instead of prefix="units2.u27")
Definition at line 571 of file ruleset.cpp.
Referenced by load_ruleset_units().
|
static |
Lookup a prefix.entry string vector in the file and fill in the array, which should hold MAX_NUM_BUILDING_LIST items.
The output array is either B_LAST terminated or full (contains MAX_NUM_BUILDING_LIST items). [All valid entries of the output array are guaranteed to pass improvement_exist()?]
Definition at line 726 of file ruleset.cpp.
Referenced by load_ruleset_game(), and load_ruleset_nations().
|
static |
Load combat bonus list.
Definition at line 478 of file ruleset.cpp.
Referenced by load_ruleset_units().
|
static |
Lookup entry in the file and return the corresponding government index.
filename is for error message.
Definition at line 809 of file ruleset.cpp.
Referenced by load_ruleset_governments(), load_ruleset_nations(), and load_ruleset_units().
| struct requirement_vector* lookup_req_list | ( | struct section_file * | file, |
| struct rscompat_info * | compat, | ||
| const char * | sec, | ||
| const char * | sub, | ||
| const char * | rfor | ||
| ) |
Load a requirement list.
The list is returned as a static vector (callers need not worry about freeing anything).
Definition at line 338 of file ruleset.cpp.
Referenced by effect_to_enabler(), load_ruleset_buildings(), load_ruleset_cities(), load_ruleset_effects(), load_ruleset_game(), load_ruleset_governments(), load_ruleset_styles(), load_ruleset_techs(), and load_ruleset_terrain().
|
static |
Look up the resource section name and return its pointer.
Definition at line 897 of file ruleset.cpp.
Referenced by load_ruleset_terrain().
|
static |
Lookup optional string, returning allocated memory or nullptr.
Definition at line 833 of file ruleset.cpp.
Referenced by load_ruleset_techs().
|
static |
Lookup optional string vector, returning allocated memory or nullptr.
Definition at line 874 of file ruleset.cpp.
Referenced by load_ruleset_buildings(), load_ruleset_cities(), load_ruleset_game(), load_ruleset_governments(), load_ruleset_techs(), load_ruleset_terrain(), and load_ruleset_units().
|
static |
Lookup a string prefix.entry in the file and return the corresponding advances pointer.
If (!required), return A_NEVER for match "Never" or can't match. If (required), die when can't match. Note the first tech should have name "None" so that will always match. If description is not nullptr, it is used in the warning message instead of prefix (eg pass unit->name instead of prefix="units2.u27")
Definition at line 541 of file ruleset.cpp.
Referenced by load_ruleset_techs(), and load_ruleset_units().
|
static |
Lookup a prefix.entry string vector in the file and fill in the array, which should hold MAX_NUM_TECH_LIST items.
The output array is either A_LAST terminated or full (contains MAX_NUM_TECH_LIST items). All valid entries of the output array are guaranteed to exist.
Definition at line 657 of file ruleset.cpp.
Referenced by load_ruleset_game(), and load_ruleset_nations().
|
static |
Look up the terrain by name and return its pointer.
filename is for error message.
Definition at line 915 of file ruleset.cpp.
Referenced by load_ruleset_terrain().
|
static |
Look up a value comparable to activity_count (road_time, etc).
item_name describes the thing which has the time property, if non-nullptr, for any error message. Returns FALSE if not found in secfile, but TRUE even if validation failed. Sets *ok to FALSE if validation failed, leaves it alone otherwise.
Definition at line 955 of file ruleset.cpp.
Referenced by load_ruleset_terrain(), and load_ruleset_units().
|
static |
Lookup a prefix.entry string vector in the file and fill in the array, which should hold MAX_NUM_UNIT_LIST items.
The output array is either nullptr terminated or full (contains MAX_NUM_UNIT_LIST items). If the vector is not found and the required parameter is set, we report it as an error, otherwise we just punt.
Definition at line 602 of file ruleset.cpp.
Referenced by load_ruleset_nations().
|
static |
Lookup a string prefix.entry in the file and set result to the corresponding unit_type.
If description is not nullptr, it is used in the warning message instead of prefix (eg pass unit->name instead of prefix="units2.u27")
Definition at line 780 of file ruleset.cpp.
Referenced by load_ruleset_terrain(), and load_ruleset_units().
|
static |
Make it clear to everyone that requested ruleset has not been loaded.
Definition at line 8574 of file ruleset.cpp.
Referenced by load_rulesets().
|
static |
Destroy secfile.
Handle nullptr parameter gracefully.
Definition at line 8640 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Load optional luadata.txt.
Definition at line 311 of file ruleset.cpp.
Referenced by load_rulesetdir().
|
static |
Do initial section_file_load on a ruleset file.
"whichset" = "techs", "units", "buildings", "terrain", ...
Definition at line 255 of file ruleset.cpp.
Referenced by load_rulesetdir(), and reload_rulesets_settings().
|
static |
| bool reload_rulesets_settings | ( | ) |
Reload the game settings saved in the ruleset file.
Definition at line 8868 of file ruleset.cpp.
Referenced by reset_command().
|
static |
Load "name" and (optionally) "rule_name" into a struct name_translation.
Definition at line 982 of file ruleset.cpp.
Referenced by load_building_names(), load_game_names(), load_government_names(), load_nation_names(), load_ruleset_cities(), load_ruleset_game(), load_style_names(), load_tech_names(), load_terrain_names(), and load_unit_names().
|
static |
Load trait values to array.
Definition at line 1003 of file ruleset.cpp.
Referenced by load_ruleset_nations().
| void rulesets_deinit | ( | ) |
Completely deinitialize ruleset system.
Server is not in usable state after this.
Definition at line 8651 of file ruleset.cpp.
Referenced by server_quit().
|
static |
Print an error message if the value is out of range.
Definition at line 5898 of file ruleset.cpp.
Referenced by load_ruleset_game(), and load_unit_names().
|
static |
Send the achievement ruleset information (all individual achievement types) to the specified connections.
Definition at line 8020 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send action auto performer ruleset information to the specified connections.
Definition at line 8108 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the action enabler ruleset information to the specified connections.
Definition at line 8074 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send action ruleset information to the specified connections.
Definition at line 8043 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the base ruleset information (all individual base types) to the specified connections.
Definition at line 7886 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the buildings ruleset information (all individual improvements and wonders) to the specified connections.
Definition at line 7592 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the city-style ruleset information (each style) to the specified connections.
Definition at line 8428 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the clause type ruleset information to the specified connections.
Definition at line 8355 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send information in packet_ruleset_control (numbers of units etc, and other miscellany) to specified connections.
The client assumes that exactly one ruleset control packet is sent as a part of each ruleset send. So after sending this packet we have to resend every other part of the rulesets (and none of them should be is-info in the network code!). The client frees ruleset data when receiving this packet and then re-initializes as it receives the individual ruleset packets. See packhand.c.
Definition at line 4212 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the disaster ruleset information (all individual disaster types) to the specified connections.
Definition at line 7989 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the extra ruleset information (all individual extra types) to the specified connections.
Definition at line 7765 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send information in packet_ruleset_game (miscellaneous rules) to the specified connections.
Definition at line 8490 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the goods ruleset information (all individual goods types) to the specified connections.
Definition at line 7956 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the government ruleset information to the specified connections.
One packet per government type, and for each type one per ruler title.
Definition at line 8170 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the multiplier ruleset information to the specified connections.
Definition at line 8391 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the music-style ruleset information (each style) to the specified connections.
Definition at line 8460 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the nations ruleset information (info on each nation) to the specified connections.
Definition at line 8216 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the resource ruleset information to the specified connections.
Definition at line 7742 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the road ruleset information (all individual road types) to the specified connections.
Definition at line 7912 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the specialists ruleset information (all individual specialist types) to the specified connections.
Definition at line 7448 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the nation style ruleset information (each style) to the specified connections.
Definition at line 8337 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send all team names defined in the ruleset file(s) to the specified connections.
Definition at line 8550 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the techs class information to the specified connections.
Definition at line 7477 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the techs ruleset information (all individual advances) to the specified connections.
Definition at line 7497 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the terrain ruleset information (terrain_control, and the individual terrain types) to the specified connections.
Definition at line 7633 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the trade route types ruleset information (all individual trade route types) to the specified connections.
Definition at line 8148 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the units ruleset information (all individual unit classes) to the specified connections.
Definition at line 7266 of file ruleset.cpp.
Referenced by send_rulesets().
|
static |
Send the units ruleset information (all individual units) to the specified connections.
Definition at line 7319 of file ruleset.cpp.
Referenced by send_rulesets().
| void send_rulesets | ( | struct conn_list * | dest | ) |
Send all ruleset information to the specified connections.
Definition at line 8890 of file ruleset.cpp.
Referenced by establish_new_connection(), load_command(), and set_rulesetdir().
|
static |
Stores the string vector from a normal vector.
If size == -1, it will assume it is a nullptr terminated vector.
Definition at line 854 of file ruleset.cpp.
Referenced by lookup_strvec().
|
static |
datafilename() wrapper: tries to match in two ways.
Returns nullptr on failure, the (statically allocated) filename on success.
Definition at line 200 of file ruleset.cpp.
Referenced by openload_luadata_file(), and openload_ruleset_file().
|
static |
Definition at line 111 of file ruleset.cpp.
Referenced by load_ruleset_terrain(), load_rulesetdir(), and load_terrain_names().
|
static |
Definition at line 110 of file ruleset.cpp.
Referenced by load_ruleset_terrain(), load_rulesetdir(), and load_terrain_names().
|
static |
Definition at line 104 of file ruleset.cpp.
Referenced by names_set().
| char* parser_buffer = nullptr |
Definition at line 193 of file ruleset.cpp.
Referenced by get_parser_buffer(), and load_rulesetdir().
|
static |
Definition at line 112 of file ruleset.cpp.
Referenced by lookup_req_list(), and rulesets_deinit().
|
static |
Definition at line 108 of file ruleset.cpp.
Referenced by load_ruleset_terrain(), load_rulesetdir(), and load_terrain_names().
|
static |
Definition at line 112 of file ruleset.cpp.
Referenced by load_ruleset_terrain(), load_rulesetdir(), and load_terrain_names().
| int char* script_buffer = nullptr |
Definition at line 192 of file ruleset.cpp.
Referenced by get_script_buffer(), and load_rulesetdir().
|
static |
Definition at line 109 of file ruleset.cpp.
Referenced by load_ruleset_terrain(), load_rulesetdir(), load_terrain_names(), and lookup_terrain().