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

Go to the source code of this file.

Classes

struct  item
 

Macros

#define MAX_NUM_PRODUCTION_TARGETS   (U_LAST + B_LAST)
 

Typedefs

typedef int cid
 
typedef bool(* TestCityFunc) (const struct city *, const struct universal *)
 

Functions

void client_remove_city (struct city *pcity)
 Remove city, client end version. More...
 
void client_remove_unit (struct unit *punit)
 Remove unit, client end version. More...
 
const char * get_embassy_status (const struct player *me, const struct player *them)
 Return a string indicating one nation's embassy status with another. More...
 
const char * get_vision_status (const struct player *me, const struct player *them)
 Return a string indicating one nation's shaed vision status with another. More...
 
void client_diplomacy_clause_string (char *buf, int bufsiz, struct Clause *pclause)
 Copy a string that describes the given clause into the return buffer. More...
 
void global_warming_scaled (int *chance, int *rate, int max)
 Return global warming chance and rate of change, scaled to max. More...
 
void nuclear_winter_scaled (int *chance, int *rate, int max)
 Return nuclear winter chance and rate of change, scaled to max. More...
 
const QPixmap * client_research_sprite ()
 Return the sprite for the research indicator. More...
 
const QPixmap * client_warming_sprite ()
 Return the sprite for the global-warming indicator. More...
 
const QPixmap * client_cooling_sprite ()
 Return the sprite for the global-cooling indicator. More...
 
const QPixmap * client_government_sprite ()
 Return the sprite for the government indicator. More...
 
void center_on_something ()
 Find something sensible to display. More...
 
cid cid_encode (struct universal target)
 Encode a CID for the target production. More...
 
cid cid_encode_unit (const struct unit_type *punittype)
 Encode a CID for the target unit type. More...
 
cid cid_encode_building (const struct impr_type *pimprove)
 Encode a CID for the target building. More...
 
struct universal cid_decode (cid cid)
 Decode the CID into a city_production structure. More...
 
bool city_unit_supported (const struct city *pcity, const struct universal *target)
 Return TRUE if the city supports at least one unit of the given production type (returns FALSE if the production is a building). More...
 
bool city_unit_present (const struct city *pcity, const struct universal *target)
 Return TRUE if the city has present at least one unit of the given production type (returns FALSE if the production is a building). More...
 
bool city_building_present (const struct city *pcity, const struct universal *target)
 A TestCityFunc to tell whether the item is a building and is present. More...
 
void name_and_sort_items (struct universal *targets, int num_items, struct item *items, bool show_cost, struct city *pcity)
 Takes an array of compound ids (cids). More...
 
int collect_production_targets (struct universal *targets, struct city **selected_cities, int num_selected_cities, bool append_units, bool append_wonders, bool change_prod, TestCityFunc test_func)
 Return possible production targets for the current player's cities. More...
 
int collect_eventually_buildable_targets (struct universal *targets, struct city *pcity, bool advanced_tech)
 Collect the cids of all targets which can be build by this city or in general. More...
 
int collect_already_built_targets (struct universal *targets, struct city *pcity)
 Collect the cids of all improvements which are built in the given city. More...
 
void handle_event (const char *featured_text, struct tile *ptile, enum event_type event, int turn, int phase, int conn_id)
 Handles a chat or event message. More...
 
