Freeciv-3.3
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions
climisc.h File Reference
#include "fc_types.h"
#include "featured_text.h"
#include "events.h"
#include "unittype.h"
#include "unitlist.h"

Go to the source code of this file.

Data Structures

struct  item
 

Macros

#define cid_production   cid_decode
 
#define MAX_NUM_PRODUCTION_TARGETS   (U_LAST + B_LAST)
 

Typedefs

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

Enumerations

enum  unit_bg_color_type {
  UNIT_BG_HP_LOSS , UNIT_BG_LAND , UNIT_BG_SEA , UNIT_BG_AMPHIBIOUS ,
  UNIT_BG_FLYING
}
 

Functions

void client_remove_player (int plrno)
 
void client_remove_city (struct city *pcity)
 
void client_remove_unit (struct unit *punit)
 
void client_change_all (struct universal *from, struct universal *to)
 
const charget_embassy_status (const struct player *me, const struct player *them)
 
const charget_vision_status (const struct player *me, const struct player *them)
 
void client_diplomacy_clause_string (char *buf, int bufsiz, struct Clause *pclause)
 
void global_warming_scaled (int *chance, int *rate, int max)
 
void nuclear_winter_scaled (int *chance, int *rate, int max)
 
struct spriteclient_research_sprite (void)
 
struct spriteclient_warming_sprite (void)
 
struct spriteclient_cooling_sprite (void)
 
struct spriteclient_government_sprite (void)
 
void center_on_something (void)
 
cid cid_encode (struct universal target)
 
cid cid_encode_unit (const struct unit_type *punittype)
 
cid cid_encode_building (const struct impr_type *pimprove)
 
cid cid_encode_from_city (const struct city *pcity)
 
struct universal cid_decode (cid cid)
 
bool city_unit_supported (const struct city *pcity, const struct universal *target)
 
bool city_unit_present (const struct city *pcity, const struct universal *target)
 
bool city_building_present (const struct city *pcity, const struct universal *target)
 
bool can_city_build_now_client (const struct city *pcity, const struct universal *target)
 
void name_and_sort_items (struct universal *targets, int num_items, struct item *items, bool show_cost, struct city *pcity)
 
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)
 
int collect_currently_building_targets (struct universal *targets)
 
int collect_buildable_targets (struct universal *targets)
 
int collect_eventually_buildable_targets (struct universal *targets, struct city *pcity, bool advanced_tech)
 
int collect_already_built_targets (struct universal *targets, struct city *pcity)
 
int num_present_units_in_city (struct city *pcity)
 
int num_supported_units_in_city (struct city *pcity)
 
void handle_event (const char *featured_text, struct tile *ptile, enum event_type event, int turn, int phase, int conn_id)
 
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)
 
void cityrep_buy (struct city *pcity)
 
void common_taxrates_callback (int idx, bool reverse)
 
bool can_units_do_connect (struct unit_list *punits, enum unit_activity activity, struct extra_type *tgt)
 
void client_unit_init_act_prob_cache (struct unit *punit)
 
enum unit_bg_color_type unit_color_type (const struct unit_type *punittype)
 
void buy_production_in_selected_cities (void)
 
void unit_focus_set_status (struct player *pplayer)
 
void client_player_init (struct player *pplayer)
 
void client_player_maps_reset (void)
 
bool mapimg_client_define (void)
 
bool mapimg_client_createmap (const char *filename)
 
struct nation_setclient_current_nation_set (void)
 
bool client_nation_is_in_current_set (const struct nation_type *pnation)
 
enum ai_level server_ai_level (void)
 

Macro Definition Documentation

◆ cid_production

#define cid_production   cid_decode

Definition at line 71 of file climisc.h.

◆ MAX_NUM_PRODUCTION_TARGETS

#define MAX_NUM_PRODUCTION_TARGETS   (U_LAST + B_LAST)

Definition at line 89 of file climisc.h.

Typedef Documentation

◆ cid

Definition at line 31 of file climisc.h.

◆ TestCityFunc

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

Definition at line 87 of file climisc.h.

Enumeration Type Documentation

◆ unit_bg_color_type

