Freeciv-3.1: /fast/freeciv/nightly/S3_1/tools/ruleutil/rulesave.c File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Data Structures | Macros | Functions
rulesave.c File Reference
`#include "registry.h"`
`#include "string_vector.h"`
`#include "achievements.h"`
`#include "game.h"`
`#include "government.h"`
`#include "map.h"`
`#include "movement.h"`
`#include "multipliers.h"`
`#include "specialist.h"`
`#include "style.h"`
`#include "unittype.h"`
`#include "version.h"`
`#include "ruleset.h"`
`#include "settings.h"`
`#include "comments.h"`
`#include "rulesave.h"`

Go to the source code of this file.

## Data Structures

struct | effect_cb_data

## Macros

#define | FORMAT_VERSION RSFORMAT_3_1

## Functions

static struct section_file * | create_ruleset_file (const char *rsname, const char *rstype)
static bool | save_default_int (struct section_file *sfile, int value, int default_value, const char *path, const char *entry)
static bool | save_default_bool (struct section_file *sfile, bool value, bool default_value, const char *path, const char *entry)
static bool | save_name_translation (struct section_file *sfile, struct name_translation *name, const char *path)
static bool | save_reqs_vector (struct section_file *sfile, const struct requirement_vector *reqs, const char *path, const char *entry)
static bool | save_tech_list (struct section_file *sfile, int *input, const char *path, const char *entry)
static bool | save_tech_ref (struct section_file *sfile, const struct advance *padv, const char *path, const char *entry)
static bool | save_terrain_ref (struct section_file *sfile, const struct terrain *save, const struct terrain *pthis, const char *path, const char *entry)
static bool | save_gov_ref (struct section_file *sfile, const struct government *gov, const char *path, const char *entry)
static bool | save_building_list (struct section_file *sfile, int *input, const char *path, const char *entry)
static bool | save_unit_list (struct section_file *sfile, struct unit_type **input, const char *path, const char *entry)
static bool | save_uclass_vec (struct section_file *sfile, bv_unit_classes *bits, const char *path, const char *entry, bool unreachable_only)
static bool | save_strvec (struct section_file *sfile, struct strvec *to_save, const char *path, const char *entry)
static bool | save_ruleset_file (struct section_file *sfile, const char *filename)
static bool | save_buildings_ruleset (const char *filename, const char *name)
static bool | save_styles_ruleset (const char *filename, const char *name)
static bool | save_action_auto_uflag_block (struct section_file *sfile, const int aap, const char *uflags_path, bool(*unexpected_req)(const struct requirement *preq))
static bool | save_action_auto_actions (struct section_file *sfile, const int aap, const char *actions_path)
static bool | unexpected_non_otype (const struct requirement *req)
static bool | save_muuk_action_auto (struct section_file *sfile, const int aap, const char *item)
static bool | save_cities_ruleset (const char *filename, const char *name)
static bool | effect_save (struct effect *peffect, void *data)
static bool | save_effects_ruleset (const char *filename, const char *name)
static bool | save_action_ui_name (struct section_file *sfile, int act, const char *entry_name)
static bool | save_action_max_range (struct section_file *sfile, action_id act)
static bool | save_action_range (struct section_file *sfile, action_id act)
static bool | save_action_kind (struct section_file *sfile, action_id act)
static bool | save_action_actor_consuming_always (struct section_file *sfile, action_id act)
static bool | save_action_blocked_by (struct section_file *sfile, struct action *paction)
static bool | save_action_post_success_force (struct section_file *sfile, int performer_slot, struct action *paction)
static bool | save_bv_actions (struct section_file *sfile, bv_actions content, const char *path)
static bool | save_game_ruleset (const char *filename, const char *name)
static bool | save_governments_ruleset (const char *filename, const char *name)
static bool | save_traits (struct trait_limits *traits, struct trait_limits *default_traits, struct section_file *sfile, const char *secname, const char *field_prefix)
static bool | save_nation (struct section_file *sfile, struct nation_type *pnat, int sect_idx)
static bool | save_nations_ruleset (const char *filename, const char *name, struct rule_data *data)
static bool | save_techs_ruleset (const char *filename, const char *name)
static bool | save_terrain_ruleset (const char *filename, const char *name)
static bool | save_veteran_system (struct section_file *sfile, const char *path, struct veteran_system *vsystem)
static bool | save_combat_bonuses (struct section_file *sfile, struct unit_type *put, char *path)
static bool | save_units_ruleset (const char *filename, const char *name)
static bool | save_script_lua (const char *filename, const char *name, const char *buffer)
static bool | save_luadata (const char *filename)
bool | save_ruleset (const char *path, const char *name, struct rule_data *data)

