Freeciv21
Develop your civilization from humble roots to a global empire
helpdata.h File Reference
#include "fc_types.h"
+ Include dependency graph for helpdata.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  help_item
 

Macros

#define HELP_OVERVIEW_ITEM   N_("?help:Overview")
 
#define HELP_PLAYING_ITEM   N_("Strategy and Tactics")
 
#define HELP_LANGUAGES_ITEM   N_("Languages")
 
#define HELP_CONNECTING_ITEM   N_("Connecting")
 
#define HELP_CHATLINE_ITEM   N_("Chatline")
 
#define HELP_WORKLIST_EDITOR_ITEM   N_("Worklist Editor")
 
#define HELP_CMA_ITEM   N_("Citizen Governor")
 
#define HELP_CONTROLS_ITEM   N_("Controls")
 
#define HELP_RULESET_ITEM   N_("About Current Ruleset")
 
#define HELP_TILESET_ITEM   N_("About Current Tileset")
 
#define HELP_NATIONS_ITEM   N_("About Nations")
 
#define HELP_ECONOMY_ITEM   N_("Economy")
 
#define HELP_CITIES_ITEM   N_("Cities")
 
#define HELP_IMPROVEMENTS_ITEM   N_("City Improvements")
 
#define HELP_UNITS_ITEM   N_("Units")
 
#define HELP_COMBAT_ITEM   N_("Combat")
 
#define HELP_ZOC_ITEM   N_("Zones of Control")
 
#define HELP_TECHS_ITEM   N_("Technology")
 
#define HELP_EXTRAS_ITEM   N_("Extras")
 
#define HELP_TERRAIN_ITEM   N_("Terrain")
 
#define HELP_WONDERS_ITEM   N_("Wonders of the World")
 
#define HELP_GOVERNMENT_ITEM   N_("Government")
 
#define HELP_EFFECTS_ITEM   N_("Effects")
 
#define HELP_DIPLOMACY_ITEM   N_("Diplomacy")
 
#define HELP_SPACE_RACE_ITEM   N_("Space Race")
 
#define HELP_COPYING_ITEM   N_("Copying")
 
#define HELP_ABOUT_ITEM   N_("About Freeciv21")
 
#define HELP_MULTIPLIER_ITEM   N_("Policies")
 

Enumerations

enum  help_page_type {
  HELP_ANY , HELP_TEXT , HELP_UNIT , HELP_IMPROVEMENT ,
  HELP_WONDER , HELP_TECH , HELP_TERRAIN , HELP_EXTRA ,
  HELP_GOODS , HELP_SPECIALIST , HELP_GOVERNMENT , HELP_RULESET ,
  HELP_TILESET , HELP_NATIONS , HELP_MULTIPLIER , HELP_EFFECT ,
  HELP_LAST
}
 

Functions

void boot_help_texts (const nation_set *nations_to_show, help_item *tileset_help)
 pplayer may be nullptr. More...
 
void free_help_texts ()
 Free all allocations associated with help_nodes. More...
 
struct help_itemnew_help_item (help_page_type type)
 Allocate and initialize new help item. More...
 
const struct help_itemget_help_item_spec (const char *name, enum help_page_type htype, int *pos)
 The following few functions are essentially wrappers for the help_nodes help_list. More...
 
char * helptext_building (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct impr_type *pimprove, const nation_set *nations_to_show)
 FIXME: Also, in principle these could be auto-generated once, inserted into pitem->text, and then don't need to keep re-generating them. More...
 
char * helptext_unit (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct unit_type *utype, const nation_set *nations_to_show)
 Append misc dynamic text for units. More...
 
void helptext_advance (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, int i, const nation_set *nations_to_show)
 Append misc dynamic text for advance/technology. More...
 
void helptext_terrain (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct terrain *pterrain)
 Append text for terrain. More...
 
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. More...
 
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. More...
 
void helptext_specialist (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct specialist *pspec)
 Append misc dynamic text for specialists. More...
 
void helptext_government (char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct government *gov)
 Append text for government. More...
 
void helptext_nation (char *buf, size_t bufsz, struct nation_type *pnation, const char *user_text)
 Returns nation legend and characteristics. More...
 