Enumerator
UNIT_BG_HP_LOSS 
UNIT_BG_LAND 
UNIT_BG_SEA 
UNIT_BG_AMPHIBIOUS 
UNIT_BG_FLYING 

Definition at line 127 of file climisc.h.

Function Documentation

◆ buy_production_in_selected_cities()

void buy_production_in_selected_cities ( void  )

For each selected city, buy the current production. The selected cities are sorted so production is bought in the cities with lowest cost first.

Definition at line 1317 of file climisc.c.

Referenced by key_press_map_canvas(), and key_press_map_canvas().

◆ can_city_build_now_client()

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

◆ can_units_do_connect()

bool can_units_do_connect ( struct unit_list *  punits,
enum unit_activity  activity,
struct extra_type tgt 
)

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

Definition at line 1242 of file climisc.c.

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

◆ center_on_something()

void center_on_something ( void  )

Find something sensible to display. This is used to overwrite the intro gfx.

Definition at line 430 of file climisc.c.

Referenced by real_resize_window_callback(), real_set_client_page(), set_client_state(), and fc_client::switch_page().

◆ cid_decode()

struct universal cid_decode ( cid  id)

◆ cid_encode()

cid cid_encode ( struct universal  target)

◆ cid_encode_building()

cid cid_encode_building ( const struct impr_type pimprove)

Encode a CID for the target building.

Definition at line 505 of file climisc.c.

Referenced by add_global_worklist(), economy_report_update(), popup_worklist_editor(), and eco_report::update_report().

◆ cid_encode_from_city()

cid cid_encode_from_city ( const struct city pcity)

Encode a CID for the target city's production.

Definition at line 518 of file climisc.c.

Referenced by collect_currently_building_targets().

◆ cid_encode_unit()

cid cid_encode_unit ( const struct unit_type punittype)

Encode a CID for the target unit type.

Definition at line 493 of file climisc.c.

Referenced by add_global_worklist(), economy_report_update(), popup_worklist_editor(), and eco_report::update_report().

◆ 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 583 of file climisc.c.

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

◆ 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 564 of file climisc.c.

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

◆ 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 545 of file climisc.c.

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

◆ 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 1155 of file climisc.c.

Referenced by city_widget::buy(), and buy_iterate().

◆ client_change_all()

void client_change_all ( struct universal from,
struct universal to 
)

Change all cities building X to building Y, if possible. X and Y could be improvements or units. X and Y are compound ids.

Definition at line 165 of file climisc.c.

◆ client_cooling_sprite()

struct sprite * client_cooling_sprite ( void  )

Return the sprite for the global-cooling indicator.

Definition at line 394 of file climisc.c.

Referenced by setup_widgets(), show_game_page(), fc_sidewidget::update_final_pixmap(), fc_client::update_info_label(), and update_info_label().

◆ client_current_nation_set()

struct nation_set * client_current_nation_set ( void  )

Returns the nation set in use.

Definition at line 1492 of file climisc.c.

Referenced by client_nation_is_in_current_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 241 of file climisc.c.

Referenced by update_clauses_list(), update_diplomacy_dialog(), and diplo_wdg::update_wdg().

◆ client_government_sprite()

struct sprite * client_government_sprite ( void  )

◆ client_nation_is_in_current_set()

bool client_nation_is_in_current_set ( const struct nation_type pnation)

Returns Whether 'pnation' is in the current nation set.

Mostly a client stub.

Definition at line 1509 of file climisc.c.

Referenced by extviewer_refresh_widgets(), and show_help_for_nation().

◆ client_player_init()

void client_player_init ( struct player pplayer)

Initialize a player on the client side.

Definition at line 1373 of file climisc.c.

Referenced by handle_player_info().

◆ client_player_maps_reset()

void client_player_maps_reset ( void  )

Reset the private maps of all players.

Definition at line 1384 of file climisc.c.

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.c.

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

◆ client_remove_player()

void client_remove_player ( int  plrno)

◆ client_remove_unit()

void client_remove_unit ( struct unit punit)

Remove unit, client end version

Definition at line 72 of file climisc.c.

Referenced by handle_unit_remove().

◆ client_research_sprite()

