Freeciv-3.2
|
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bitvector.h"
#include "deprecations.h"
#include "fcintl.h"
#include "log.h"
#include "mem.h"
#include "registry.h"
#include "shared.h"
#include "string_vector.h"
#include "support.h"
#include "achievements.h"
#include "actions.h"
#include "ai.h"
#include "base.h"
#include "capability.h"
#include "city.h"
#include "counters.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 "sex.h"
#include "specialist.h"
#include "style.h"
#include "tech.h"
#include "traderoutes.h"
#include "unit.h"
#include "unittype.h"
#include "citytools.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"
Go to the source code of this file.
Variables | |
static const char | name_too_long [] = "Name \"%s\" too long; truncating." |
static char * | resource_sections = NULL |
static char * | terrain_sections = NULL |
static char * | extra_sections = NULL |
static char * | base_sections = NULL |
static char * | road_sections = NULL |
static struct requirement_vector | reqs_list |
char * | script_buffer = NULL |
char * | parser_buffer = NULL |
#define check_cityname | ( | name | ) | (check_strlen(name, MAX_LEN_CITYNAME, NULL)) |
#define check_name | ( | name | ) | (check_strlen(name, MAX_LEN_NAME, NULL)) |
#define NATION_GROUP_SECTION_PREFIX "ngroup" /* without underscore? */ |
#define NATION_SECTION_PREFIX "nation" /* without underscore? */ |
#define NATION_SET_SECTION_PREFIX "nset" /* without underscore? */ |
#define section_strlcpy | ( | dst, | |
src | |||
) | (void) loud_strlcpy(dst, src, MAX_SECTION_LABEL, name_too_long) |
|
static |
Check for duplicate leader names in nation. If no duplicates return NULL; if yes return pointer to name which is repeated.
Definition at line 4696 of file ruleset.c.
Referenced by load_ruleset_nations().
Return current parser.lua buffer.
Definition at line 562 of file ruleset.c.
Referenced by save_ruleset().
Return current script.lua buffer.
Definition at line 554 of file ruleset.c.
Referenced by save_ruleset().
Check if a string is in a vector (case-insensitively).
Definition at line 4852 of file ruleset.c.
Referenced by load_city_name_list(), and load_ruleset_nations().
|
static |
Load if the action always consumes the actor
Definition at line 6532 of file ruleset.c.
Referenced by load_ruleset_actions().
|
static |
Load the list of actions an action auto performer should try. The actions will be tried in the given order.
Definition at line 5937 of file ruleset.c.
Referenced by load_action_post_success_force(), load_muuk_as_action_auto(), and load_ruleset_actions().
|
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 5894 of file ruleset.c.
Referenced by load_muuk_as_action_auto().
|
static |
Load what actions can block the action
Definition at line 6549 of file ruleset.c.
Referenced by load_ruleset_actions().
|
static |
Load kind of an action
Definition at line 6510 of file ruleset.c.
Referenced by load_ruleset_actions().
|
static |
Load names from actions.ruleset so other rulesets can refer to objects with their name.
Definition at line 1482 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load what actions an actor under certain circumstances will be forced to perform after successfully performing this action.
Definition at line 6593 of file ruleset.c.
Referenced by load_ruleset_actions().
|
static |
Load range of an action
Definition at line 6485 of file ruleset.c.
Referenced by load_ruleset_actions().
|
static |
Load max range of an action
Definition at line 6444 of file ruleset.c.
Referenced by load_action_range().
|
static |
Load ui_name of one action
Definition at line 6422 of file ruleset.c.
Referenced by load_ruleset_actions().
|
static |
Load names of buildings so other rulesets can refer to buildings with their name.
Definition at line 2646 of file ruleset.c.
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 4868 of file ruleset.c.
Referenced by load_ruleset_nations().
|
static |
Load names from game.ruleset so other rulesets can refer to objects with their name.
Definition at line 1352 of file ruleset.c.
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 4378 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load missing unit upkeep ruleset settings as action auto performers.
Definition at line 5973 of file ruleset.c.
Referenced by load_ruleset_cities().
|
static |
Load names of nations so other rulesets can refer to nations with their name.
Definition at line 4716 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Loads action information from a file
Definition at line 7732 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load buildings related ruleset data
Definition at line 2727 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load cities.ruleset file
Definition at line 5995 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load effects.ruleset file
Definition at line 6210 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
|
static |
This loads information from given governments.ruleset
Definition at line 4460 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load nations.ruleset file
Definition at line 5038 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load styles.ruleset file
Definition at line 5816 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load technologies related ruleset data
Definition at line 1620 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load terrain types related ruleset data
Definition at line 3191 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load units related ruleset data.
Definition at line 2110 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
|
static |
Loads the rulesets from directory. This may be called more than once and it will free any stale data.
Definition at line 9448 of file ruleset.c.
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 9358 of file ruleset.c.
Referenced by ruledit_gui::launch_now(), main(), manual_command(), savegame2_load(), savegame3_load(), set_rulesetdir(), sg_load_ruleset(), sg_load_savefile(), srv_main(), and srv_prepare().
|
static |
Load names of nation styles so other rulesets can refer to styles with their name.
Definition at line 5755 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load names of technologies so other rulesets can refer to techs with their name.
Definition at line 1502 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load names of terrain types so other rulesets can refer to terrains with their name.
Definition at line 2855 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load names of units so other rulesets can refer to units with their name.
Definition at line 1831 of file ruleset.c.
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 NULL, it is used in the warning message instead of prefix (eg pass unit->name instead of prefix="units2.u27")
Definition at line 888 of file ruleset.c.
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 1045 of file ruleset.c.
Referenced by load_ruleset_game(), and load_ruleset_nations().
|
static |
Load a list of actions from the ruleset to a bv_actions bit vector.
Definition at line 6630 of file ruleset.c.
Referenced by load_ruleset_actions().
|
static |
Load combat bonus list
Definition at line 797 of file ruleset.c.
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 1128 of file ruleset.c.
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 654 of file ruleset.c.
Referenced by load_ruleset_actions(), load_ruleset_buildings(), load_ruleset_cities(), load_ruleset_effects(), load_ruleset_game(), load_ruleset_governments(), load_ruleset_styles(), load_ruleset_techs(), load_ruleset_terrain(), and load_ruleset_units().
|
static |
Look up the resource section name and return its pointer.
Definition at line 1193 of file ruleset.c.
Referenced by load_ruleset_terrain().
|
static |
Lookup optional string, returning allocated memory or NULL.
Definition at line 1153 of file ruleset.c.
Referenced by load_ruleset_techs().
|
static |
Lookup optional string vector, returning allocated memory or NULL.
Definition at line 1173 of file ruleset.c.
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 NULL, it is used in the warning message instead of prefix (eg pass unit->name instead of prefix="units2.u27")
Definition at line 856 of file ruleset.c.
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 981 of file ruleset.c.
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 1214 of file ruleset.c.
Referenced by load_ruleset_terrain().
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). item_name describes the thing which has the time property, if non-NULL, 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 1264 of file ruleset.c.
Referenced by load_ruleset_terrain(), load_ruleset_units(), and rscompat_terrain_extra_rmtime_3_2().
|
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 NULL 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 921 of file ruleset.c.
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 NULL, it is used in the warning message instead of prefix (eg pass unit->name instead of prefix="units2.u27")
Definition at line 1097 of file ruleset.c.
Referenced by load_ruleset_terrain(), and load_ruleset_units().
Make it clear to everyone that requested ruleset has not been loaded.
Definition at line 9350 of file ruleset.c.
Referenced by load_rulesets().
|
static |
Destroy secfile. Handle NULL parameter gracefully.
Definition at line 9427 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Load optional luadata.txt
Definition at line 626 of file ruleset.c.
Referenced by load_rulesetdir().
|
static |
Do initial section_file_load on a ruleset file. "whichset" = "techs", "units", "buildings", "terrain", ...
Definition at line 571 of file ruleset.c.
Referenced by load_rulesetdir(), and reload_rulesets_settings().
|
static |
Purge the first duplicate requirement in a requirement vector.
Definition at line 367 of file ruleset.c.
Referenced by purge_redundant_req_vec().
|
static |
Purge the first redundant requirement in a requirement vector.
Definition at line 412 of file ruleset.c.
Referenced by ruleset_purge_redundant_reqs_effects(), and ruleset_purge_redundant_reqs_enablers().
|
static |
Purge the first unused requirement in a requirement vector.
Definition at line 327 of file ruleset.c.
Referenced by purge_redundant_req_vec().
Reload the game settings saved in the ruleset file.
Definition at line 9705 of file ruleset.c.
Referenced by reset_command().
|
static |
Load "name" and (optionally) "rule_name" into a struct name_translation.
Definition at line 1290 of file ruleset.c.
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 1313 of file ruleset.c.
Referenced by load_ruleset_nations().
Purge redundant requirements from effects.
Definition at line 461 of file ruleset.c.
Referenced by ruleset_purge_redundant_reqs().
Purge redundant requirements from action enablers.
Definition at line 423 of file ruleset.c.
Referenced by ruleset_purge_redundant_reqs().
Purge unused effects from the ruleset.
Definition at line 290 of file ruleset.c.
Referenced by ruleset_purge_unused_entities().
Purge unused action enablers from the ruleset.
Definition at line 244 of file ruleset.c.
Referenced by ruleset_purge_unused_entities().
Completely deinitialize ruleset system. Server is not in usable state after this.
Definition at line 9438 of file ruleset.c.
Referenced by server_quit().
|
static |
Print an error message if the value is out of range.
Definition at line 6384 of file ruleset.c.
Referenced by load_ruleset_game().
Send the achievement ruleset information (all individual achievement types) to the specified connections.
Definition at line 8839 of file ruleset.c.
Referenced by send_rulesets().
Send action auto performer ruleset information to the specified connections.
Definition at line 8918 of file ruleset.c.
Referenced by send_rulesets().
Send the action enabler ruleset information to the specified connections.
Definition at line 8890 of file ruleset.c.
Referenced by send_rulesets().
Send action ruleset information to the specified connections.
Definition at line 8860 of file ruleset.c.
Referenced by send_rulesets().
Send the base ruleset information (all individual base types) to the specified connections.
Definition at line 8715 of file ruleset.c.
Referenced by send_rulesets().
Send the buildings ruleset information (all individual improvements and wonders) to the specified connections.
Definition at line 8407 of file ruleset.c.
Referenced by send_rulesets().
Send the city-style ruleset information (each style) to the specified connections.
Definition at line 9213 of file ruleset.c.
Referenced by send_rulesets().
Send the clause type ruleset information to the specified connections.
Definition at line 9147 of file ruleset.c.
Referenced by send_rulesets().
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 4658 of file ruleset.c.
Referenced by send_rulesets().
Send the counters ruleset information to the specified connections.
Definition at line 8386 of file ruleset.c.
Referenced by send_rulesets().
Send the disaster ruleset information (all individual disaster types) to the specified connections.
Definition at line 8809 of file ruleset.c.
Referenced by send_rulesets().
Send the extra ruleset information (all individual extra types) to the specified connections.
Definition at line 8599 of file ruleset.c.
Referenced by send_rulesets().
Send information in packet_ruleset_game (miscellaneous rules) to the specified connections.
Definition at line 9267 of file ruleset.c.
Referenced by send_rulesets().
Send the goods ruleset information (all individual goods types) to the specified connections.
Definition at line 8777 of file ruleset.c.
Referenced by send_rulesets().
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 8975 of file ruleset.c.
Referenced by send_rulesets().
Send the multiplier ruleset information to the specified connections.
Definition at line 9179 of file ruleset.c.
Referenced by send_rulesets().
Send the music-style ruleset information (each style) to the specified connections.
Definition at line 9241 of file ruleset.c.
Referenced by send_rulesets().
Send the nations ruleset information (info on each nation) to the specified connections.
Definition at line 9021 of file ruleset.c.
Referenced by send_rulesets().
Send the resource ruleset information to the specified connections.
Definition at line 8580 of file ruleset.c.
Referenced by send_rulesets().
Send the road ruleset information (all individual road types) to the specified connections.
Definition at line 8737 of file ruleset.c.
Referenced by send_rulesets().
Send the specialists ruleset information (all individual specialist types) to the specified connections.
Definition at line 8249 of file ruleset.c.
Referenced by send_rulesets().
Send the nation style ruleset information (each style) to the specified connections.
Definition at line 9131 of file ruleset.c.
Referenced by send_rulesets().
Send all team names defined in the ruleset file(s) to the specified connections.
Definition at line 9328 of file ruleset.c.
Referenced by send_rulesets().
Send the techs class information to the specified connections.
Definition at line 8277 of file ruleset.c.
Referenced by send_rulesets().
Send the techs ruleset information (all individual advances) to the specified connections.
Definition at line 8295 of file ruleset.c.
Referenced by send_rulesets().
Send the terrain ruleset information (terrain_control, and the individual terrain types) to the specified connections.
Definition at line 8473 of file ruleset.c.
Referenced by send_rulesets().
Send the trade route types ruleset information (all individual trade route types) to the specified connections.
Definition at line 8954 of file ruleset.c.
Referenced by send_rulesets().
Send the units ruleset information (all individual unit classes) to the specified connections.
Definition at line 8062 of file ruleset.c.
Referenced by send_rulesets().
Send the units ruleset information (all individual units) to the specified connections.
Definition at line 8110 of file ruleset.c.
Referenced by send_rulesets().
Send all ruleset information to the specified connections.
Definition at line 9728 of file ruleset.c.
Referenced by establish_new_connection(), load_command(), and set_rulesetdir().
|
static |
datafilename() wrapper: tries to match in two ways. Returns NULL on failure, the (statically allocated) filename on success.
Definition at line 509 of file ruleset.c.
Referenced by openload_luadata_file(), openload_ruleset_file(), and openload_script_file().
Definition at line 126 of file ruleset.c.
Referenced by load_ruleset_terrain(), load_rulesetdir(), and load_terrain_names().
Definition at line 125 of file ruleset.c.
Referenced by load_ruleset_terrain(), load_rulesetdir(), and load_terrain_names().
Definition at line 119 of file ruleset.c.
Referenced by names_set().
Definition at line 209 of file ruleset.c.
Referenced by get_parser_buffer(), and load_rulesetdir().
|
static |
Definition at line 129 of file ruleset.c.
Referenced by lookup_req_list(), and rulesets_deinit().
Definition at line 123 of file ruleset.c.
Referenced by load_ruleset_terrain(), load_rulesetdir(), and load_terrain_names().
Definition at line 127 of file ruleset.c.
Referenced by load_ruleset_terrain(), load_rulesetdir(), and load_terrain_names().
Definition at line 208 of file ruleset.c.
Referenced by get_script_buffer(), and load_rulesetdir().
Definition at line 124 of file ruleset.c.
Referenced by load_ruleset_terrain(), load_rulesetdir(), load_terrain_names(), and lookup_terrain().