Freeciv-3.1
|
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include "astring.h"
#include "bitvector.h"
#include "fcintl.h"
#include "log.h"
#include "support.h"
#include "calendar.h"
#include "citizens.h"
#include "clientutils.h"
#include "combat.h"
#include "culture.h"
#include "fc_types.h"
#include "game.h"
#include "government.h"
#include "map.h"
#include "research.h"
#include "traderoutes.h"
#include "unitlist.h"
#include "client_main.h"
#include "climap.h"
#include "climisc.h"
#include "control.h"
#include "goto.h"
#include "helpdata.h"
#include "text.h"
Go to the source code of this file.
Macros | |
#define | FAR_CITY_SQUARE_DIST (2*(6*6)) |
Functions | |
static int | get_bulbs_per_turn (int *pours, bool *pteam, int *ptheirs) |
static const char * | format_duration (int duration) |
const char * | get_tile_output_text (const struct tile *ptile) |
static void | get_full_username (char *buf, int buflen, const struct player *pplayer) |
static void | get_full_nation (char *buf, int buflen, const struct player *pplayer) |
const char * | popup_info_text (struct tile *ptile) |
const char * | get_nearest_city_text (struct city *pcity, int sq_dist) |
const char * | unit_description (struct unit *punit) |
const char * | get_airlift_text (const struct unit_list *punits, const struct city *pdest) |
static int | turns_to_research_done (const struct research *presearch, int per_turn) |
static int | turns_per_advance (const struct research *presearch, int per_turn) |
static int | turns_to_tech_loss (const struct research *presearch, int per_turn) |
const char * | science_dialog_text (void) |
const char * | get_science_target_text (double *percent) |
const char * | get_science_goal_text (Tech_type_id goal) |
const char * | get_info_label_text (bool moreinfo) |
const char * | get_info_label_text_popup (void) |
const char * | get_unit_info_label_text1 (struct unit_list *punits) |
const char * | get_unit_info_label_text2 (struct unit_list *punits, int linebreaks) |
bool | get_units_upgrade_info (char *buf, size_t bufsz, struct unit_list *punits) |
bool | get_units_disband_info (char *buf, size_t bufsz, struct unit_list *punits) |
const char * | get_bulb_tooltip (void) |
const char * | get_global_warming_tooltip (void) |
const char * | get_nuclear_winter_tooltip (void) |
const char * | get_government_tooltip (void) |
const char * | get_spaceship_descr (struct player_spaceship *pship) |
const char * | get_timeout_label_text (void) |
const char * | get_ping_time_text (const struct player *pplayer) |
const char * | get_score_text (const struct player *pplayer) |
const char * | get_report_title (const char *report_name) |
const char * | get_act_sel_action_custom_text (struct action *paction, const struct act_prob prob, const struct unit *actor_unit, const struct city *target_city) |
const char * | act_sel_action_tool_tip (const struct action *paction, const struct act_prob prob) |
const char * | text_happiness_buildings (const struct city *pcity) |
const char * | text_happiness_nationality (const struct city *pcity) |
const char * | text_happiness_wonders (const struct city *pcity) |
const char * | text_happiness_cities (const struct city *pcity) |
const char * | text_happiness_units (const struct city *pcity) |
const char * | text_happiness_luxuries (const struct city *pcity) |
const char * | production_help (const struct universal *uni, char *buf, size_t bufsize) |
const char * | score_tooltip (const struct player *pplayer, int score) |
Get information about starting the action in the current situation. Suitable for a tool tip for the button that starts it.
Not re-entrant
Definition at line 1820 of file text.c.
Referenced by action_entry(), action_entry(), action_entry_update(), and action_entry_update().
|
static |
Format a duration, in seconds, so it comes up in minutes or hours if that would be more meaningful.
(English original 7 characters, maximum. Enough for, e.g., "99h 59m".)
Not re-entrant
Definition at line 1623 of file text.c.
Referenced by get_timeout_label_text().
const char * get_act_sel_action_custom_text | ( | struct action * | paction, |
const struct act_prob | prob, | ||
const struct unit * | actor_unit, | ||
const struct city * | target_city | ||
) |
Returns custom part of the action selection dialog button text for the specified action (given that the action is possible).
Not re-entrant
Definition at line 1743 of file text.c.
Referenced by action_entry(), action_selection_refresh(), and popup_action_selection().
const char * get_airlift_text | ( | const struct unit_list * | punits, |
const struct city * | pdest | ||
) |
Describe the airlift capacity of a city for the given units (from their current positions). If pdest is non-NULL, describe its capacity as a destination, otherwise describe the capacity of the city the unit's currently in (if any) as a source. (If the units in the list are in different cities, this will probably not give a useful result in this case.) If not all of the listed units can be airlifted, return the description for those that can. Returns NULL if an airlift is not possible for any of the units.
Not re-entrant
Definition at line 578 of file text.c.
Referenced by goto_dialog::fill_tab(), refresh_airlift_column(), and update_source_label().
const char * get_bulb_tooltip | ( | void | ) |
Get a tooltip text for the info panel research indicator. See client_research_sprite().
Not re-entrant
Definition at line 1400 of file text.c.
Referenced by update_info_label().
|
static |
Return total expected bulbs.
Definition at line 682 of file text.c.
Referenced by get_bulb_tooltip(), get_info_label_text_popup(), get_science_goal_text(), get_science_target_text(), and science_dialog_text().
|
inlinestatic |
Fill the buffer with the player's nation name (in adjective form) and optionally add the player's team name.
Definition at line 119 of file text.c.
Referenced by popup_info_text().
|
inlinestatic |
For AIs, fill the buffer with their player name prefixed with "AI". For humans, just fill it with their username.
Definition at line 95 of file text.c.
Referenced by popup_info_text().
const char * get_global_warming_tooltip | ( | void | ) |
Get a tooltip text for the info panel global warning indicator. See also client_warming_sprite().
Not re-entrant
Definition at line 1457 of file text.c.
Referenced by update_info_label().
const char * get_government_tooltip | ( | void | ) |
Get a tooltip text for the info panel government indicator. See also government_by_number(...)->sprite.
Not re-entrant
Definition at line 1511 of file text.c.
Referenced by update_info_label().
const char * get_info_label_text | ( | bool | moreinfo | ) |
Return the text for the label on the info panel. (This is traditionally shown to the left of the mapview.)
Clicking on this text should bring up the get_info_label_text_popup() text.
Not re-entrant
Definition at line 950 of file text.c.
Referenced by update_info_label(), and fc_client::update_sidebar_tooltips().
const char * get_info_label_text_popup | ( | void | ) |
Return the text for the popup label on the info panel. (This is traditionally done as a popup whenever the regular info text is clicked on.)
Not re-entrant
Definition at line 1002 of file text.c.
Referenced by show_info_popup(), show_info_popup(), and fc_client::update_sidebar_tooltips().
const char * get_nearest_city_text | ( | struct city * | pcity, |
int | sq_dist | ||
) |
Returns the text describing the city and its distance.
Not re-entrant
Definition at line 474 of file text.c.
Referenced by create_present_supported_units_widget_list(), and unit_description().
const char * get_nuclear_winter_tooltip | ( | void | ) |
Get a tooltip text for the info panel nuclear winter indicator. See also client_cooling_sprite().
Not re-entrant
Definition at line 1484 of file text.c.
Referenced by update_info_label().
const char * get_ping_time_text | ( | const struct player * | pplayer | ) |
Return text giving the ping time for the player. This is generally used in the playerdlg. This should only be used in plrdlg_common.c.
Not re-entrant
const char * get_report_title | ( | const char * | report_name | ) |
const char * get_science_goal_text | ( | Tech_type_id | goal | ) |
Set the science-goal-label text as if we're researching the given goal.
Not re-entrant
Definition at line 899 of file text.c.
Referenced by real_science_report_dialog_update(), science_report_update(), and science_report::update_report().
const char * get_science_target_text | ( | double * | percent | ) |
Get the short science-target text. This is usually shown directly in the progress bar.
5/28 - 3 turns
The "percent" value, if given, will be set to the completion percentage of the research target (actually it's a [0,1] scale not a percent).
Not re-entrant
Definition at line 853 of file text.c.
Referenced by get_info_label_text_popup(), real_science_report_dialog_update(), science_report_update(), and science_report::update_report().
const char * get_score_text | ( | const struct player * | pplayer | ) |
Return text giving the score of the player. This should only be used in plrdlg_common.c.
Not re-entrant
const char * get_spaceship_descr | ( | struct player_spaceship * | pship | ) |
Returns a description of the given spaceship. If there is no spaceship (pship is NULL) then text with dummy values is returned.
Not re-entrant
Definition at line 1533 of file text.c.
Referenced by create_spaceship_dialog(), popup_spaceship_dialog(), refresh_spaceship_dialog(), spaceship_dialog_update_info(), and ss_report::update_report().
const char * get_tile_output_text | ( | const struct tile * | ptile | ) |
Return a (static) string with a tile's food/prod/trade
Not re-entrant
Definition at line 62 of file text.c.
Referenced by popup_info_text(), popup_terrain_info(), and redraw_unit_info_label().
const char * get_timeout_label_text | ( | void | ) |
Get the text showing the timeout. This is generally displayed on the info panel.
Not re-entrant
Definition at line 1590 of file text.c.
Referenced by qtg_update_timeout_label(), and update_timeout_label().
const char * get_unit_info_label_text1 | ( | struct unit_list * | punits | ) |
Return the title text for the unit info shown in the info panel.
Not re-entrant
FIXME: this should be renamed.
Definition at line 1087 of file text.c.
Referenced by update_unit_info_label().
const char * get_unit_info_label_text2 | ( | struct unit_list * | punits, |
int | linebreaks | ||
) |
Return the text body for the unit info shown in the info panel.
Not re-entrant
FIXME: this should be renamed.
Definition at line 1112 of file text.c.
Referenced by redraw_unit_info_label(), and update_unit_info_label().
bool get_units_disband_info | ( | char * | buf, |
size_t | bufsz, | ||
struct unit_list * | punits | ||
) |
Fill buffer with text about disbanding units on the list.
Returns TRUE iff any units can be disbanded.
Definition at line 1356 of file text.c.
Referenced by popup_disband_dialog(), and popup_unit_disband_dlg().
bool get_units_upgrade_info | ( | char * | buf, |
size_t | bufsz, | ||
struct unit_list * | punits | ||
) |
Fill buffer with text about upgrading units on the list.
Returns TRUE iff any units can be upgraded.
Definition at line 1290 of file text.c.
Referenced by popup_upgrade_dialog().
const char * popup_info_text | ( | struct tile * | ptile | ) |
Text to popup on a middle-click in the mapview.
Not re-entrant
Definition at line 146 of file text.c.
Referenced by info_tile::calc_size(), popit(), popit(), popit(), popup_terrain_info_dialog(), and hud_units::update_actions().
const char * production_help | ( | const struct universal * | uni, |
char * | buf, | ||
size_t | bufsize | ||
) |
Fill provided buffer with relatively short (not full) helptext of the universal.
Definition at line 2120 of file text.c.
Referenced by drag_drop(), menu_item_callback(), menu_item_callback(), and refresh_worklist().
const char * science_dialog_text | ( | void | ) |
Returns the text to display in the science dialog.
Not re-entrant
Definition at line 774 of file text.c.
Referenced by real_science_report_dialog_update(), science_report_update(), show_new_turn_info(), science_report::update_report(), and fc_client::update_sidebar_tooltips().
const char * score_tooltip | ( | const struct player * | pplayer, |
int | score | ||
) |
Tooltip for the player row on reports. Negative score is not shown.
Not re-entrant
Definition at line 2157 of file text.c.
Referenced by endgame_report_dialog_player(), and fill_row().
const char * text_happiness_buildings | ( | const struct city * | pcity | ) |
Describe buildings that affect happiness.
Not re-entrant
Definition at line 1831 of file text.c.
Referenced by show_happiness_popup(), show_happiness_popup(), and city_dialog::update_citizens().
const char * text_happiness_cities | ( | const struct city * | pcity | ) |
Describe city factors that affect happiness.
Not re-entrant
Definition at line 1931 of file text.c.
Referenced by show_happiness_popup(), show_happiness_popup(), city_dialog::update_citizens(), and fc_client::update_sidebar_tooltips().
const char * text_happiness_luxuries | ( | const struct city * | pcity | ) |
Describe luxuries that affect happiness.
Not re-entrant
Definition at line 2103 of file text.c.
Referenced by show_happiness_popup(), show_happiness_popup(), and city_dialog::update_citizens().
const char * text_happiness_nationality | ( | const struct city * | pcity | ) |
Describe nationality effects that affect happiness.
Not re-entrant
Definition at line 1859 of file text.c.
Referenced by show_happiness_popup(), show_happiness_popup(), and city_dialog::update_citizens().
const char * text_happiness_units | ( | const struct city * | pcity | ) |
Describe units that affect happiness.
Not re-entrant
Definition at line 2065 of file text.c.
Referenced by show_happiness_popup(), show_happiness_popup(), and city_dialog::update_citizens().
const char * text_happiness_wonders | ( | const struct city * | pcity | ) |
Describe wonders that affect happiness.
Not re-entrant
Definition at line 1901 of file text.c.
Referenced by show_happiness_popup(), show_happiness_popup(), and city_dialog::update_citizens().
|
static |
Return turns per advance (based on currently researched advance). -1 for no progress.
Definition at line 741 of file text.c.
Referenced by science_dialog_text().
|
static |
Return turns until research complete. -1 for never.
Definition at line 726 of file text.c.
Referenced by get_bulb_tooltip(), and get_science_target_text().
|
static |
Return turns until an advance is lost due to tech upkeep. -1 if we're not on the way to losing an advance.
Definition at line 754 of file text.c.
Referenced by get_bulb_tooltip(), get_science_target_text(), and science_dialog_text().
const char * unit_description | ( | struct unit * | punit | ) |
Returns a unit description. Used in e.g. city report tooltips.
Not re-entrant
Definition at line 508 of file text.c.
Referenced by city_dialog_update_present_units(), city_dialog_update_supported_units(), unit_item::unit_item(), and units_orders_city_dlg_callback().