## Macro Definition Documentation

## ◆ FORMAT_VERSION

#define FORMAT_VERSION RSFORMAT_3_1

Definition at line 49 of file rulesave.c.

## Function Documentation

## ◆ create_ruleset_file()

static struct section_file * create_ruleset_file | ( | const char * | rsname,
|  | const char * | rstype
| ) |  |

static

Create new ruleset section file with common header.

Definition at line 54 of file rulesave.c.

Referenced by save_buildings_ruleset(), save_cities_ruleset(), save_effects_ruleset(), save_game_ruleset(), save_governments_ruleset(), save_nations_ruleset(), save_styles_ruleset(), save_techs_ruleset(), save_terrain_ruleset(), and save_units_ruleset().

## ◆ effect_save()

static bool effect_save | ( | struct effect * | peffect,
|  | void * | data
| ) |  |

static

Save one effect. Callback called for each effect in cache.

Definition at line 758 of file rulesave.c.

Referenced by save_effects_ruleset().

## ◆ save_action_actor_consuming_always()

static bool save_action_actor_consuming_always | ( | struct section_file * | sfile,
|  | action_id | act
| ) |  |

static

Save if an action always will consume the actor.

Definition at line 897 of file rulesave.c.

Referenced by save_game_ruleset().

## ◆ save_action_auto_actions()

static bool save_action_auto_actions | ( | struct section_file * | sfile,
|  | const int | aap,
|  | const char * | actions_path
| ) |  |

static

Save an action auto performer's action list as a regular setting. This is done because the Action Auto Perform rules system isn't ready to be exposed to the ruleset yet. The setting is a list of actions in the order they should be tried.

Definition at line 561 of file rulesave.c.

Referenced by save_action_post_success_force(), save_game_ruleset(), and save_muuk_action_auto().

## ◆ save_action_auto_uflag_block()

static bool save_action_auto_uflag_block | ( | struct section_file * | sfile,
|  | const int | aap,
|  | const char * | uflags_path,
|  | bool(*)(const struct requirement *preq) | unexpected_req
| ) |  |

static

Save an action auto performer's !present utype reqs as a regular setting. This is done because the Action Auto Perform rules system isn't ready to be exposed to the ruleset yet. The setting is a list of utype flags that prevents the auto action performer.

Definition at line 510 of file rulesave.c.

Referenced by save_muuk_action_auto().

## ◆ save_action_blocked_by()

static bool save_action_blocked_by | ( | struct section_file * | sfile,
|  | struct action * | paction
| ) |  |

static

Save what actions will block this action.

Definition at line 922 of file rulesave.c.

Referenced by save_game_ruleset().

## ◆ save_action_kind()

static bool save_action_kind | ( | struct section_file * | sfile,
|  | action_id | act
| ) |  |

static

Save details of an action.

Definition at line 873 of file rulesave.c.

Referenced by save_game_ruleset().

## ◆ save_action_max_range()

static bool save_action_max_range | ( | struct section_file * | sfile,
|  | action_id | act
| ) |  |

static

Save max range of an action.

Definition at line 827 of file rulesave.c.

Referenced by save_action_range().

## ◆ save_action_post_success_force()

static bool save_action_post_success_force | ( | struct section_file * | sfile,
|  | int | performer_slot,
|  | struct action * | paction
| ) |  |

static

Save what actions an actor under certain circumstances will be forced to perform after successfully performing this action.

Definition at line 975 of file rulesave.c.

Referenced by save_game_ruleset().

## ◆ save_action_range()

static bool save_action_range | ( | struct section_file * | sfile,
|  | action_id | act
| ) |  |

static

Save range of an action.

Definition at line 847 of file rulesave.c.

Referenced by save_game_ruleset().

## ◆ save_action_ui_name()

static bool save_action_ui_name | ( | struct section_file * | sfile,
|  | int | act,
|  | const char * | entry_name
| ) |  |

static

Save ui_name of one action.

Definition at line 807 of file rulesave.c.

Referenced by save_game_ruleset().

## ◆ save_building_list()

static bool save_building_list | ( | struct section_file * | sfile,
|  | int * | input,
|  | const char * | path,
|  | const char * | entry
| ) |  |

static

Save buildings vector. Input is B_LAST terminated array of buildings to save.

Definition at line 274 of file rulesave.c.

Referenced by save_game_ruleset(), and save_nation().

## ◆ save_buildings_ruleset()

static bool save_buildings_ruleset | ( | const char * | filename,
|  | const char * | name
| ) |  |

static

Save buildings.ruleset

Definition at line 378 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_bv_actions()

static bool save_bv_actions | ( | struct section_file * | sfile,
|  | bv_actions | content,
|  | const char * | path
| ) |  |

