Freeciv-3.1
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
helpdata.h File Reference
#include <stddef.h>
#include "helpdlg_g.h"

Go to the source code of this file.

Data Structures

struct  help_item
 

Macros

#define help_items_iterate(pitem)
 
#define help_items_iterate_end   }}
 

Functions

void helpdata_init (void)
 
void helpdata_done (void)
 
void boot_help_texts (void)
 
void free_help_texts (void)
 
int num_help_items (void)
 
const struct help_itemget_help_item (int pos)
 
const struct help_itemget_help_item_spec (const char *name, enum help_page_type htype, int *pos)
 
void help_iter_start (void)
 
const struct help_itemhelp_iter_next (void)
 
char * helptext_building (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct impr_type *pimprove)
 
char * helptext_unit (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct unit_type *utype)
 
void helptext_advance (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, int i)
 
void helptext_terrain (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct terrain *pterrain)
 
void helptext_extra (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct extra_type *pextra)
 
void helptext_goods (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct goods_type *pgood)
 
void helptext_specialist (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct specialist *pspec)
 
void helptext_government (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct government *gov)
 
void helptext_nation (char *buf, size_t bufsz, struct nation_type *pnation, const char *user_text)
 
char * helptext_unit_upkeep_str (const struct unit_type *punittype)
 
const char * helptext_road_bonus_str (const struct terrain *pterrain, const struct road_type *proad)
 
const char * helptext_extra_for_terrain_str (struct extra_type *pextra, struct terrain *pterrain, enum unit_activity act)
 
enum help_page_type help_type_by_requirement (const struct requirement *req)
 

Macro Definition Documentation

◆ help_items_iterate