struct sprite * client_research_sprite ( void  )

Return the sprite for the research indicator.

Definition at line 354 of file climisc.c.

Referenced by popup_unitinfo_window(), setup_widgets(), fc_sidewidget::update_final_pixmap(), fc_client::update_info_label(), and update_info_label().

◆ 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 1259 of file climisc.c.

Referenced by act_sel_done_primary(), diplomat_queue_handle_primary(), diplomat_queue_handle_primary(), and popup_action_selection().

◆ client_warming_sprite()

struct sprite * client_warming_sprite ( void  )

Return the sprite for the global-warming indicator.

Definition at line 377 of file climisc.c.

Referenced by setup_widgets(), show_game_page(), fc_sidewidget::update_final_pixmap(), fc_client::update_info_label(), and update_info_label().

◆ 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 913 of file climisc.c.

Referenced by city_dialog_update_improvement_list(), and city_dialog::update_improvements().

◆ collect_buildable_targets()

int collect_buildable_targets ( struct universal targets)

Collect the cids of all targets (improvements and units) which can be build in a city.

FIXME: this should probably take a pplayer argument.

Definition at line 788 of file climisc.c.

◆ collect_currently_building_targets()

int collect_currently_building_targets ( struct universal targets)

Collect the cids of all targets (improvements and units) which are currently built in a city.

FIXME: this should probably take a pplayer argument.

Definition at line 756 of file climisc.c.

◆ 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 819 of file climisc.c.

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

◆ 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 700 of file climisc.c.

Referenced by append_impr_or_unit_to_menu(), append_impr_or_unit_to_menu_item(), and city_widget::gen_production_labels().

◆ common_taxrates_callback()

void common_taxrates_callback ( int  idx,
bool  reverse 
)

Switch between tax/sci/lux at given slot.

Definition at line 1194 of file climisc.c.

Referenced by reverse_taxrates_callback(), taxrates_callback(), and taxrates_callback().

◆ 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 194 of file climisc.c.

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 NULL. Returns NULL only if no city is known. Favors punit owner's cities over other cities if equally distant.

Definition at line 1119 of file climisc.c.

Referenced by create_present_supported_units_widget_list(), 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 222 of file climisc.c.

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 334 of file climisc.c.

Referenced by client_warming_sprite(), get_global_warming_tooltip(), 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 968 of file climisc.c.

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

◆ mapimg_client_createmap()

bool mapimg_client_createmap ( const char filename)

Save map image.

Definition at line 1466 of file climisc.c.

Referenced by mapimg_client_save().

◆ mapimg_client_define()

bool mapimg_client_define ( void  )

Create a map image definition on the client.

Definition at line 1409 of file climisc.c.

Referenced by mapimg_client_createmap().

◆ 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 650 of file climisc.c.

Referenced by append_impr_or_unit_to_menu(), append_impr_or_unit_to_menu_item(), city_dialog::change_production(), city_dialog_update_building(), city_dialog_update_improvement_list(), city_widget::gen_production_labels(), city_production_model::populate(), refresh_worklist(), 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 344 of file climisc.c.

Referenced by client_cooling_sprite(), get_info_label_text_popup(), and get_nuclear_winter_tooltip().

◆ num_present_units_in_city()

int num_present_units_in_city ( struct city pcity)

Returns number of units known to be in city. This might not real number of units in case of enemy city.

Definition at line 951 of file climisc.c.

◆ num_supported_units_in_city()

int num_supported_units_in_city ( struct city pcity)

Returns number of units known to be supported by city. This might not real number of units in case of enemy city.

Definition at line 933 of file climisc.c.

◆ server_ai_level()

enum ai_level server_ai_level ( void  )

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 1519 of file climisc.c.

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

◆ unit_color_type()

enum unit_bg_color_type unit_color_type ( const struct unit_type punittype)

Determines which color type should be used for unit background. This is only guesswork based on unit properties. One should not take UNIT_BG_FLYING seriously meaning that unit can fly - custom ruleset might have units with similar properties but explains these properties by some other means than by flying.

Definition at line 1275 of file climisc.c.

◆ 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 1363 of file climisc.c.

Referenced by handle_start_phase().