static

Save a bv_actions to the ruleset as a list of actions.

Definition at line 1004 of file rulesave.c.

Referenced by save_game_ruleset().

## ◆ save_cities_ruleset()

static bool save_cities_ruleset | ( | const char * | filename,
|  | const char * | name
| ) |  |

static

Save cities.ruleset

Definition at line 634 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_combat_bonuses()

static bool save_combat_bonuses | ( | struct section_file * | sfile,
|  | struct unit_type * | put,
|  | char * | path
| ) |  |

static

Save unit combat bonuses list.

Definition at line 2804 of file rulesave.c.

Referenced by save_units_ruleset().

## ◆ save_default_bool()

static bool save_default_bool | ( | struct section_file * | sfile,
|  | bool | value,
|  | bool | default_value,
|  | const char * | path,
|  | const char * | entry
| ) |  |

static

Save bool value that has default applied upon loading.

Definition at line 98 of file rulesave.c.

Referenced by save_action_actor_consuming_always(), and save_game_ruleset().

## ◆ save_default_int()

static bool save_default_int | ( | struct section_file * | sfile,
|  | int | value,
|  | int | default_value,
|  | const char * | path,
|  | const char * | entry
| ) |  |

static

Save int value that has default applied upon loading.

Definition at line 79 of file rulesave.c.

Referenced by save_action_max_range(), save_action_range(), save_game_ruleset(), and save_governments_ruleset().

## ◆ save_effects_ruleset()

static bool save_effects_ruleset | ( | const char * | filename,
|  | const char * | name
| ) |  |

static

Save effects.ruleset

Definition at line 783 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_game_ruleset()

static bool save_game_ruleset | ( | const char * | filename,
|  | const char * | name
| ) |  |

static

Save game.ruleset

Definition at line 1038 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_gov_ref()

static bool save_gov_ref | ( | struct section_file * | sfile,
|  | const struct government * | gov,
|  | const char * | path,
|  | const char * | entry
| ) |  |

static

Save government reference

Definition at line 261 of file rulesave.c.

Referenced by save_governments_ruleset().

## ◆ save_governments_ruleset()

static bool save_governments_ruleset | ( | const char * | filename,
|  | const char * | name
| ) |  |

static

Save governments.ruleset

Definition at line 1677 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_luadata()

static bool save_luadata | ( | const char * | filename | ) |

static

Save luadata.txt

Definition at line 3119 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_muuk_action_auto()

static bool save_muuk_action_auto | ( | struct section_file * | sfile,
|  | const int | aap,
|  | const char * | item
| ) |  |

static

Save the action a unit should perform when its missing food, gold or shield upkeep. Save as regular settings since the Action Auto Perform rules system isn't ready to be exposed to the ruleset yet.

Definition at line 614 of file rulesave.c.

Referenced by save_cities_ruleset().

## ◆ save_name_translation()

static bool save_name_translation | ( | struct section_file * | sfile,
|  | struct name_translation * | name,
|  | const char * | path
| ) |  |

static

Save name of the object.

Definition at line 118 of file rulesave.c.

Referenced by save_buildings_ruleset(), save_cities_ruleset(), save_game_ruleset(), save_governments_ruleset(), save_nation(), save_nations_ruleset(), save_styles_ruleset(), save_techs_ruleset(), save_terrain_ruleset(), and save_units_ruleset().

## ◆ save_nation()

static bool save_nation | ( | struct section_file * | sfile,
|  | struct nation_type * | pnat,
|  | int | sect_idx
| ) |  |

static

Save a single nation.

Definition at line 1810 of file rulesave.c.

Referenced by save_nations_ruleset().

## ◆ save_nations_ruleset()

static bool save_nations_ruleset | ( | const char * | filename,
|  | const char * | name,
|  | struct rule_data * | data
| ) |  |

static

Save nations.ruleset

Definition at line 1996 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_reqs_vector()

static bool save_reqs_vector | ( | struct section_file * | sfile,
|  | const struct requirement_vector * | reqs,
|  | const char * | path,
|  | const char * | entry
| ) |  |

static

Save vector of requirements

Definition at line 141 of file rulesave.c.

Referenced by effect_save(), save_buildings_ruleset(), save_cities_ruleset(), save_game_ruleset(), save_governments_ruleset(), save_styles_ruleset(), save_techs_ruleset(), and save_terrain_ruleset().

## ◆ save_ruleset()

bool save_ruleset | ( | const char * | path,
|  | const char * | name,
|  | struct rule_data * | data
| ) |  |

Save ruleset to directory given.

Definition at line 3131 of file rulesave.c.

Referenced by main(), and tab_misc::save_now().

## ◆ save_ruleset_file()

