Freeciv-3.3
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
modpack.h File Reference

Go to the source code of this file.

Macros

#define MODPACK_CAPSTR   "+Freeciv-modpack-3.3-Devel-2024.Apr.14"
 
#define MODPACK_SUFFIX   ".modpack"
 

Typedefs

typedef void(* mrc_cb) (const char *, const char *, void *data)
 

Functions

void modpacks_init (void)
 
void modpacks_free (void)
 
const charmodpack_cache_ruleset (struct section_file *sf)
 
const charmodpack_file_from_ruleset_cache (const char *name)
 
const charmodpack_cache_tileset (struct section_file *sf)
 
const charmodpack_file_from_tileset_cache (const char *name)
 
const charmodpack_tileset_target (const char *name)
 
struct fileinfo_listget_modpacks_list (void)
 
const charmodpack_has_ruleset (struct section_file *sf)
 
const charmodpack_has_tileset (struct section_file *sf)
 
bool modpack_check_capabilities (struct section_file *file, const char *us_capstr, const char *filename, bool verbose)
 
const charmodpack_serv_file (struct section_file *sf)
 
const charmodpack_rulesetdir (struct section_file *sf)
 
const charmodpack_tilespec (struct section_file *sf)
 
void modpack_ruleset_cache_iterate (mrc_cb cb, void *data)
 
void modpack_tileset_cache_iterate (mrc_cb cb, void *data)
 

Macro Definition Documentation

◆ MODPACK_CAPSTR

#define MODPACK_CAPSTR   "+Freeciv-modpack-3.3-Devel-2024.Apr.14"

Definition at line 20 of file modpack.h.

◆ MODPACK_SUFFIX

#define MODPACK_SUFFIX   ".modpack"

Definition at line 22 of file modpack.h.

Typedef Documentation

◆ mrc_cb

typedef void(* mrc_cb) (const char *, const char *, void *data)

Definition at line 45 of file modpack.h.

Function Documentation

◆ get_modpacks_list()

struct fileinfo_list * get_modpacks_list ( void  )

Get list of modpack meta info files.

Returns
List of available .modpack files

Definition at line 127 of file modpack.c.

Referenced by cache_rulesets(), and cache_tilesets().

◆ modpack_cache_ruleset()

const char * modpack_cache_ruleset ( struct section_file sf)

Add modpack/ruleset mapping to cache, if modpack has ruleset. Return name of the modpack, if the mapping exist.

Parameters
sfModpack section file to cache
Returns
Name of the modpack, or nullptr

Definition at line 235 of file modpack.c.

Referenced by cache_rulesets().

◆ modpack_cache_tileset()

const char * modpack_cache_tileset ( struct section_file sf)

Add modpack/ruleset mapping to cache, if modpack has tileset. Return name of the modpack, if the mapping exist.

Parameters
sfModpack section file to cache
Returns
Name of the modpack, or nullptr

Definition at line 262 of file modpack.c.

Referenced by cache_tilesets().

◆ modpack_check_capabilities()

bool modpack_check_capabilities ( struct section_file file,
const char us_capstr,
const char filename,
bool  verbose 
)

Check modpack file capabilities.

Parameters
fileModpack section file
us_capstrEngine capabilities
filenameModpack filename
verboseWhether logging should be verbose

Definition at line 92 of file modpack.c.

Referenced by modpack_has_ruleset(), and modpack_has_tileset().

◆ modpack_file_from_ruleset_cache()

const char * modpack_file_from_ruleset_cache ( const char name)

Find filename by name of the modpack, from the ruleset cache

Parameters
nameModpack name
Returns
Filename of the modpack

Definition at line 295 of file modpack.c.

Referenced by handle_ruleset_select(), and ruleset_cache_listcmd_cb().

◆ modpack_file_from_tileset_cache()

const char * modpack_file_from_tileset_cache ( const char name)

Find filename by name of the modpack, from the tileset cache

Parameters
nameModpack name
Returns
Filename of the modpack

Definition at line 312 of file modpack.c.

◆ modpack_has_ruleset()

const char * modpack_has_ruleset ( struct section_file sf)

Return name of the modpack if it contains a ruleset. If it does not contain ruleset, return nullptr.

Parameters
sfModpack section file
Returns
Name of the modpack, or nullptr

Definition at line 144 of file modpack.c.

Referenced by modpack_cache_ruleset().

◆ modpack_has_tileset()

const char * modpack_has_tileset ( struct section_file sf)

Return name of the modpack if it contains a tileset. If it does not contain ruleset, return nullptr.

Parameters
sfModpack section file
Returns
Name of the modpack, or nullptr

Definition at line 167 of file modpack.c.

Referenced by modpack_cache_tileset().

◆ modpack_ruleset_cache_iterate()

void modpack_ruleset_cache_iterate ( mrc_cb  cb,
void data 
)

Call callback for each item in the ruleset cache.

Parameters
cbCallback to call
dataData to pass to the callback

Definition at line 346 of file modpack.c.

Referenced by send_ruleset_choices(), and show_rulesets().

◆ modpack_rulesetdir()

const char * modpack_rulesetdir ( struct section_file sf)

Return rulesetdir for the modpack, if any.

Parameters
sfModpack section file
Returns
Rulesetdir, or nullptr

Definition at line 204 of file modpack.c.

Referenced by handle_ruleset_select(), and ruleset_cache_listcmd_cb().

◆ modpack_serv_file()

const char * modpack_serv_file ( struct section_file sf)

Return .serv file name for the modpack, if any.

Parameters
sfModpack section file
Returns
Server script name, or nullptr

Definition at line 189 of file modpack.c.

Referenced by handle_ruleset_select(), and ruleset_cache_listcmd_cb().

◆ modpack_tileset_cache_iterate()

void modpack_tileset_cache_iterate ( mrc_cb  cb,
void data 
)

Call callback for each item in the tileset cache.

Parameters
cbCallback to call
dataData to pass to the callback

Definition at line 360 of file modpack.c.

Referenced by get_tileset_list(), and tilespec_try_read().

◆ modpack_tileset_target()

const char * modpack_tileset_target ( const char name)

Find target by name of the modpack, from the tileset cache

Parameters
nameModpack name
Returns
Target of the modpack

Definition at line 329 of file modpack.c.

Referenced by ts_cb(), and ts_list_cb().

◆ modpack_tilespec()

const char * modpack_tilespec ( struct section_file sf)

Return tilespec for the modpack, if any.

Parameters
sfModpack section file
Returns
Tilespec file name, or nullptr

Definition at line 219 of file modpack.c.

◆ modpacks_free()

void modpacks_free ( void  )

Free the memory associated with modpacks system

Definition at line 62 of file modpack.c.

Referenced by client_main(), and server_quit().

◆ modpacks_init()

void modpacks_init ( void  )

Initialize modpacks system

Definition at line 50 of file modpack.c.

Referenced by client_main(), and srv_prepare().