char * helptext_unit_upkeep_str (const struct unit_type *punittype)
 Returns pointer to static string with eg: "1 shield, 1 unhappy". More...
 
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 == nullptr. More...
 
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'. More...
 

Macro Definition Documentation

◆ HELP_ABOUT_ITEM

#define HELP_ABOUT_ITEM   N_("About Freeciv21")

Definition at line 67 of file helpdata.h.

◆ HELP_CHATLINE_ITEM

#define HELP_CHATLINE_ITEM   N_("Chatline")

Definition at line 45 of file helpdata.h.

◆ HELP_CITIES_ITEM

#define HELP_CITIES_ITEM   N_("Cities")

Definition at line 53 of file helpdata.h.

◆ HELP_CMA_ITEM

#define HELP_CMA_ITEM   N_("Citizen Governor")

Definition at line 47 of file helpdata.h.

◆ HELP_COMBAT_ITEM

#define HELP_COMBAT_ITEM   N_("Combat")

Definition at line 56 of file helpdata.h.

◆ HELP_CONNECTING_ITEM

#define HELP_CONNECTING_ITEM   N_("Connecting")

Definition at line 44 of file helpdata.h.

◆ HELP_CONTROLS_ITEM

#define HELP_CONTROLS_ITEM   N_("Controls")

Definition at line 48 of file helpdata.h.

◆ HELP_COPYING_ITEM

#define HELP_COPYING_ITEM   N_("Copying")

Definition at line 66 of file helpdata.h.

◆ HELP_DIPLOMACY_ITEM

#define HELP_DIPLOMACY_ITEM   N_("Diplomacy")

Definition at line 64 of file helpdata.h.

◆ HELP_ECONOMY_ITEM

#define HELP_ECONOMY_ITEM   N_("Economy")

Definition at line 52 of file helpdata.h.

◆ HELP_EFFECTS_ITEM

#define HELP_EFFECTS_ITEM   N_("Effects")

Definition at line 63 of file helpdata.h.

◆ HELP_EXTRAS_ITEM

#define HELP_EXTRAS_ITEM   N_("Extras")

Definition at line 59 of file helpdata.h.

◆ HELP_GOVERNMENT_ITEM

#define HELP_GOVERNMENT_ITEM   N_("Government")

Definition at line 62 of file helpdata.h.

◆ HELP_IMPROVEMENTS_ITEM

#define HELP_IMPROVEMENTS_ITEM   N_("City Improvements")

Definition at line 54 of file helpdata.h.

◆ HELP_LANGUAGES_ITEM

#define HELP_LANGUAGES_ITEM   N_("Languages")

Definition at line 43 of file helpdata.h.

◆ HELP_MULTIPLIER_ITEM

#define HELP_MULTIPLIER_ITEM   N_("Policies")

Definition at line 68 of file helpdata.h.

◆ HELP_NATIONS_ITEM

#define HELP_NATIONS_ITEM   N_("About Nations")

Definition at line 51 of file helpdata.h.

◆ HELP_OVERVIEW_ITEM

#define HELP_OVERVIEW_ITEM   N_("?help:Overview")

Definition at line 41 of file helpdata.h.

◆ HELP_PLAYING_ITEM

#define HELP_PLAYING_ITEM   N_("Strategy and Tactics")

Definition at line 42 of file helpdata.h.

◆ HELP_RULESET_ITEM

#define HELP_RULESET_ITEM   N_("About Current Ruleset")

Definition at line 49 of file helpdata.h.

◆ HELP_SPACE_RACE_ITEM

#define HELP_SPACE_RACE_ITEM   N_("Space Race")

Definition at line 65 of file helpdata.h.

◆ HELP_TECHS_ITEM

#define HELP_TECHS_ITEM   N_("Technology")

Definition at line 58 of file helpdata.h.

◆ HELP_TERRAIN_ITEM

#define HELP_TERRAIN_ITEM   N_("Terrain")

Definition at line 60 of file helpdata.h.

◆ HELP_TILESET_ITEM

#define HELP_TILESET_ITEM   N_("About Current Tileset")