static bool save_ruleset_file | ( | struct section_file * | sfile,
|  | const char * | filename
| ) |  |

static

Save ruleset file.

Definition at line 370 of file rulesave.c.

Referenced by save_buildings_ruleset(), save_cities_ruleset(), save_effects_ruleset(), save_game_ruleset(), save_governments_ruleset(), save_nations_ruleset(), save_styles_ruleset(), save_techs_ruleset(), save_terrain_ruleset(), and save_units_ruleset().

## ◆ save_script_lua()

static bool save_script_lua | ( | const char * | filename,
|  | const char * | name,
|  | const char * | buffer
| ) |  |

static

Save script.lua

Definition at line 3092 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_strvec()

static bool save_strvec | ( | struct section_file * | sfile,
|  | struct strvec * | to_save,
|  | const char * | path,
|  | const char * | entry
| ) |  |

static

Save strvec as ruleset vector of strings

Definition at line 348 of file rulesave.c.

Referenced by save_buildings_ruleset(), save_cities_ruleset(), save_game_ruleset(), save_governments_ruleset(), save_techs_ruleset(), save_terrain_ruleset(), and save_units_ruleset().

## ◆ save_styles_ruleset()

static bool save_styles_ruleset | ( | const char * | filename,
|  | const char * | name
| ) |  |

static

Save styles.ruleset

Definition at line 446 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_tech_list()

static bool save_tech_list | ( | struct section_file * | sfile,
|  | int * | input,
|  | const char * | path,
|  | const char * | entry
| ) |  |

static

Save techs vector. Input is A_LAST terminated array of techs to save.

Definition at line 201 of file rulesave.c.

Referenced by save_game_ruleset(), and save_nation().

## ◆ save_tech_ref()

static bool save_tech_ref | ( | struct section_file * | sfile,
|  | const struct advance * | padv,
|  | const char * | path,
|  | const char * | entry
| ) |  |

static

Save tech reference

Definition at line 224 of file rulesave.c.

Referenced by save_techs_ruleset(), and save_units_ruleset().

## ◆ save_techs_ruleset()

static bool save_techs_ruleset | ( | const char * | filename,
|  | const char * | name
| ) |  |

static

Save techs.ruleset

Definition at line 2121 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_terrain_ref()

static bool save_terrain_ref | ( | struct section_file * | sfile,
|  | const struct terrain * | save,
|  | const struct terrain * | pthis,
|  | const char * | path,
|  | const char * | entry
| ) |  |

static

Save terrain reference

Definition at line 241 of file rulesave.c.

Referenced by save_terrain_ruleset().

## ◆ save_terrain_ruleset()

static bool save_terrain_ruleset | ( | const char * | filename,
|  | const char * | name
| ) |  |

static

Save terrain.ruleset

Definition at line 2222 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_traits()

static bool save_traits | ( | struct trait_limits * | traits,
|  | struct trait_limits * | default_traits,
|  | struct section_file * | sfile,
|  | const char * | secname,
|  | const char * | field_prefix
| ) |  |

static

Save list of AI traits

Definition at line 1764 of file rulesave.c.

Referenced by save_nation(), and save_nations_ruleset().

## ◆ save_uclass_vec()

static bool save_uclass_vec | ( | struct section_file * | sfile,
|  | bv_unit_classes * | bits,
|  | const char * | path,
|  | const char * | entry,
|  | bool | unreachable_only
| ) |  |

static

Save vector of unit class names based on bitvector bits

Definition at line 321 of file rulesave.c.

Referenced by save_units_ruleset().

## ◆ save_unit_list()

static bool save_unit_list | ( | struct section_file * | sfile,
|  | struct unit_type ** | input,
|  | const char * | path,
|  | const char * | entry
| ) |  |

static

Save units vector. Input is NULL terminated array of units to save.

Definition at line 298 of file rulesave.c.

Referenced by save_nation().

## ◆ save_units_ruleset()

static bool save_units_ruleset | ( | const char * | filename,
|  | const char * | name
| ) |  |

static

Save units.ruleset

Definition at line 2841 of file rulesave.c.

Referenced by save_ruleset().

## ◆ save_veteran_system()

static bool save_veteran_system | ( | struct section_file * | sfile,
|  | const char * | path,
|  | struct veteran_system * | vsystem
| ) |  |

static

Save one veteran system.

Definition at line 2769 of file rulesave.c.

Referenced by save_units_ruleset().

## ◆ unexpected_non_otype()

static bool unexpected_non_otype | ( | const struct requirement * | req | ) |

static

Missing unit upkeep should only contain output type and absence of blocking unit type flag requirements.

Definition at line 604 of file rulesave.c.

Referenced by save_muuk_action_auto().