![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <math.h>#include <string.h>#include "astring.h"#include "fcintl.h"#include "log.h"#include "nation.h"#include "support.h"#include "calendar.h"#include "citizens.h"#include "city.h"#include "clientutils.h"#include "combat.h"#include "culture.h"#include "effects.h"#include "fc_types.h"#include "game.h"#include "government.h"#include "map.h"#include "movement.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 "text.h"
Include dependency graph for text.cpp:Go to the source code of this file.
Macros | |
| #define | FAR_CITY_SQUARE_DIST (2 * (6 * 6)) |
Functions | |
| int | get_bulbs_per_turn (int *pours, bool *pteam, int *ptheirs) |
| Return total expected bulbs. More... | |
| const QString | get_tile_output_text (const struct tile *ptile) |
| Return a (static) string with a tile's food/prod/trade. More... | |
| static void | get_full_username (char *buf, int buflen, const struct player *pplayer) |
| For AIs, fill the buffer with their player name prefixed with "AI". More... | |
| static void | get_full_nation (char *buf, int buflen, const struct player *pplayer) |
| Fill the buffer with the player's nation name (in adjective form) and optionally add the player's team name. More... | |
| const QString | popup_info_text (struct tile *ptile) |
| Text to popup on a middle-click in the mapview. More... | |
| const QString | get_nearest_city_text (struct city *pcity, int sq_dist) |
| Returns the text describing the city and its distance. More... | |
| const QString | unit_description (const unit *punit) |
| Returns the unit description. More... | |
| const QString | get_airlift_text (const std::vector< unit * > &units, const struct city *pdest) |
| Describe the airlift capacity of a city for the given units (from their current positions). More... | |
| int | turns_to_research_done (const struct research *presearch, int per_turn) |
| Return turns until research complete. More... | |
| static int | turns_per_advance (const struct research *presearch, int per_turn) |
| Return turns per advance (based on currently researched advance). More... | |
| static int | turns_to_tech_loss (const struct research *presearch, int per_turn) |
| Return turns until an advance is lost due to tech upkeep. More... | |
| const QString | science_dialog_text () |
| Returns the text to display in the science dialog. More... | |
| const QString | get_science_target_text () |
| Get the short science-target text. More... | |
| const QString | get_science_goal_text (Tech_type_id goal) |
| Set the science-goal-label text as if we're researching the given goal. More... | |
| const QString | get_info_label_text (bool moreinfo) |
| Return the text for the label on the info panel. More... | |
| const QString | get_info_label_text_popup () |
| Return the text for the popup label on the info panel. More... | |
| bool | get_units_upgrade_info (char *buf, size_t bufsz, const std::vector< unit * > &punits) |
| Return text about upgrading these unit lists. More... | |
| const QString | get_spaceship_descr (struct player_spaceship *pship) |
| Returns a description of the given spaceship. More... | |
| QString | get_score_text (const struct player *pplayer) |
| Return text giving the score of the player. More... | |
| const QString | 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). More... | |
| const QString | act_sel_action_tool_tip (const struct action *paction, const struct act_prob prob) |
| Get information about starting the action in the current situation. More... | |
| QString | text_happiness_buildings (const struct city *pcity) |
| Describe buildings that affect happiness (or rather, anything with a Make_Content effect). More... | |
| QString | text_happiness_nationality (const struct city *pcity) |
| Describing nationality effects that affect happiness. More... | |
| QString | text_happiness_wonders (const struct city *pcity) |
| Describing wonders that affect happiness. More... | |
| QString | text_happiness_cities (const struct city *pcity) |
| Describing city factors that affect happiness. More... | |
| QString | text_happiness_units (const struct city *pcity) |
| Describe units that affect happiness. More... | |
| QString | text_happiness_luxuries (const struct city *pcity) |
| Describing luxuries that affect happiness. More... | |
Get information about starting the action in the current situation.
Suitable for a tool tip for the button that starts it.
Definition at line 1333 of file text.cpp.
Referenced by action_entry(), and action_entry_update().
| const QString 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).
Definition at line 1274 of file text.cpp.
Referenced by action_selection_refresh(), and popup_action_selection().
Describe the airlift capacity of a city for the given units (from their current positions).
If pdest is non-nullptr, 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 nullptr if an airlift is not possible for any of the units.
Definition at line 612 of file text.cpp.
Referenced by goto_dialog::fill_tab().
| int get_bulbs_per_turn | ( | int * | pours, |
| bool * | pteam, | ||
| int * | ptheirs | ||
| ) |
Return total expected bulbs.
Definition at line 714 of file text.cpp.
Referenced by get_info_label_text_popup(), get_science_goal_text(), get_science_target_text(), real_science_report_dialog_update(), 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 112 of file text.cpp.
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 88 of file text.cpp.
Referenced by popup_info_text().
| const QString 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.
Definition at line 981 of file text.cpp.
Referenced by pageGame::updateSidebarTooltips().
| const QString get_info_label_text_popup | ( | ) |
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.)
Definition at line 1036 of file text.cpp.
Referenced by pageGame::updateSidebarTooltips().
| const QString get_nearest_city_text | ( | struct city * | pcity, |
| int | sq_dist | ||
| ) |
Returns the text describing the city and its distance.
Definition at line 522 of file text.cpp.
Referenced by get_units_waiting_data(), and unit_description().
| const QString get_science_goal_text | ( | Tech_type_id | goal | ) |
Set the science-goal-label text as if we're researching the given goal.
Definition at line 927 of file text.cpp.
Referenced by science_report::update_report().
| const QString get_science_target_text | ( | ) |
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).
Definition at line 887 of file text.cpp.
Referenced by get_info_label_text_popup(), and science_report::update_report().
| QString get_score_text | ( | const struct player * | pplayer | ) |
| const QString get_spaceship_descr | ( | struct player_spaceship * | pship | ) |
Returns a description of the given spaceship.
If there is no spaceship (pship is nullptr) then text with dummy values is returned.
Definition at line 1197 of file text.cpp.
Referenced by ss_report::update_report().
| const QString get_tile_output_text | ( | const struct tile * | ptile | ) |
Return a (static) string with a tile's food/prod/trade.
Definition at line 52 of file text.cpp.
Referenced by popup_info_text(), and popup_terrain_info().
| bool get_units_upgrade_info | ( | char * | buf, |
| size_t | bufsz, | ||
| const std::vector< unit * > & | punits | ||
| ) |
Return text about upgrading these unit lists.
Returns TRUE iff any units can be upgraded.
Definition at line 1132 of file text.cpp.
Referenced by popup_upgrade_dialog().
| const QString popup_info_text | ( | struct tile * | ptile | ) |
Text to popup on a middle-click in the mapview.
Definition at line 137 of file text.cpp.
Referenced by info_tile::info_tile(), and hud_units::update_actions().
| const QString science_dialog_text | ( | ) |
Returns the text to display in the science dialog.
Definition at line 812 of file text.cpp.
Referenced by show_new_turn_info(), science_report::update_report(), and pageGame::updateSidebarTooltips().
| QString text_happiness_buildings | ( | const struct city * | pcity | ) |
Describe buildings that affect happiness (or rather, anything with a Make_Content effect).
Definition at line 1389 of file text.cpp.
Referenced by city_dialog::update_citizens().
| QString text_happiness_cities | ( | const struct city * | pcity | ) |
Describing city factors that affect happiness.
Definition at line 1754 of file text.cpp.
Referenced by city_dialog::update_citizens().
| QString text_happiness_luxuries | ( | const struct city * | pcity | ) |
Describing luxuries that affect happiness.
Definition at line 1949 of file text.cpp.
Referenced by city_dialog::update_citizens().
| QString text_happiness_nationality | ( | const struct city * | pcity | ) |
Describing nationality effects that affect happiness.
Definition at line 1427 of file text.cpp.
Referenced by city_dialog::update_citizens().
| QString text_happiness_units | ( | const struct city * | pcity | ) |
Describe units that affect happiness.
Definition at line 1811 of file text.cpp.
Referenced by city_dialog::update_citizens().
| QString text_happiness_wonders | ( | const struct city * | pcity | ) |
Describing wonders that affect happiness.
Definition at line 1490 of file text.cpp.
Referenced by city_dialog::update_citizens().
|
static |
Return turns per advance (based on currently researched advance).
-1 for no progress.
Definition at line 780 of file text.cpp.
Referenced by science_dialog_text().
| int turns_to_research_done | ( | const struct research * | presearch, |
| int | per_turn | ||
| ) |
Return turns until research complete.
-1 for never.
Definition at line 761 of file text.cpp.
Referenced by get_science_target_text(), and real_science_report_dialog_update().
|
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 794 of file text.cpp.
Referenced by get_science_target_text(), and science_dialog_text().
| const QString unit_description | ( | const unit * | punit | ) |
Returns the unit description.
Used in e.g. city report tooltips.
FIXME: This function is not re-entrant because it returns a pointer to static data.
Definition at line 551 of file text.cpp.
Referenced by popup_info_text(), freeciv::upkeep_widget::refresh(), and unit_list_widget::set_units().