void create_event (struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...) fc__attribute((__format__(__printf__
 
void struct cityget_nearest_city (const struct unit *punit, int *sq_dist)
 Find city nearest to given unit and optionally return squared city distance Parameter sq_dist may be nullptr. More...
 
void cityrep_buy (struct city *pcity)
 Called when the "Buy" button is pressed in the city report for every selected city. More...
 
bool can_units_do_connect (const std::vector< unit * > &units, enum unit_activity activity, struct extra_type *tgt)
 Returns TRUE if any of the units can do the connect activity. More...
 
void client_unit_init_act_prob_cache (struct unit *punit)
 Initialize the action probability cache. More...
 
void unit_focus_set_status (struct player *pplayer)
 Set focus status of all player units to FOCUS_AVAIL. More...
 
void client_player_init (struct player *pplayer)
 Initialize a player on the client side. More...
 
void client_player_maps_reset ()
 Reset the private maps of all players. More...
 
bool mapimg_client_define ()
 Create a map image definition on the client. More...
 
struct nation_setclient_current_nation_set ()
 Returns the nation set in use. More...
 
enum ai_level server_ai_level ()
 Returns the current AI skill level on the server, if the same level is currently used for all current AI players and will be for new ones; else return ai_level_invalid() to indicate inconsistency. More...
 

Macro Definition Documentation

◆ MAX_NUM_PRODUCTION_TARGETS

#define MAX_NUM_PRODUCTION_TARGETS   (U_LAST + B_LAST)

Definition at line 73 of file climisc.h.

Typedef Documentation

◆ cid

typedef int cid

Definition at line 23 of file climisc.h.

◆ TestCityFunc

typedef bool(* TestCityFunc) (const struct city *, const struct universal *)

Definition at line 71 of file climisc.h.

Function Documentation

◆ can_units_do_connect()

bool can_units_do_connect ( const std::vector< unit * > &  units,
enum unit_activity  activity,
struct extra_type tgt 
)

Returns TRUE if any of the units can do the connect activity.

Definition at line 1056 of file climisc.cpp.

Referenced by mr_menu::menus_sensitive(), and request_unit_connect().

◆ center_on_something()

void center_on_something ( )

Find something sensible to display.

This is used to overwrite the intro gfx.

Definition at line 392 of file climisc.cpp.

Referenced by client_state(), and fc_client::current_page().

◆ cid_decode()

◆ cid_encode()

cid cid_encode ( struct universal  target)

Encode a CID for the target production.

Definition at line 446 of file climisc.cpp.

Referenced by city_dialog::change_production(), cid_decode(), cid_encode_unit(), and city_widget::gen_production_labels().

◆ cid_encode_building()

cid cid_encode_building ( const struct impr_type pimprove)

Encode a CID for the target building.

Definition at line 467 of file climisc.cpp.

Referenced by eco_report::update_report().

◆ cid_encode_unit()

cid cid_encode_unit ( const struct unit_type punittype)

Encode a CID for the target unit type.

Definition at line 456 of file climisc.cpp.

Referenced by eco_report::update_report(), units_view::update_units(), and units_view::update_waiting().

◆ city_building_present()

bool city_building_present ( const struct city pcity,
const struct universal target 
)

A TestCityFunc to tell whether the item is a building and is present.

Definition at line 538 of file climisc.cpp.

Referenced by city_widget::display_list_menu(), and city_widget::gen_select_labels().

◆ city_unit_present()

bool city_unit_present ( const struct city pcity,
const struct universal target 
)

Return TRUE if the city has present at least one unit of the given production type (returns FALSE if the production is a building).

Definition at line 518 of file climisc.cpp.

Referenced by city_widget::display_list_menu(), and city_widget::gen_select_labels().

◆ city_unit_supported()

bool city_unit_supported ( const struct city pcity,
const struct universal target 
)

Return TRUE if the city supports at least one unit of the given production type (returns FALSE if the production is a building).

Definition at line 497 of file climisc.cpp.

Referenced by city_widget::display_list_menu(), and city_widget::gen_select_labels().

◆ cityrep_buy()

void cityrep_buy ( struct city pcity)

Called when the "Buy" button is pressed in the city report for every selected city.

Checks for coinage and sufficient funds or request the purchase if everything is ok.

Definition at line 1019 of file climisc.cpp.

Referenced by city_widget::buy().

◆ client_cooling_sprite()

const QPixmap* client_cooling_sprite ( )

Return the sprite for the global-cooling indicator.

Definition at line 357 of file climisc.cpp.

Referenced by indicators_widget::paintEvent().

◆ client_current_nation_set()

◆ client_diplomacy_clause_string()

void client_diplomacy_clause_string ( char *  buf,
int  bufsiz,
struct Clause pclause 
)

Copy a string that describes the given clause into the return buffer.

Definition at line 213 of file climisc.cpp.

Referenced by diplo_wdg::update_wdg().

◆ client_government_sprite()

const QPixmap* client_government_sprite ( )

Return the sprite for the government indicator.

Definition at line 374 of file climisc.cpp.

Referenced by indicators_widget::paintEvent().

◆ client_player_init()

void client_player_init ( struct player pplayer)

Initialize a player on the client side.

Definition at line 1092 of file climisc.cpp.

Referenced by handle_player_info().

◆ client_player_maps_reset()

void client_player_maps_reset ( )

Reset the private maps of all players.

Definition at line 1104 of file climisc.cpp.

Referenced by handle_map_info().

◆ client_remove_city()

void client_remove_city ( struct city pcity)

Remove city, client end version.

Definition at line 134 of file climisc.cpp.

Referenced by handle_city_info(), handle_city_remove(), and handle_city_short_info().

◆ client_remove_unit()

void client_remove_unit ( struct unit punit)

Remove unit, client end version.

Definition at line 69 of file climisc.cpp.

Referenced by handle_unit_remove().

◆ client_research_sprite()

const QPixmap* client_research_sprite ( )

Return the sprite for the research indicator.

Definition at line 317 of file climisc.cpp.

Referenced by indicators_widget::paintEvent(), and indicators_widget::sizeHint().

◆ client_unit_init_act_prob_cache()

void client_unit_init_act_prob_cache ( struct unit punit)

Initialize the action probability cache.

Shouldn't be kept around permanently. Its data is quickly outdated.

Definition at line 1069 of file climisc.cpp.

Referenced by diplomat_queue_handle_primary(), and popup_action_selection().

◆ client_warming_sprite()

const QPixmap* client_warming_sprite ( )

Return the sprite for the global-warming indicator.

Definition at line 340 of file climisc.cpp.

Referenced by indicators_widget::paintEvent().

◆ collect_already_built_targets()

int collect_already_built_targets ( struct universal targets,
struct city pcity 
)

Collect the cids of all improvements which are built in the given city.

Definition at line 806 of file climisc.cpp.

Referenced by freeciv::upkeep_widget::refresh(), and city_dialog::update_improvements().

◆ collect_eventually_buildable_targets()

int collect_eventually_buildable_targets ( struct universal targets,
struct city pcity,
bool  advanced_tech 
)

Collect the cids of all targets which can be build by this city or in general.

Definition at line 701 of file climisc.cpp.

Referenced by city_dialog::change_production(), and city_production_model::populate().

◆ collect_production_targets()

int collect_production_targets ( struct universal targets,
struct city **  selected_cities,
int  num_selected_cities,
bool  append_units,
bool  append_wonders,
bool  change_prod,
TestCityFunc  test_func 
)

Return possible production targets for the current player's cities.

FIXME: this should probably take a pplayer argument.

Definition at line 648 of file climisc.cpp.

Referenced by city_widget::gen_production_labels().

◆ create_event()

void create_event ( struct tile ptile,
enum event_type  event,
const struct ft_color  color,
const char *  format,
  ... 
)

◆ get_embassy_status()

const char* get_embassy_status ( const struct player me,
const struct player them 
)

Return a string indicating one nation's embassy status with another.

Definition at line 169 of file climisc.cpp.

Referenced by col_embassy().

◆ get_nearest_city()

void struct city* get_nearest_city ( const struct unit punit,
int *  sq_dist 
)

Find city nearest to given unit and optionally return squared city distance Parameter sq_dist may be nullptr.

Returns nullptr only if no city is known. Favors punit owner's cities over other cities if equally distant.

Definition at line 980 of file climisc.cpp.

Referenced by get_units_waiting_data(), and unit_description().

◆ get_vision_status()

const char* get_vision_status ( const struct player me,
const struct player them 
)

Return a string indicating one nation's shaed vision status with another.

Definition at line 194 of file climisc.cpp.

Referenced by col_vision().

◆ global_warming_scaled()

void global_warming_scaled ( int *  chance,
int *  rate,
int  max 
)

Return global warming chance and rate of change, scaled to max.

Definition at line 299 of file climisc.cpp.

Referenced by client_warming_sprite(), and get_info_label_text_popup().

◆ handle_event()

void handle_event ( const char *  featured_text,
struct tile ptile,
enum event_type  event,
int  turn,
int  phase,
int  conn_id 
)

Handles a chat or event message.

Definition at line 827 of file climisc.cpp.

Referenced by create_event(), handle_chat_msg(), and handle_early_chat_msg().

◆ mapimg_client_define()

bool mapimg_client_define ( )

Create a map image definition on the client.

Definition at line 1133 of file climisc.cpp.

◆ name_and_sort_items()

void name_and_sort_items ( struct universal targets,
int  num_targets,
struct item items,
bool  show_cost,
struct city pcity 
)

Takes an array of compound ids (cids).

It will fill out an array of struct items and also sort it.

section 0: normal buildings section 1: Capitalization section 2: UTYF_CIVILIAN units section 3: other units section 4: small wonders section 5: great wonders

Definition at line 596 of file climisc.cpp.

Referenced by city_dialog::change_production(), city_widget::gen_production_labels(), city_production_model::populate(), freeciv::upkeep_widget::refresh(), and city_dialog::update_improvements().

◆ nuclear_winter_scaled()

void nuclear_winter_scaled ( int *  chance,
int *  rate,
int  max 
)

Return nuclear winter chance and rate of change, scaled to max.

Definition at line 308 of file climisc.cpp.

Referenced by client_cooling_sprite(), and get_info_label_text_popup().

◆ server_ai_level()

enum ai_level server_ai_level ( )

Returns the current AI skill level on the server, if the same level is currently used for all current AI players and will be for new ones; else return ai_level_invalid() to indicate inconsistency.

Definition at line 1190 of file climisc.cpp.

Referenced by pregame_options::ailevel_change(), and pregame_options::update_ai_level().

◆ unit_focus_set_status()

void unit_focus_set_status ( struct player pplayer)

Set focus status of all player units to FOCUS_AVAIL.

Definition at line 1080 of file climisc.cpp.

Referenced by handle_start_phase().