Definition at line 50 of file helpdata.h.

◆ HELP_UNITS_ITEM

#define HELP_UNITS_ITEM   N_("Units")

Definition at line 55 of file helpdata.h.

◆ HELP_WONDERS_ITEM

#define HELP_WONDERS_ITEM   N_("Wonders of the World")

Definition at line 61 of file helpdata.h.

◆ HELP_WORKLIST_EDITOR_ITEM

#define HELP_WORKLIST_EDITOR_ITEM   N_("Worklist Editor")

Definition at line 46 of file helpdata.h.

◆ HELP_ZOC_ITEM

#define HELP_ZOC_ITEM   N_("Zones of Control")

Definition at line 57 of file helpdata.h.

Enumeration Type Documentation

◆ help_page_type

Enumerator
HELP_ANY 
HELP_TEXT 
HELP_UNIT 
HELP_IMPROVEMENT 
HELP_WONDER 
HELP_TECH 
HELP_TERRAIN 
HELP_EXTRA 
HELP_GOODS 
HELP_SPECIALIST 
HELP_GOVERNMENT 
HELP_RULESET 
HELP_TILESET 
HELP_NATIONS 
HELP_MULTIPLIER 
HELP_EFFECT 
HELP_LAST 

Definition at line 20 of file helpdata.h.

Function Documentation

◆ boot_help_texts()

void boot_help_texts ( const nation_set nations_to_show,
help_item tileset_help 
)

pplayer may be nullptr.

Definition at line 682 of file helpdata.cpp.

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

◆ free_help_texts()

void free_help_texts ( )

Free all allocations associated with help_nodes.

Definition at line 73 of file helpdata.cpp.

Referenced by boot_help_texts(), and client_game_free().

◆ get_help_item_spec()

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

The following few functions are essentially wrappers for the help_nodes help_list.

This allows us to avoid exporting the help_list, and instead only access it through a controlled interface. 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 1118 of file helpdata.cpp.

Referenced by popup_help_dialog_typed().

◆ helptext_advance()

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

Append misc dynamic text for advance/technology.

pplayer may be nullptr.

Definition at line 2886 of file helpdata.cpp.

Referenced by 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,
const nation_set nations_to_show 
)

FIXME: Also, in principle these could be auto-generated once, inserted into pitem->text, and then don't need to keep re-generating them.

Only thing to be careful of would be changeable data, but don't have that here (for ruleset change or spacerace change must re-boot helptexts anyway). Eg, genuinely dynamic information which could be useful would be if help system said which wonders have been built (or are being built and by who/where?) Write dynamic text for buildings (including wonders). This includes the ruleset helptext as well as any automatically generated text.

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

Definition at line 1181 of file helpdata.cpp.

Referenced by get_tooltip(), get_tooltip_improvement(), manual_command(), research_diagram::mouseMoveEvent(), 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 nullptr.

Definition at line 3395 of file helpdata.cpp.

Referenced by 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 3361 of file helpdata.cpp.

Referenced by help_widget::add_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 nullptr.

Definition at line 3853 of file helpdata.cpp.

Referenced by 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 nullptr.

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

Definition at line 3942 of file helpdata.cpp.

Referenced by 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 4653 of file helpdata.cpp.

Referenced by races_dialog::nation_selected(), 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 == nullptr.

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 nullptr if there is no effect at all).

Definition at line 3229 of file helpdata.cpp.

Referenced by 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 nullptr.

Definition at line 3905 of file helpdata.cpp.

Referenced by 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 3115 of file helpdata.cpp.

Referenced by 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,
const nation_set nations_to_show 
)

Append misc dynamic text for units.

Transport capacity, unit flags, fuel.

pplayer may be nullptr.

Definition at line 1639 of file helpdata.cpp.

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

◆ helptext_unit_upkeep_str()

char* helptext_unit_upkeep_str ( const struct unit_type punittype)

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

Definition at line 4611 of file helpdata.cpp.

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

◆ new_help_item()

struct help_item* new_help_item ( help_page_type  type)

Allocate and initialize new help item.

Definition at line 656 of file helpdata.cpp.

Referenced by boot_help_texts(), and tileset_help().