#define help_items_iterate (   pitem)
Value:
{ \
const struct help_item *pitem; \
help_iter_start(); \
while ((pitem = help_iter_next())) {
const struct help_item * help_iter_next(void)
Definition helpdata.c:1285

Definition at line 70 of file helpdata.h.

◆ help_items_iterate_end

#define help_items_iterate_end   }}

Definition at line 74 of file helpdata.h.

Function Documentation

◆ boot_help_texts()

void boot_help_texts ( void  )

pplayer may be NULL.

Definition at line 741 of file helpdata.c.

Referenced by client_main(), handle_game_info(), set_client_state(), and tilespec_reread().

◆ free_help_texts()

void free_help_texts ( void  )

Free all allocations associated with help_nodes.

Definition at line 117 of file helpdata.c.

Referenced by boot_help_texts(), and client_game_free().

◆ get_help_item()

const struct help_item * get_help_item ( int  pos)

Return pointer to given help_item. Returns NULL for 1 past end. Returns NULL and prints error message for other out-of bounds.

Definition at line 1200 of file helpdata.c.

◆ get_help_item_spec()

const struct help_item * get_help_item_spec ( const char *  name,
enum help_page_type  htype,
int *  pos 
)

Find help item by name and type. Returns help item, and sets (*pos) to position in list. If no item, returns pointer to static internal item with some faked data, and sets (*pos) to -1.

Definition at line 1223 of file helpdata.c.

Referenced by popup_help_dialog_typed(), and select_help_item_string().

◆ help_iter_next()

const struct help_item * help_iter_next ( void  )

Returns next help item; after help_iter_start(), this is the first item. At end, returns NULL.

Definition at line 1285 of file helpdata.c.

◆ help_iter_start()

void help_iter_start ( void  )

Start iterating through help items; that is, reset iterator to start position. (Could iterate using get_help_item(), but that would be less efficient due to scanning to find pos.)

Definition at line 1275 of file helpdata.c.

Referenced by check_help_nodes_init().

◆ help_type_by_requirement()

enum help_page_type help_type_by_requirement ( const struct requirement req)

Return help page that matches the requirement, or HELP_LAST if none does.

Definition at line 5037 of file helpdata.c.

Referenced by help_hyperlink_callback().

◆ helpdata_done()

void helpdata_done ( void  )

Clean up.

Definition at line 95 of file helpdata.c.

Referenced by client_exit().

◆ helpdata_init()

void helpdata_init ( void  )

Initialize.

Definition at line 87 of file helpdata.c.

Referenced by client_main().

◆ helptext_advance()

void helptext_advance ( char *  buf,
size_t  bufsz,
struct player pplayer,
const char *  user_text,
int  i 
)

Append misc dynamic text for advance/technology.

pplayer may be NULL.

Definition at line 3115 of file helpdata.c.

Referenced by create_tech_info(), help_update_tech(), manual_command(), research_diagram::mouseMoveEvent(), and help_widget::set_topic_tech().

◆ helptext_building()

char * helptext_building ( char *  buf,
size_t  bufsz,
struct player pplayer,
const char *  user_text,
const struct impr_type pimprove 
)

Write dynamic text for buildings (including wonders). This includes the ruleset helptext as well as any automatically generated text.

pplayer may be NULL. user_text, if non-NULL, will be appended to the text.

Definition at line 1316 of file helpdata.c.

Referenced by get_tooltip(), get_tooltip_improvement(), help_update_improvement(), help_update_wonder(), manual_command(), research_diagram::mouseMoveEvent(), popup_impr_info(), and help_widget::set_topic_building().

◆ helptext_extra()

void helptext_extra ( char *  buf,
size_t  bufsz,
struct player pplayer,
const char *  user_text,
struct extra_type pextra 
)

Append misc dynamic text for extras. Assumes build time and conflicts are handled in the GUI front-end.

pplayer may be NULL.

Definition at line 3619 of file helpdata.c.

Referenced by help_update_extra(), and help_widget::set_topic_extra().

◆ helptext_extra_for_terrain_str()

const char * helptext_extra_for_terrain_str ( struct extra_type pextra,
struct terrain pterrain,
enum unit_activity  act 
)

Return a brief description specific to the extra and terrain, when extra is built by cause 'act'. Returns number of turns to build, and selected bonuses. Returns a pointer to a static string, so caller should not free.

Definition at line 3585 of file helpdata.c.

Referenced by help_widget::add_extras_of_act_for_terrain(), and help_extras_of_act_for_terrain().

◆ helptext_goods()

void helptext_goods ( char *  buf,
size_t  bufsz,
struct player pplayer,
const char *  user_text,
struct goods_type pgood 
)

Append misc dynamic text for goods. Assumes effects are described in the help text.

pplayer may be NULL.

Definition at line 4094 of file helpdata.c.

Referenced by help_update_goods(), and help_widget::set_topic_goods().

◆ helptext_government()

void helptext_government ( char *  buf,
size_t  bufsz,
struct player pplayer,
const char *  user_text,
struct government gov 
)

Append text for government.

pplayer may be NULL.

TODO: Generalize the effects code for use elsewhere. Add other requirements.

Definition at line 4175 of file helpdata.c.

Referenced by help_update_government(), manual_command(), research_diagram::mouseMoveEvent(), and help_widget::set_topic_government().

◆ helptext_nation()

void helptext_nation ( char *  buf,
size_t  bufsz,
struct nation_type pnation,
const char *  user_text 
)

Returns nation legend and characteristics

Definition at line 4871 of file helpdata.c.

Referenced by help_update_nation(), nation_button_callback(), races_dialog::nation_selected(), select_nation(), and help_widget::set_topic_nation().

◆ helptext_road_bonus_str()

const char * helptext_road_bonus_str ( const struct terrain pterrain,
const struct road_type proad 
)

Return a textual representation of the F/P/T bonus a road provides to a terrain if supplied, or the terrain-independent bonus if pterrain == NULL. e.g. "0/0/+1", "0/+50%/0", or for a complex road "+2/+1+50%/0". Returns a pointer to a static string, so caller should not free (or NULL if there is no effect at all).

Definition at line 3455 of file helpdata.c.

Referenced by help_update_extra(), and helptext_extra().

◆ helptext_specialist()

void helptext_specialist ( char *  buf,
size_t  bufsz,
struct player pplayer,
const char *  user_text,
struct specialist pspec 
)

Append misc dynamic text for specialists. Assumes effects are described in the help text.

pplayer may be NULL.

Definition at line 4140 of file helpdata.c.

Referenced by help_update_specialist(), and help_widget::set_topic_specialist().

◆ helptext_terrain()

void helptext_terrain ( char *  buf,
size_t  bufsz,
struct player pplayer,
const char *  user_text,
struct terrain pterrain 
)

Append text for terrain.

Definition at line 3338 of file helpdata.c.

Referenced by help_update_terrain(), and help_widget::set_topic_terrain().

◆ helptext_unit()

char * helptext_unit ( char *  buf,
size_t  bufsz,
struct player pplayer,
const char *  user_text,
const struct unit_type utype 
)

Append misc dynamic text for units. Transport capacity, unit flags, fuel.

pplayer may be NULL.

Definition at line 1763 of file helpdata.c.

Referenced by get_tooltip(), get_tooltip_unit(), help_update_unit_type(), manual_command(), research_diagram::mouseMoveEvent(), popup_unit_info(), and help_widget::set_topic_unit().

◆ helptext_unit_upkeep_str()

char * helptext_unit_upkeep_str ( const struct unit_type utype)

Returns pointer to static string with eg: "1 shield, 1 unhappy"

Definition at line 4834 of file helpdata.c.

Referenced by get_tooltip_unit(), help_update_unit_type(), manual_command(), and help_widget::set_topic_unit().

◆ num_help_items()

int num_help_items ( void  )

Number of help items.

Definition at line 1189 of file helpdata.c.