![]() |
Freeciv21
Develop your civilization from humble roots to a global empire
|
#include <cerrno>#include <cmath>#include <cstdlib>#include <cstring>#include "fcintl.h"#include "log.h"#include "nation.h"#include "support.h"#include "city.h"#include "culture.h"#include "game.h"#include "specialist.h"#include "unitlist.h"#include "citydlg_common.h"#include "governor.h"#include "options.h"#include "views/view_cities_data.h"#include "specvec.h"
Include dependency graph for view_cities_data.cpp:Go to the source code of this file.
Classes | |
| struct | datum |
| The following several functions allow intelligent sorting city report fields by column. More... | |
Macros | |
| #define | FUNC_TAG(var) cr_entry_##var, #var |
| #define | SPECVEC_TAG datum |
Functions | |
| static QString | cr_entry_cityname (const struct city *pcity, const void *data) |
| cr_entry = return an entry (one column for one city) for the city report These return ptrs to filled in static strings. More... | |
| static QString | cr_entry_nation (const struct city *pcity, const void *data) |
| Translated name of nation who owns this city. More... | |
| static QString | cr_entry_size (const struct city *pcity, const void *data) |
| Returns city size written to string. More... | |
| static QString | cr_entry_hstate_concise (const struct city *pcity, const void *data) |
| Returns concise city happiness state written to string. More... | |
| static QString | cr_entry_hstate_verbose (const struct city *pcity, const void *data) |
| Returns verbose city happiness state written to string. More... | |
| static QString | cr_entry_workers (const struct city *pcity, const void *data) |
| Returns number of citizens of each happiness state written to string. More... | |
| static QString | cr_entry_happy (const struct city *pcity, const void *data) |
| Returns number of happy citizens written to string. More... | |
| static QString | cr_entry_culture (const struct city *pcity, const void *data) |
| Returns city total culture written to string. More... | |
| static QString | cr_entry_history (const struct city *pcity, const void *data) |
| Returns city history culture value written to string. More... | |
| static QString | cr_entry_performance (const struct city *pcity, const void *data) |
| Returns city performance culture value written to string. More... | |
| static QString | cr_entry_content (const struct city *pcity, const void *data) |
| Returns number of content citizens written to string. More... | |
| static QString | cr_entry_unhappy (const struct city *pcity, const void *data) |
| Returns number of unhappy citizens written to string. More... | |
| static QString | cr_entry_angry (const struct city *pcity, const void *data) |
| Returns number of angry citizens written to string. More... | |
| static QString | cr_entry_specialists (const struct city *pcity, const void *data) |
| Returns list of specialists written to string. More... | |
| static QString | cr_entry_specialist (const struct city *pcity, const void *data) |
| Returns number of specialists of type given as data written to string. More... | |
| static QString | cr_entry_attack (const struct city *pcity, const void *data) |
| Returns string with best attack values of units in city. More... | |
| static QString | cr_entry_defense (const struct city *pcity, const void *data) |
| Returns string with best defend values of units in city. More... | |
| static QString | cr_entry_supported (const struct city *pcity, const void *data) |
| Returns number of supported units written to string. More... | |
| static QString | cr_entry_present (const struct city *pcity, const void *data) |
| Returns number of present units written to string. More... | |
| static QString | cr_entry_resources (const struct city *pcity, const void *data) |
| Returns string listing amounts of resources. More... | |
| static QString | cr_entry_foodplus (const struct city *pcity, const void *data) |
| Returns food surplus written to string. More... | |
| static QString | cr_entry_prodplus (const struct city *pcity, const void *data) |
| Returns production surplus written to string. More... | |
| static QString | cr_entry_tradeplus (const struct city *pcity, const void *data) |
| Returns trade surplus written to string. More... | |
| static QString | cr_entry_output (const struct city *pcity, const void *data) |
| Returns string describing resource output. More... | |
| static QString | cr_entry_gold (const struct city *pcity, const void *data) |
| Returns gold surplus written to string. More... | |
| static QString | cr_entry_luxury (const struct city *pcity, const void *data) |
| Returns luxury output written to string. More... | |
| static QString | cr_entry_science (const struct city *pcity, const void *data) |
| Returns science output written to string. More... | |
| static QString | cr_entry_growturns (const struct city *pcity, const void *data) |
| Returns number of turns before city grows written to string. More... | |
| static QString | cr_entry_pollution (const struct city *pcity, const void *data) |
| Returns pollution output written to string. More... | |
| static QString | cr_entry_trade_routes (const struct city *pcity, const void *data) |
| Returns number and output of trade routes written to string. More... | |
| static QString | cr_entry_build_slots (const struct city *pcity, const void *data) |
| Returns number of build slots written to string. More... | |
| static QString | cr_entry_building (const struct city *pcity, const void *data) |
| Returns name of current production. More... | |
| static QString | cr_entry_build_cost (const struct city *pcity, const void *data) |
| Returns cost of buying current production and turns to completion written to string. More... | |
| static QString | cr_entry_build_cost_gold (const struct city *pcity, const void *data) |
| Returns cost of buying current production only written to string. More... | |
| static QString | cr_entry_build_cost_turns (const struct city *pcity, const void *data) |
| Returns current production turns to completion written to string. More... | |
| static QString | cr_entry_corruption (const struct city *pcity, const void *data) |
| Returns corruption amount written to string. More... | |
| static QString | cr_entry_waste (const struct city *pcity, const void *data) |
| Returns waste amount written to string. More... | |
| static QString | cr_entry_plague_risk (const struct city *pcity, const void *data) |
| Returns risk percentage of plague written to string. More... | |
| static QString | cr_entry_continent (const struct city *pcity, const void *data) |
| Returns number of continent. More... | |
| static QString | cr_entry_cma (const struct city *pcity, const void *data) |
| Returns city cma description. More... | |
| int | num_city_report_spec () |
| Simple wrapper for num_creport_cols() More... | |
| bool * | city_report_spec_show_ptr (int i) |
| Simple wrapper for city_report_specs.show. More... | |
| const char * | city_report_spec_tagname (int i) |
| Simple wrapper for city_report_specs.tagname. More... | |
| void | init_city_report_game_data () |
| Initialize city report data. More... | |
| static void | init_datum_string (struct datum *dat, const char *left, const char *right) |
| Init a datum from a substring. More... | |
| static void | init_datum_number (struct datum *dat, float val) |
| Init a datum from a number (a float because we happen to use strtof). More... | |
| static void | free_datum (struct datum *dat) |
| Free the data associated with a datum – that is, free the string if it was allocated. More... | |
| static int | datum_compare (const struct datum *a, const struct datum *b) |
| Compare two data items as described above: More... | |
| static int | data_compare (const struct datum_vector *a, const struct datum_vector *b) |
| Compare two strings of data lexicographically. More... | |
| static void | split_string (struct datum_vector *data, const char *str) |
| Split a string into a vector of datum. More... | |
| static void | free_data (struct datum_vector *data) |
| Free every datum in the vector. More... | |
| int | cityrepfield_compare (const char *str1, const char *str2) |
| The real function: split the two strings, and compare them. More... | |
| bool | can_city_sell_universal (const struct city *pcity, const struct universal *target) |
| Same as can_city_sell_building(), but with universal argument. More... | |
Variables | |
| static const struct city_report_spec | base_city_report_specs [] |
| std::vector< city_report_spec > | city_report_specs |
| static int | num_creport_cols |
| #define FUNC_TAG | ( | var | ) | cr_entry_##var, #var |
Definition at line 731 of file view_cities_data.cpp.
| #define SPECVEC_TAG datum |
Definition at line 965 of file view_cities_data.cpp.
Same as can_city_sell_building(), but with universal argument.
Definition at line 1145 of file view_cities_data.cpp.
Referenced by city_widget::display_list_menu().
| bool* city_report_spec_show_ptr | ( | int | i | ) |
Simple wrapper for city_report_specs.show.
Definition at line 853 of file view_cities_data.cpp.
| const char* city_report_spec_tagname | ( | int | i | ) |
Simple wrapper for city_report_specs.tagname.
Definition at line 861 of file view_cities_data.cpp.
| int cityrepfield_compare | ( | const char * | str1, |
| const char * | str2 | ||
| ) |
The real function: split the two strings, and compare them.
Definition at line 1118 of file view_cities_data.cpp.
Referenced by city_sort_model::lessThan().
|
static |
Returns number of angry citizens written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 220 of file view_cities_data.cpp.
|
static |
Returns string with best attack values of units in city.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 260 of file view_cities_data.cpp.
|
static |
Returns cost of buying current production and turns to completion written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 572 of file view_cities_data.cpp.
|
static |
Returns cost of buying current production only written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 608 of file view_cities_data.cpp.
|
static |
Returns current production turns to completion written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 636 of file view_cities_data.cpp.
|
static |
Returns number of build slots written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 533 of file view_cities_data.cpp.
|
static |
Returns name of current production.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 546 of file view_cities_data.cpp.
|
static |
cr_entry = return an entry (one column for one city) for the city report These return ptrs to filled in static strings.
Note the returned string may not be exactly the right length; that is handled later.
Definition at line 50 of file view_cities_data.cpp.
|
static |
Returns city cma description.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 718 of file view_cities_data.cpp.
|
static |
Returns number of content citizens written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 194 of file view_cities_data.cpp.
|
static |
Returns number of continent.
Definition at line 705 of file view_cities_data.cpp.
|
static |
Returns corruption amount written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 660 of file view_cities_data.cpp.
|
static |
Returns city total culture written to string.
Definition at line 147 of file view_cities_data.cpp.
|
static |
Returns string with best defend values of units in city.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 298 of file view_cities_data.cpp.
|
static |
Returns food surplus written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 380 of file view_cities_data.cpp.
|
static |
Returns gold surplus written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 431 of file view_cities_data.cpp.
|
static |
Returns number of turns before city grows written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 472 of file view_cities_data.cpp.
|
static |
Returns number of happy citizens written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 136 of file view_cities_data.cpp.
|
static |
Returns city history culture value written to string.
Definition at line 157 of file view_cities_data.cpp.
|
static |
Returns concise city happiness state written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 83 of file view_cities_data.cpp.
|
static |
Returns verbose city happiness state written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 107 of file view_cities_data.cpp.
|
static |
Returns luxury output written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 448 of file view_cities_data.cpp.
|
static |
Translated name of nation who owns this city.
Definition at line 61 of file view_cities_data.cpp.
|
static |
Returns string describing resource output.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 416 of file view_cities_data.cpp.
|
static |
Returns city performance culture value written to string.
Definition at line 173 of file view_cities_data.cpp.
|
static |
Returns risk percentage of plague written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 686 of file view_cities_data.cpp.
|
static |
Returns pollution output written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 495 of file view_cities_data.cpp.
|
static |
Returns number of present units written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 352 of file view_cities_data.cpp.
|
static |
Returns production surplus written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 392 of file view_cities_data.cpp.
|
static |
Returns string listing amounts of resources.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 367 of file view_cities_data.cpp.
|
static |
Returns science output written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 460 of file view_cities_data.cpp.
|
static |
Returns city size written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 70 of file view_cities_data.cpp.
|
static |
Returns number of specialists of type given as data written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 244 of file view_cities_data.cpp.
Referenced by init_city_report_game_data().
|
static |
Returns list of specialists written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 233 of file view_cities_data.cpp.
Referenced by init_city_report_game_data().
|
static |
Returns number of supported units written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 337 of file view_cities_data.cpp.
|
static |
Returns number and output of trade routes written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 507 of file view_cities_data.cpp.
|
static |
Returns trade surplus written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 404 of file view_cities_data.cpp.
|
static |
Returns number of unhappy citizens written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 207 of file view_cities_data.cpp.
|
static |
Returns waste amount written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 674 of file view_cities_data.cpp.
|
static |
Returns number of citizens of each happiness state written to string.
Returned string is statically allocated and its contents change when this function is called again.
Definition at line 119 of file view_cities_data.cpp.
|
static |
Compare two strings of data lexicographically.
Definition at line 1037 of file view_cities_data.cpp.
Referenced by cityrepfield_compare().
Compare two data items as described above:
Definition at line 1009 of file view_cities_data.cpp.
Referenced by data_compare().
|
static |
Free every datum in the vector.
Definition at line 1105 of file view_cities_data.cpp.
Referenced by cityrepfield_compare().
|
static |
Free the data associated with a datum – that is, free the string if it was allocated.
Definition at line 996 of file view_cities_data.cpp.
Referenced by free_data().
| void init_city_report_game_data | ( | ) |
Initialize city report data.
This deals with ruleset-depedent columns and pre-translates the fields (to make things easier on the GUI writers). Should be called before the GUI starts up.
Definition at line 871 of file view_cities_data.cpp.
Referenced by client_state().
|
static |
Init a datum from a number (a float because we happen to use strtof).
Definition at line 986 of file view_cities_data.cpp.
Referenced by split_string().
|
static |
Init a datum from a substring.
Definition at line 971 of file view_cities_data.cpp.
Referenced by split_string().
| int num_city_report_spec | ( | ) |
Simple wrapper for num_creport_cols()
Definition at line 848 of file view_cities_data.cpp.
|
static |
Split a string into a vector of datum.
Definition at line 1060 of file view_cities_data.cpp.
Referenced by cityrepfield_compare().
|
static |
Definition at line 718 of file view_cities_data.cpp.
Referenced by init_city_report_game_data().
| std::vector<city_report_spec> city_report_specs |
Definition at line 842 of file view_cities_data.cpp.
Referenced by city_report_spec_show_ptr(), city_report_spec_tagname(), city_item::data(), city_widget::display_header_menu(), city_model::headerData(), city_model::hide_data(), init_city_report_game_data(), city_model::menu_data(), and city_item_delegate::paint().
|
static |
Definition at line 843 of file view_cities_data.cpp.
Referenced by init_city_report_game_data(), and num_city_report_spec().