Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/client_main.c File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Functions | Variables
client_main.c File Reference
`#include "fc_prehdrs.h"`
`#include <math.h>`
`#include <signal.h>`
`#include <stdarg.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <time.h>`
`#include "bitvector.h"`
`#include "capstr.h"`
`#include "dataio.h"`
`#include "deprecations.h"`
`#include "fcbacktrace.h"`
`#include "fc_cmdline.h"`
`#include "fciconv.h"`
`#include "fcintl.h"`
`#include "log.h"`
`#include "mem.h"`
`#include "rand.h"`
`#include "registry.h"`
`#include "support.h"`
`#include "timing.h"`
`#include "ai.h"`
`#include "diptreaty.h"`
`#include "fc_cmdhelp.h"`
`#include "fc_interface.h"`
`#include "game.h"`
`#include "idex.h"`
`#include "map.h"`
`#include "mapimg.h"`
`#include "netintf.h"`
`#include "packets.h"`
`#include "player.h"`
`#include "research.h"`
`#include "server_settings.h"`
`#include "version.h"`
`#include "chatline_g.h"`
`#include "citydlg_g.h"`
`#include "connectdlg_g.h"`
`#include "dialogs_g.h"`
`#include "diplodlg_g.h"`
`#include "editgui_g.h"`
`#include "graphics_g.h"`
`#include "gui_main_g.h"`
`#include "mapctrl_g.h"`
`#include "mapview_g.h"`
`#include "menu_g.h"`
`#include "messagewin_g.h"`
`#include "pages_g.h"`
`#include "plrdlg_g.h"`
`#include "repodlgs_g.h"`
`#include "voteinfo_bar_g.h"`
`#include "attribute.h"`
`#include "audio.h"`
`#include "cityrepdata.h"`
`#include "climisc.h"`
`#include "clinet.h"`
`#include "connectdlg_common.h"`
`#include "control.h"`
`#include "editor.h"`
`#include "global_worklist.h"`
`#include "helpdata.h"`
`#include "mapview_common.h"`
`#include "music.h"`
`#include "options.h"`
`#include "overview_common.h"`
`#include "packhand.h"`
`#include "tilespec.h"`
`#include "themes_common.h"`
`#include "update_queue.h"`
`#include "voteinfo.h"`
`#include "zoom.h"`
`#include "agents.h"`
`#include "cma_core.h"`
`#include "script_client.h"`
`#include "client_main.h"`

Go to the source code of this file.

## Functions

static enum known_type | mapimg_client_tile_known (const struct tile *ptile, const struct player *pplayer, bool knowledge)
static struct terrain * | mapimg_client_tile_terrain (const struct tile *ptile, const struct player *pplayer, bool knowledge)
static struct player * | mapimg_client_tile_owner (const struct tile *ptile, const struct player *pplayer, bool knowledge)
static struct player * | mapimg_client_tile_city (const struct tile *ptile, const struct player *pplayer, bool knowledge)
static struct player * | mapimg_client_tile_unit (const struct tile *ptile, const struct player *pplayer, bool knowledge)
static int | mapimg_client_plrcolor_count (void)
static struct rgbcolor * | mapimg_client_plrcolor_get (int i)
static void | fc_interface_init_client (void)
static char * | put_conv (const char *src, size_t *length)
static bool | get_conv (char *dst, size_t ndst, const char *src, size_t nsrc)
static void | charsets_init (void)
static void | emergency_exit (void)
static void | at_exit (void)
static void | client_game_init (void)
static void | client_game_free (void)
static void | client_game_reset (void)
int | default_tileset_select (void)
int | client_main (int argc, char *argv[], bool postpone_tileset)
static void | log_option_save_msg (enum log_level lvl, const char *msg,...)
void | client_exit (int return_value)
void | client_packet_input (void *packet, int type)
void | user_ended_turn (void)
void | send_turn_done (void)
void | send_report_request (enum report_type type)
void | set_client_state (enum client_states newstate)
enum client_states | client_state (void)
void | client_remove_cli_conn (struct connection *pconn)
void | client_remove_all_cli_conn (void)
void | send_attribute_block_request (void)
void | wait_till_request_got_processed (int request_id)
bool | client_is_observer (void)
void | set_seconds_to_turndone (double seconds)
bool | is_waiting_turn_change (void)
void | start_turn_change_wait (void)
void | stop_turn_change_wait (void)
int | get_seconds_to_turndone (void)
int | get_seconds_to_new_turn (void)
double | real_timer_callback (void)
bool | can_client_control (void)
bool | can_client_issue_orders (void)
bool | can_meet_with_player (const struct player *pplayer)
bool | can_intel_with_player (const struct player *pplayer)
const char * | title_for_player (const struct player *pplayer, char *buf, size_t buf_len)
bool | can_client_change_view (void)
void | set_server_busy (bool busy)
bool | is_server_busy (void)
bool | client_is_global_observer (void)
int | client_player_number (void)
bool | client_has_player (void)
bool | client_map_is_known_and_seen (const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
static int | client_plr_tile_city_id_get (const struct tile *ptile, const struct player *pplayer)
static server_setting_id | client_ss_by_name (const char *name)
static const char * | client_ss_name_get (server_setting_id id)
static enum sset_type | client_ss_type_get (server_setting_id id)
static bool | client_ss_val_bool_get (server_setting_id id)
static int | client_ss_val_int_get (server_setting_id id)
static unsigned int | client_ss_val_bitwise_get (server_setting_id id)
bool | is_client_quitting (void)
void | start_quitting (void)

## Variables

char * | logfile = NULL
char * | scriptfile = NULL
char * | savefile = NULL
char | forced_tileset_name [512] = "\0"
char | sound_plugin_name [512] = "\0"
char | sound_set_name [512] = "\0"
char | music_set_name [512] = "\0"
char | server_host [512] = "\0"
char | user_name [512] = "\0"
char | fc_password [MAX_LEN_PASSWORD] = "\0"
char | metaserver [512] = "\0"
int | server_port = -1
bool | auto_connect = FALSE
bool | auto_spawn = FALSE
enum announce_type | announce
struct civclient | client
static enum client_states | civclient_state = C_S_INITIAL
bool | waiting_for_end_turn = FALSE
static bool | server_busy = FALSE
static bool | client_quitting = FALSE
static double | seconds_to_turndone = 0.0
static struct timer * | turndone_timer
static struct timer * | between_turns = NULL
static bool | waiting_turn_change = FALSE
static int | seconds_shown_to_turndone
static int | seconds_shown_to_new_turn

## Function Documentation

## ◆ at_exit()

static void at_exit | ( | void |  | ) |

static

This is called at program exit.

Definition at line 235 of file client_main.c.

Referenced by client_main().

## ◆ can_client_change_view()

bool can_client_change_view | ( | void |  | ) |

Return TRUE if the client can change the view; i.e. if the mapview is active. This function should be called each time before allowing the user to do mapview actions.

Definition at line 1313 of file client_main.c.

Referenced by action_button_pressed(), butt_down_mapcanvas(), butt_down_overviewcanvas(), calculate_overview_dimensions(), center_on_something(), city_packet_common(), client_cooling_sprite(), client_government_sprite(), client_research_sprite(), client_warming_sprite(), get_overview_window(), handle_city_info(), handle_edit_startpos(), handle_edit_startpos_full(), handle_game_info(), handle_player_info(), handle_player_remove(), handle_tile_info(), key_city_overlay(), key_unit_select_battlegroup(), left_butt_down_mapcanvas(), map_canvas_draw(), map_canvas_draw(), map_canvas_resized(), meswin_dialog_update(), middle_butt_down_mapcanvas(), mouse_scroll_mapcanvas(), mouse_scroll_mapcanvas(), overview_canvas_draw(), overview_canvas_draw(), queue_mapview_tile_update(), queue_mapview_update(), real_menus_init(), real_menus_update(), recenter_button_pressed(), refresh_overview_canvas(), request_toggle_bases(), request_toggle_cities(), request_toggle_city_buycost(), request_toggle_city_full_bar(), request_toggle_city_growth(), request_toggle_city_names(), request_toggle_city_outlines(), request_toggle_city_output(), request_toggle_city_productions(), request_toggle_city_trade_routes(), request_toggle_coastline(), request_toggle_focus_unit(), request_toggle_fog_of_war(), request_toggle_huts(), request_toggle_irrigation(), request_toggle_map_borders(), request_toggle_map_grid(), request_toggle_map_native(), request_toggle_mines(), request_toggle_pollution(), request_toggle_resources(), request_toggle_roads_rails(), request_toggle_terrain(), request_toggle_unit_shields(), request_toggle_unit_solid_bg(), request_toggle_unit_stack_size(), request_toggle_units(), request_unit_select(), right_butt_down_mapcanvas(), right_butt_down_overviewcanvas(), scroll_mapview(), scrollbar_jump_callback(), set_client_state(), toplevel_key_press_handler(), toplevel_key_press_handler(), unit_focus_add(), unit_focus_advance(), unit_focus_remove(), unit_focus_set(), unit_focus_update(), unqueue_mapview_updates(), update_map_canvas_scrollbars(), usdlg_cmd_cursor_changed(), usdlg_cmd_exec(), and usdlg_cmd_focus_real().

## ◆ can_client_control()

bool can_client_control | ( | void |  | ) |

Returns TRUE iff the client can control player.

Definition at line 1254 of file client_main.c.

Referenced by can_client_issue_orders(), draw_calculated_trade_routes(), nation_button_callback(), ready_button_callback(), fc_client::slot_pregame_start(), fc_client::update_buttons(), update_start_page_buttons(), usdlg_cmd_cursor_changed(), usdlg_cmd_exec(), usdlg_cmd_focus_real(), and voteinfo_do_vote().

## ◆ can_client_issue_orders()

bool can_client_issue_orders | ( | void |  | ) |

Returns TRUE iff the client can issue orders (such as giving unit commands). This function should be called each time before allowing the user to give an order.

Definition at line 1265 of file client_main.c.

Referenced by action_decision_request(), adjust_workers_button_pressed(), append_cma_to_menu_item(), butt_down_overviewcanvas(), button_down_citymap(), city_dialog::buy(), buy_callback(), can_end_turn(), can_meet_with_player(), change_production_callback(), citizens_callback(), citizens_callback(), city_can_buy(), city_packet_common(), city_dialog::city_rename(), city_selection_changed_callback(), cityopt_callback(), city_dialog::clear_worklist(), client_change_all(), clipboard_copy_production(), clipboard_paste_production(), city_dialog::cma_double_clicked(), common_taxrates_callback(), city_map::context_menu(), unit_item::contextMenuEvent(), unit_item::create_actions(), create_and_append_settings_page(), create_governor_menu(), create_multiplier_dialog(), create_rates_dialog(), create_unit_menu(), create_wl_menu(), science_report::current_tech_changed(), disband_all_units(), city_widget::display_list_menu(), city_dialog::display_worklist_menu(), do_disband_alternative(), economy_report_command_callback(), economy_report_selection_callback(), enable_minimap_widgets(), enable_order_buttons(), enable_unitinfo_widgets(), science_report::goal_tech_changed(), handle_city_name_suggestion_info(), handle_city_sabotage_list(), handle_diplomacy_init_meeting(), diplo_dlg::init(), key_unit_assign_battlegroup(), left_butt_down_overviewcanvas(), left_button_down_citymap(), maybe_activate_keyboardless_goto(), mr_menu::menus_sensitive(), middle_present_unit_release(), middle_supported_unit_release(), impr_item::mouseDoubleClickEvent(), city_map::mousePressEvent(), city_label::mousePressEvent(), plr_widget::mousePressEvent(), research_diagram::mousePressEvent(), multipliers_command_callback(), popup_airlift_dialog(), popup_diplomacy_dialog(), popup_diplomacy_dialog(), popup_goto_dialog(), popup_multiplier_dialog(), popup_rates_dialog(), present_unit_callback(), present_unit_middle_callback(), city_dialog::production_changed(), production_menu_shown(), real_city_dialog_refresh(), real_menus_init(), real_menus_update(), real_multipliers_dialog_update(), refresh_cma_dialog(), refresh_worklist(), request_new_unit_activity_targeted(), request_orders_cleared(), request_unit_load(), request_unit_unload(), right_button_down_citymap(), right_unit_release(), science_diagram_button_release_callback(), science_diagram_left_button_up(), science_report_current_callback(), science_report_goal_callback(), science_report_init(), sell_all_improvements(), sell_callback(), set_government_choice(), spaceship_autoplace(), src_selection_callback(), supported_unit_callback(), supported_unit_middle_callback(), units_orders_city_dlg_callback(), units_report_command_callback(), units_report_selection_callback(), update_city_cma_dialog(), city_dialog::update_disabled(), update_players_menu(), plr_report::update_report(), upgrade_canvas_clipboard(), wakeup_button_pressed(), and wakeup_sentried_units().

## ◆ can_intel_with_player()

bool can_intel_with_player | ( | const struct player * | pplayer | ) |

Returns TRUE iff the client can get intelligence from another given player.

Definition at line 1286 of file client_main.c.

Referenced by button_press_callback(), left_button_press_callback(), player_nation_callback(), players_intel_callback(), players_intel_callback(), popup_players_nations_dialog(), title_for_player(), and update_players_menu().

## ◆ can_meet_with_player()

bool can_meet_with_player | ( | const struct player * | pplayer | ) |

Returns TRUE iff the client can do diplomatic meetings with another given player.

Definition at line 1275 of file client_main.c.

Referenced by button_press_callback(), call_meeting_dlg_callback(), player_nation_callback(), popup_diplomacy_dialog(), popup_players_nations_dialog(), right_button_press_callback(), update_players_menu(), and plr_report::update_report().

## ◆ charsets_init()

static void charsets_init | ( | void |  | ) |

static

Set up charsets for the client.

Definition at line 217 of file client_main.c.

Referenced by client_main().

## ◆ client_exit()

void client_exit | ( | int | return_value | ) |

Main client execution stop function. This calls ui_exit() and not the other way around.

Definition at line 728 of file client_main.c.

Referenced by client_main(), and default_tileset_select().

## ◆ client_game_free()

static void client_game_free | ( | void |  | ) |

static

Called by set_client_state() and client_exit() below.

Definition at line 270 of file client_main.c.

Referenced by client_exit(), and set_client_state().

## ◆ client_game_init()

static void client_game_init | ( | void |  | ) |

static

Called only by set_client_state() below.

Definition at line 247 of file client_main.c.

Referenced by set_client_state().

## ◆ client_game_reset()

static void client_game_reset | ( | void |  | ) |

static

Called only by set_client_state() below. Just free what is needed to change view (player target).

Definition at line 300 of file client_main.c.

Referenced by set_client_state().

## ◆ client_has_player()

bool client_has_player | ( | void |  | ) |

Either controlling or observing.

Definition at line 1365 of file client_main.c.

Referenced by center_on_something(), city_model_fill(), city_model_get(), client_remove_unit(), collect_production_targets(), editor_apply_tool(), editor_grab_applied_player(), editor_grab_tool(), fill_row(), find_nearest_unit(), get_bulbs_per_turn(), handle_endgame_player(), handle_page_msg(), handle_player_attribute_chunk(), handle_player_diplstate(), handle_start_phase(), handle_unit_packet_common(), handle_unit_remove(), key_editor_toggle_fogofwar(), meswin_add(), meswin_dialog_update(), city_model::populate(), popup_goto_dialog(), real_city_dialog_refresh(), real_menus_init(), mr_menu::save_image(), science_report_redraw(), set_client_state(), show_new_turn_info(), units_report_update(), update_goto_dialog(), units_reports::update_units(), and voteinfo_bar_can_be_shown().

## ◆ client_is_global_observer()

bool client_is_global_observer | ( | void |  | ) |

Returns whether client is global observer

Definition at line 1346 of file client_main.c.

Referenced by city_dialog_update_prev_next(), city_packet_common(), col_government(), create_city_dialog(), units_select::create_pixmap(), draw_trade_routes(), editbar_player_pov_combobox_changed(), editor_apply_tool(), get_culture_info(), get_gold_info(), get_luxury_info(), get_researching_info(), get_science_info(), get_tax_info(), handle_worker_task(), mapimg_client_define(), mapimg_client_tile_known(), plr_widget::nation_selected(), observe_button_callback(), popup_info_text(), popup_spaceship_dialog(), refresh_player_pov_indicator(), science_report_dialog_popup(), science_report_init(), show_full_citybar(), show_small_citybar(), side_left_click_science(), side_right_click_diplomacy(), fc_client::slot_pregame_observe(), switch_city_callback(), fc_client::update_buttons(), fc_sidewidget::update_final_pixmap(), update_intel_dialog(), fc_client::update_sidebar_tooltips(), update_start_page_buttons(), usdlg_data_new(), and usdlg_get_unit_descr().

## ◆ client_is_observer()

bool client_is_observer | ( | void |  | ) |

Returns whether client is observer.

Definition at line 1086 of file client_main.c.

Referenced by attribute_flush(), can_client_change_view(), can_client_control(), can_intel_with_player(), client_tile_get_known(), create_city_dialog(), city_dialog::disband_state_changed(), enqueue_call(), handle_diplomacy_init_meeting(), handle_event(), handle_start_phase(), handle_unit_short_info(), key_press_map_canvas(), key_press_map_canvas(), mr_menu::menus_sensitive(), production_widget::prod_selected(), real_city_dialog_refresh(), redraw_unit_info_label(), set_client_state(), show_new_turn_info(), side_rates_wdg(), side_right_click_diplomacy(), side_right_click_science(), fc_client::slot_pregame_observe(), switch_city_callback(), gov_menu::update(), mr_menu::update_airlift_menu(), mr_menu::update_bases_menu(), fc_client::update_buttons(), city_dialog::update_buy_button(), city_dialog::update_disabled(), update_info_label(), science_report::update_report(), mr_menu::update_roads_menu(), update_start_page_buttons(), and voteinfo_bar_can_be_shown().

## ◆ client_main()

int client_main | ( | int | argc,
|  | char * | argv[],
|  | bool | postpone_tileset
| ) |  |

Entry point for common client code.

Definition at line 344 of file client_main.c.

Referenced by main().

## ◆ client_map_is_known_and_seen()

bool client_map_is_known_and_seen | ( | const struct tile * | ptile,
|  | const struct player * | pplayer,
|  | enum vision_layer | vlayer
| ) |  |

Return the vision of the player on a tile. Client version of ./server/maphand/map_is_known_and_seen().

Definition at line 1374 of file client_main.c.

Referenced by fc_interface_init_client(), and infra_placement_set_tile().

## ◆ client_packet_input()

void client_packet_input | ( | void * | packet,
|  | int | type
| ) |  |

Handle packet received from server.

Definition at line 777 of file client_main.c.

Referenced by input_from_server(), and input_from_server_till_request_got_processed().

## ◆ client_player_number()

int client_player_number | ( | void |  | ) |

Returns number of player attached to client.

Definition at line 1354 of file client_main.c.

Referenced by diplo_wdg::diplo_wdg(), editbar_player_pov_combobox_changed(), editor_apply_tool(), and key_editor_toggle_fogofwar().

## ◆ client_plr_tile_city_id_get()

static int client_plr_tile_city_id_get | ( | const struct tile * | ptile,
|  | const struct player * | pplayer
| ) |  |

static

Returns the id of the city the player believes exists at 'ptile'.

Definition at line 1384 of file client_main.c.

Referenced by fc_interface_init_client().

## ◆ client_remove_all_cli_conn()

void client_remove_all_cli_conn | ( | void |  | ) |

Remove (and free) all connections from all connection lists in client. Assumes game.all_connections is properly maintained with all connections.

Definition at line 1055 of file client_main.c.

Referenced by client_exit(), and set_client_state().

## ◆ client_remove_cli_conn()

void client_remove_cli_conn | ( | struct connection * | pconn | ) |

Remove pconn from all connection lists in client, then free it.

Definition at line 1037 of file client_main.c.

Referenced by client_remove_all_cli_conn(), and handle_conn_info().

## ◆ client_ss_by_name()

static server_setting_id client_ss_by_name | ( | const char * | name | ) |

static

Returns the id of the server setting with the specified name.

Definition at line 1398 of file client_main.c.

Referenced by fc_interface_init_client().

## ◆ client_ss_name_get()

static const char * client_ss_name_get | ( | server_setting_id | id | ) |

static

Returns the name of the server setting with the specified id.

Definition at line 1413 of file client_main.c.

Referenced by fc_interface_init_client().

## ◆ client_ss_type_get()

static enum sset_type client_ss_type_get | ( | server_setting_id | id | ) |

static

Returns the type of the server setting with the specified id.

Definition at line 1428 of file client_main.c.

Referenced by fc_interface_init_client().

## ◆ client_ss_val_bitwise_get()

static unsigned int client_ss_val_bitwise_get | ( | server_setting_id | id | ) |

static

Returns the value of the bitwise server setting with the specified id.

Definition at line 1501 of file client_main.c.

Referenced by fc_interface_init_client().

## ◆ client_ss_val_bool_get()

static bool client_ss_val_bool_get | ( | server_setting_id | id | ) |

static

Returns the value of the boolean server setting with the specified id.

Definition at line 1471 of file client_main.c.

Referenced by fc_interface_init_client().

## ◆ client_ss_val_int_get()

static int client_ss_val_int_get | ( | server_setting_id | id | ) |

static

Returns the value of the integer server setting with the specified id.

Definition at line 1486 of file client_main.c.

Referenced by fc_interface_init_client().

## ◆ client_state()

enum client_states client_state | ( | void |  | ) |

Return current client state.

Definition at line 1029 of file client_main.c.

Referenced by apply_taxrates_callback(), boot_help_texts(), button_down_on_map(), button_up_on_map(), can_client_change_view(), can_client_issue_orders(), client_exit(), diplo_wdg::closeEvent(), control_mouse_cursor(), create_races_dialog(), disable_main_widgets(), enable_main_widgets(), finger_down_on_map(), finger_up_on_map(), flush_dirty(), flush_rect(), global_worklists_load(), gui_flush(), handle_event(), handle_research_info(), inputline_return(), map_view::keyPressEvent(), main_key_down_handler(), map_event_handler(), mr_menu::menus_sensitive(), musicspec_reread_callback(), option_dialog_new(), play_single_track(), popdown_all_game_dialogs(), popup_goto_dialog(), qtg_real_output_window_append(), races_dialog::races_dialog(), real_conn_list_dialog_update(), real_menus_init(), real_menus_update(), real_resize_window_callback(), real_timer_callback(), resize_minimap(), fc_game_tab_widget::resizeEvent(), minimap_view::resizeEvent(), chat_listener::send_chat_message(), start_style_music(), thaw(), themespec_reread(), tilespec_reread(), tilespec_reread_callback(), update_unit_info_label(), and update_unit_pix_label().

## ◆ default_tileset_select()

int default_tileset_select | ( | void |  | ) |

Do the initial default tileset selection.

Definition at line 322 of file client_main.c.

Referenced by client_main(), and qtg_ui_main().

## ◆ emergency_exit()

static void emergency_exit | ( | void |  | ) |

static

This is called at program exit in any emergency. This is registered as at_quick_exit() callback, so no destructor kind of actions here

Definition at line 227 of file client_main.c.

Referenced by at_exit(), and client_main().

## ◆ fc_interface_init_client()

static void fc_interface_init_client | ( | void |  | ) |

static

Initialize client specific functions.

Definition at line 1516 of file client_main.c.

Referenced by client_main().

## ◆ get_conv()

static bool get_conv | ( | char * | dst,
|  | size_t | ndst,
|  | const char * | src,
|  | size_t | nsrc
| ) |  |

static

Convert a text string from the data to the internal encoding when it is first read from the network. Returns FALSE if the destination isn't large enough or the source was bad.

Definition at line 189 of file client_main.c.

Referenced by charsets_init().

## ◆ get_seconds_to_new_turn()

int get_seconds_to_new_turn | ( | void |  | ) |

Return the number of seconds until turn-done. Don't call this unless current_turn_timeout() != 0.

Definition at line 1173 of file client_main.c.

Referenced by get_timeout_label_text().

## ◆ get_seconds_to_turndone()

int get_seconds_to_turndone | ( | void |  | ) |

Return the number of seconds until turn-done. Don't call this unless current_turn_timeout() != 0.

Definition at line 1159 of file client_main.c.

Referenced by get_timeout_label_text().

## ◆ is_client_quitting()

bool is_client_quitting | ( | void |  | ) |

Is the client marked as one going down?

Definition at line 1637 of file client_main.c.

Referenced by fc_client::closeEvent(), and set_client_state().

## ◆ is_server_busy()

bool is_server_busy | ( | void |  | ) |

Returns if server is considered busy at the moment

Definition at line 1338 of file client_main.c.

Referenced by can_end_turn(), and control_mouse_cursor().

## ◆ is_waiting_turn_change()

bool is_waiting_turn_change | ( | void |  | ) |

Are we in turn-change wait state?

Definition at line 1129 of file client_main.c.

Referenced by get_timeout_label_text(), and real_menus_update().

## ◆ log_option_save_msg()

static void log_option_save_msg | ( | enum log_level | lvl,
|  | const char * | msg,
|  |  | ...
| ) |  |

static

Write messages from option saving to the log.

Definition at line 715 of file client_main.c.

Referenced by client_exit().

## ◆ mapimg_client_plrcolor_count()

static int mapimg_client_plrcolor_count | ( | void |  | ) |

static

Helper function for the mapimg module - number of player colors.

Definition at line 1607 of file client_main.c.

Referenced by client_game_init().

## ◆ mapimg_client_plrcolor_get()

static struct rgbcolor * mapimg_client_plrcolor_get | ( | int | i | ) |

static

Helper function for the mapimg module - one player color. For the client only the colors of the defined players are shown.

Definition at line 1616 of file client_main.c.

Referenced by client_game_init().

## ◆ mapimg_client_tile_city()

static struct player * mapimg_client_tile_city | ( | const struct tile * | ptile,
|  | const struct player * | pplayer,
|  | bool | knowledge
| ) |  |

static

Helper function for the mapimg module - city owner.

Definition at line 1575 of file client_main.c.

Referenced by client_game_init().

## ◆ mapimg_client_tile_known()

static enum known_type mapimg_client_tile_known | ( | const struct tile * | ptile,
|  | const struct player * | pplayer,
|  | bool | knowledge
| ) |  |

static

Helper function for the mapimg module - tile knowledge.

Definition at line 1541 of file client_main.c.

Referenced by client_game_init().

## ◆ mapimg_client_tile_owner()

static struct player * mapimg_client_tile_owner | ( | const struct tile * | ptile,
|  | const struct player * | pplayer,
|  | bool | knowledge
| ) |  |

static

Helper function for the mapimg module - tile owner.

Definition at line 1565 of file client_main.c.

Referenced by client_game_init().

## ◆ mapimg_client_tile_terrain()

static struct terrain * mapimg_client_tile_terrain | ( | const struct tile * | ptile,
|  | const struct player * | pplayer,
|  | bool | knowledge
| ) |  |

static

Helper function for the mapimg module - tile terrain.

Definition at line 1556 of file client_main.c.

Referenced by client_game_init().

## ◆ mapimg_client_tile_unit()

static struct player * mapimg_client_tile_unit | ( | const struct tile * | ptile,
|  | const struct player * | pplayer,
|  | bool | knowledge
| ) |  |

static

Helper function for the mapimg module - unit owner.

Definition at line 1591 of file client_main.c.

Referenced by client_game_init().

## ◆ put_conv()

static char * put_conv | ( | const char * | src,
|  | size_t * | length
| ) |  |

static

Convert a text string from the internal to the data encoding, when it is written to the network.

Definition at line 171 of file client_main.c.

Referenced by charsets_init().

## ◆ real_timer_callback()

double real_timer_callback | ( | void |  | ) |

This function should be called at least once per second. It does various updates (idle animations and timeout updates). It returns the number of seconds until it should be called again.

Definition at line 1183 of file client_main.c.

Referenced by gui_event_loop(), timer_callback(), and fc_client::timerEvent().

## ◆ send_attribute_block_request()

void send_attribute_block_request | ( | void |  | ) |

Send attribute block.

Definition at line 1069 of file client_main.c.

## ◆ send_report_request()

void send_report_request | ( | enum report_type | type | ) |

Send request for some report to server

Definition at line 839 of file client_main.c.

Referenced by main_key_down_handler(), report_achievements_callback(), report_achievements_callback(), report_demographic_callback(), report_demographic_callback(), report_top_cities_callback(), report_top_cities_callback(), report_wow_callback(), report_wow_callback(), mr_menu::slot_achievements(), mr_menu::slot_demographics(), mr_menu::slot_top_five(), and mr_menu::slot_traveler().

## ◆ send_turn_done()

void send_turn_done | ( | void |  | ) |

Send information about player having finished their turn to server.

Definition at line 809 of file client_main.c.

Referenced by key_end_turn(), update_turn_done_button_state(), and user_ended_turn().

## ◆ set_client_state()

void set_client_state | ( | enum client_states | newstate | ) |

Change client state.

Definition at line 847 of file client_main.c.

Referenced by activate_gui(), close_socket_nomessage(), fc_client::fc_main(), handle_conn_info(), handle_endgame_report(), handle_server_join_reply(), handle_start_phase(), ui_main(), and ui_main().

## ◆ set_seconds_to_turndone()

void set_seconds_to_turndone | ( | double | seconds | ) |

Reset the number of seconds to turndone from an "authentic" source.

The seconds are taken as a double even though most callers will just know an integer value.

Definition at line 1113 of file client_main.c.

Referenced by handle_new_year(), and handle_timeout_info().

## ◆ set_server_busy()

void set_server_busy | ( | bool | busy | ) |

Sets if server is considered busy. Currently it is considered busy between turns.

Definition at line 1324 of file client_main.c.

Referenced by handle_end_turn(), handle_server_join_reply(), handle_start_phase(), and set_client_state().

## ◆ start_quitting()

void start_quitting | ( | void |  | ) |

Mark client as one going to quit as soon as possible,

Definition at line 1645 of file client_main.c.

Referenced by gui_ui_main(), popup_quit_dialog(), quit_dialog_response(), and ui_main().

## ◆ start_turn_change_wait()

void start_turn_change_wait | ( | void |  | ) |

Start waiting of the server turn change activities.

Definition at line 1137 of file client_main.c.

Referenced by handle_end_turn().

## ◆ stop_turn_change_wait()

void stop_turn_change_wait | ( | void |  | ) |

Server is responsive again

Definition at line 1149 of file client_main.c.

Referenced by disconnect_from_server(), and handle_begin_turn().

## ◆ title_for_player()

const char * title_for_player | ( | const struct player * | pplayer,
|  | char * | buf,
|  | size_t | buf_len
| ) |  |

Fill best possible title for the player to the given buffer, and return that buffer.

Definition at line 1297 of file client_main.c.

Referenced by plr_widget::nation_selected().

## ◆ user_ended_turn()

void user_ended_turn | ( | void |  | ) |

Handle user ending their turn.

Definition at line 801 of file client_main.c.

Referenced by end_turn_callback(), handle_player_info(), and handle_start_phase().

## ◆ wait_till_request_got_processed()

void wait_till_request_got_processed | ( | int | request_id | ) |

Wait until server has responsed to given request id.

Definition at line 1077 of file client_main.c.

Referenced by wait_for_requests().

## Variable Documentation

## ◆ announce

enum announce_type announce

Definition at line 147 of file client_main.c.

Referenced by addr_family_for_announce_type(), begin_lanserver_scan(), client_main(), and remove_trade_route().

## ◆ auto_connect

bool auto_connect = FALSE

Definition at line 145 of file client_main.c.

Referenced by client_main(), handle_server_join_reply(), and set_client_state().

## ◆ auto_spawn

bool auto_spawn = FALSE

Definition at line 146 of file client_main.c.

Referenced by client_main(), and set_client_state().

## ◆ between_turns

struct timer* between_turns = NULL

static

Definition at line 1099 of file client_main.c.

Referenced by real_timer_callback(), and start_turn_change_wait().

## ◆ civclient_state

enum client_states civclient_state = C_S_INITIAL

static

Definition at line 151 of file client_main.c.

Referenced by client_state(), and set_client_state().

## ◆ client

struct civclient client

Definition at line 149 of file client_main.c.

Referenced by accept_treaty_callback(), action_decision_clear_want(), action_decision_handle(), activate_all_units(), trade_generator::add_all_cities(), add_net_input(), adjust_workers_button_pressed(), adv_unit_sentry_idle_callback(), diplo_wdg::all_advances(), append_cma_to_menu_item(), apply_result_on_server(), apply_taxrates_callback(), ask_server_for_actions(), attribute_flush(), back_callback(), mr_menu::back_to_menu(), blink_turn_done_button(), button_press_callback(), button_up_on_map(), buy_production_in_selected_cities(), call_meeting_dlg_callback(), can_client_change_view(), can_client_control(), can_end_turn(), can_intel_with_player(), can_meet_with_player(), cancel_meeting_callback(), cancel_pact_dlg_callback(), center_on_something(), change_research_callback(), change_research_goal_callback(), check_city(), cities_callback(), city_buy_production(), city_can_buy(), city_change_production(), city_change_specialist(), city_clear_worklist_callback(), city_clear_worklist_callback(), city_dialog_update_present_units(), city_dialog_update_prev_next(), city_dialog_update_supported_units(), city_dlg_callback(), city_packet_common(), city_rename(), city_sell_improvement(), city_set_worklist(), city_toggle_worker(), cityopt_callback(), client_change_all(), client_game_free(), client_game_init(), client_government_sprite(), client_has_player(), client_is_global_observer(), client_is_observer(), client_kill_server(), client_packet_input(), client_player_maps_reset(), client_player_number(), client_remove_cli_conn(), client_research_sprite(), client_start_server(), client_start_server_and_set_page(), client_tile_get_known(), clipboard_copy_production(), clipboard_paste_production(), clipboard_send_production_packet(), cma_put_city_under_agent(), cmp_love(), col_diplstate(), col_embassy(), col_love(), col_vision(), collect_buildable_targets(), collect_currently_building_targets(), common_taxrates_callback(), confirm_cancel_pact(), conn_menu_ready_chosen(), conn_menu_ready_chosen(), connect_callback(), city_map::context_menu(), control_mouse_cursor(), create_conn_menu(), create_governor_menu(), units_select::create_pixmap(), create_present_supported_units_widget_list(), create_races_dialog(), create_rates_dialog(), create_tech_info(), science_report::current_tech_changed(), diplo_wdg::dbl_click(), define_tiles_within_rectangle(), diplo_dialog_returnkey(), diplomacy_dialog_add_pact_clause(), diplomacy_dialog_add_pact_clause(), diplomacy_dialog_city_callback(), diplomacy_dialog_city_callback(), diplomacy_dialog_embassy_callback(), diplomacy_dialog_embassy_callback(), diplomacy_dialog_map_callback(), diplomacy_dialog_map_callback(), diplomacy_dialog_seamap_callback(), diplomacy_dialog_seamap_callback(), diplomacy_dialog_tech_callback(), diplomacy_dialog_tech_callback(), diplomacy_dialog_vision_callback(), diplomacy_dialog_vision_callback(), diplomacy_main_response(), diplomacy_response(), diplstate_value(), disband_all_units(), city_dialog::disband_state_changed(), disconnect_from_server(), do_disband_alternative(), do_map_click(), do_move_unit(), do_unit_act_sel_vs(), do_unit_paradrop_to(), do_unit_patrol_to(), economy_report_dialog_popup(), edit_buffer_paste(), editor_apply_tool(), editor_apply_tool_to_selection(), editor_is_active(), editor_notify_edit_finished(), embassy_callback(), enable_city_dlg_widgets(), fc_double_edge::fc_double_edge(), fill_grid_sprite_array(), find_best_focus_candidate(), find_city_or_settler_near_tile(), find_diplomacy_dialog(), find_visible_unit(), found_city(), found_city_callback(), found_city_callback(), city_widget::gen_production_labels(), get_act_sel_action_custom_text(), get_bulb_tooltip(), get_city_mapview_name_and_growth(), get_diplomacy_dialog(), get_economy_report_data(), get_economy_report_units_data(), get_government_tooltip(), get_info_label_text(), get_info_label_text_popup(), get_tile_output_text(), get_tooltip(), get_tooltip_improvement(), get_tooltip_unit(), get_turn_done_button_state(), get_units_report_data(), get_units_upgrade_info(), diplo_wdg::give_advance(), diplo_wdg::give_city(), diplo_wdg::give_embassy(), diplo_wdg::give_shared_vision(), global_worklist_alloc(), global_worklist_destroy(), global_worklists_free(), global_worklists_init(), science_report::goal_tech_changed(), gold_callback(), diplo_wdg::gold_changed1(), diplo_wdg::gold_changed2(), fc_client::handle_authentication_req(), handle_authentication_req(), handle_city_info(), handle_city_name_suggestion_info(), handle_city_nationalities(), handle_city_rally_point(), handle_city_remove(), handle_city_sabotage_list(), handle_city_short_info(), handle_conn_info(), handle_conn_ping(), handle_diplomacy_init_meeting(), handle_event(), handle_investigate_started(), handle_new_year(), handle_player_diplstate(), handle_player_info(), handle_player_remove(), handle_processing_finished(), handle_processing_started(), handle_ruleset_control(), handle_server_join_reply(), handle_start_phase(), handle_tile_info(), handle_trade_route_info(), handle_unit_action_answer(), handle_unit_actions(), handle_unit_combat_info(), handle_unit_packet_common(), handle_unit_remove(), handle_unit_short_info(), handle_worker_task(), has_player_unit_type(), have_diplomat_info_about(), help_update_extra(), help_update_goods(), help_update_government(), help_update_improvement(), help_update_specialist(), help_update_tech(), help_update_terrain(), help_update_unit_type(), help_update_wonder(), horiz_taxrate_callback(), infra_placement_set_tile(), infra_selected_callback(), diplo_dlg::init(), input_from_server(), input_from_server_till_request_got_processed(), is_outstanding_request(), key_editor_recalculate_borders(), key_editor_toggle(), key_editor_toggle_fogofwar(), key_unit_action_select(), key_unit_assign_battlegroup(), key_unit_select_battlegroup(), ss_report::launch(), launch_spaceship_callback(), leave_local_game_response(), main_callback(), main_key_down_handler(), make_connection(), mapimg_client_define(), maps_callback(), menu_item_callback(), menu_item_callback(), meswin_dialog_update(), meswin_popup_city(), misc_panel_city_dlg_callback(), research_diagram::mouseMoveEvent(), research_diagram::mousePressEvent(), multiairlift(), multipliers_command_callback(), races_dialog::nation_selected(), nationset_changed(), city_dialog::next_city(), next_prev_city_dlg_callback(), notify_about_incoming_packet(), notify_about_outgoing_packet(), notify_goto::notify_goto(), num_present_units_in_city(), num_supported_units_in_city(), objbind_request_destroy_object(), races_dialog::ok_pressed(), ok_sell_impr_callback(), ok_upgrade_unit_window_callback(), option_dialog_new(), overview_tile_color(), diplo_wdg::pact_allianze(), pact_callback(), diplo_wdg::pact_ceasfire(), diplo_wdg::pact_peace(), paste_tile(), player_clear(), players_meet_callback(), players_meet_callback(), popup_advanced_terrain_dialog(), popup_airlift_dialog(), popup_conn_list_dialog(), popup_diplomacy_dialog(), popup_diplomacy_dialog(), popup_goto_airlift_dialog(), popup_goto_dialog(), popup_government_dialog(), popup_impr_info(), popup_info_text(), popup_notify_goto_dialog(), popup_players_nations_dialog(), popup_quit_dialog(), popup_rates_dialog(), popup_revolution_dialog(), popup_revolution_dialog(), popup_sabotage_dialog(), popup_sell_impr_callback(), popup_unit_info(), popup_upgrade_unit_callback(), popup_worklist_editor(), present_unit_callback(), city_dialog::prev_city(), property_page_create_objects(), property_page_destroy_objects(), property_page_send_packet(), property_page_send_values(), qtg_real_output_window_append(), quickselect(), quit_dialog_response(), races_dialog::races_dialog(), races_dialog_ok_callback(), races_response(), races_update_pickable(), races_dialog::random_pressed(), rates_command_callback(), rates_set_values(), ready_button_callback(), real_activeunits_report_dialog_update(), real_city_dialog_popup(), real_city_dialog_refresh(), real_city_report_dialog_update(), real_conn_list_dialog_update(), real_economy_report_dialog_update(), real_info_city_report_dialog_update(), real_menus_init(), real_menus_update(), real_timer_callback(), real_units_report_dialog_update(), rebuild_imprm_list(), redraw_army_city_dialog(), redraw_supported_units_city_dialog(), redraw_unit_info_label(), refresh_spaceship_dialog(), refresh_worklist(), remove_clause_callback(), report_spaceship_callback(), report_spaceship_callback(), plr_report::req_caancel_threaty(), plr_report::req_meeeting(), plr_report::req_wiithdrw_vision(), request_action_details(), request_do_action(), request_move_unit_direction(), request_new_unit_activity_targeted(), request_orders_cleared(), request_unit_build_city(), request_unit_load(), request_unit_non_action_move(), request_unit_ssa_set(), request_unit_unload(), request_unit_unload_all(), diplo_wdg::response_accept(), diplo_wdg::response_cancel(), right_button_press_callback(), row_callback(), save_dialog_save_scenario(), science_diagram_button_release_callback(), science_diagram_data(), science_diagram_left_button_up(), science_dialog_text(), science_report_current_callback(), science_report_goal_callback(), score_tooltip(), diplo_wdg::sea_map_clause(), select_impr_or_unit_callback(), select_impr_or_unit_callback(), select_nation_callback(), select_unit_image_callback(), sell_all_improvements(), sell_callback(), send_attribute_block_request(), send_chat(), send_chat_printf(), send_client_wants_hack(), send_connect_route(), send_passwd_callback(), send_path_orders(), send_rally_path_orders(), send_report_request(), send_turn_done(), set_city_workertask(), set_client_state(), set_government_choice(), set_indicator_icons(), help_widget::set_topic_building(), help_widget::set_topic_extra(), help_widget::set_topic_goods(), help_widget::set_topic_government(), help_widget::set_topic_specialist(), help_widget::set_topic_tech(), help_widget::set_topic_terrain(), help_widget::set_topic_unit(), set_wait_for_writable_socket(), show_full_citybar(), show_new_turn_info(), side_right_click_diplomacy(), tax_rates_dialog::slot_apply_button_pressed(), fc_client::slot_connect(), fc_client::slot_disconnect(), tax_rates_dialog::slot_ok_button_pressed(), multipler_rates_dialog::slot_ok_button_pressed(), fc_client::slot_pregame_start(), mr_menu::slot_spaceship(), fc_sidewidget::some_slot(), spaceship_autoplace(), spaceship_response(), spy_steal_popup_shared(), src_selection_callback(), fc_client::start_page_menu(), start_revolution(), start_style_music(), switch_city_callback(), fc_client::switch_page(), choice_dialog::switch_target(), target_drag_data_received(), target_drag_data_received(), tax_rates_dialog::tax_rates_dialog(), techs_callback(), tgt_extra_change_callback(), tgt_unit_change_callback(), tilespec_reread_callback(), toggle_tile_hilite(), try_to_connect(), unit_focus_add(), unit_focus_advance(), unit_focus_remove(), unit_focus_set(), unit_focus_update(), unit_select_dialog_popup(), units_orders_city_dlg_callback(), units_report_command_callback(), unpackage_short_unit(), unpackage_unit(), gov_menu::update(), mr_menu::update_airlift_menu(), fc_client::update_buttons(), city_dialog::update_buy_button(), update_clauses_list(), city_dialog::update_disabled(), fc_sidewidget::update_final_pixmap(), fc_client::update_info_label(), update_info_label(), update_infra_dialog(), update_players_menu(), city_dialog::update_prod_buttons(), ss_report::update_report(), plr_report::update_report(), fc_client::update_sidebar_tooltips(), city_dialog::update_units(), upgrade_canvas_clipboard(), unittype_item::upgrade_units(), vision_callback(), voteinfo_do_vote(), wait_till_request_got_processed(), wakeup_sentried_units(), withdraw_vision_dlg_callback(), and diplo_wdg::world_map_clause().

## ◆ client_quitting

bool client_quitting = FALSE

static

Definition at line 165 of file client_main.c.

Referenced by is_client_quitting(), and start_quitting().

## ◆ fc_password

char fc_password[MAX_LEN_PASSWORD] = "\0"

Definition at line 142 of file client_main.c.

Referenced by cancel_passwd_callback(), connect_callback(), convert_first_passwd_callback(), convert_passwd_callback(), convert_second_passwd_callback(), fc_client::handle_authentication_req(), handle_authentication_req(), send_passwd_callback(), and fc_client::slot_connect().

## ◆ forced_tileset_name

char forced_tileset_name[512] = "\0"

Definition at line 136 of file client_main.c.

Referenced by client_main(), default_tileset_select(), handle_set_topology(), popup_tileset_suggestion_dialog(), tileset_suggestion_callback(), and tileset_suggestion_response().

## ◆ logfile

char* logfile = NULL

Definition at line 133 of file client_main.c.

Referenced by client_main(), and client_start_server().

## ◆ metaserver

char metaserver[512] = "\0"

Definition at line 143 of file client_main.c.

Referenced by client_main().

## ◆ music_set_name

char music_set_name[512] = "\0"

Definition at line 139 of file client_main.c.

Referenced by audio_restart(), client_main(), handle_ruleset_control(), popup_musicset_suggestion_dialog(), popup_soundset_suggestion_dialog(), soundset_suggestion_callback(), and soundset_suggestion_response().

## ◆ savefile

char* savefile = NULL

Definition at line 135 of file client_main.c.

Referenced by client_main(), and client_start_server().

## ◆ scriptfile

char* scriptfile = NULL

Definition at line 134 of file client_main.c.

Referenced by client_main(), and client_start_server().

## ◆ seconds_shown_to_new_turn

int seconds_shown_to_new_turn

static

Definition at line 1105 of file client_main.c.

Referenced by get_seconds_to_new_turn(), real_timer_callback(), and start_turn_change_wait().

## ◆ seconds_shown_to_turndone

int seconds_shown_to_turndone

static

Definition at line 1104 of file client_main.c.

Referenced by get_seconds_to_turndone(), real_timer_callback(), and set_seconds_to_turndone().

## ◆ seconds_to_turndone

double seconds_to_turndone = 0.0

static

Definition at line 1094 of file client_main.c.

Referenced by real_timer_callback(), and set_seconds_to_turndone().

## ◆ server_busy

bool server_busy = FALSE

static

Definition at line 159 of file client_main.c.

Referenced by is_server_busy(), and set_server_busy().

## ◆ server_host

char server_host[512] = "\0"

Definition at line 140 of file client_main.c.

Referenced by client_main(), connect_callback(), connect_callback(), convert_servername_callback(), popup_join_game_dialog(), select_meta_servers_callback(), fc_client::slot_connect(), start_autoconnecting_to_server(), fc_client::switch_page(), try_to_autoconnect(), and update_network_page().

## ◆ server_port

int server_port = -1

Definition at line 144 of file client_main.c.

Referenced by client_main(), connect_callback(), connect_callback(), convert_portnr_callback(), popup_join_game_dialog(), select_meta_servers_callback(), fc_client::slot_connect(), start_autoconnecting_to_server(), fc_client::switch_page(), try_to_autoconnect(), and update_network_page().

## ◆ sound_plugin_name

char sound_plugin_name[512] = "\0"

Definition at line 137 of file client_main.c.

Referenced by audio_restart(), and client_main().

## ◆ sound_set_name

char sound_set_name[512] = "\0"

Definition at line 138 of file client_main.c.

Referenced by audio_restart(), client_main(), handle_ruleset_control(), musicset_suggestion_callback(), musicset_suggestion_response(), musicspec_reread_callback(), popup_musicset_suggestion_dialog(), and popup_soundset_suggestion_dialog().

## ◆ turndone_timer

struct timer* turndone_timer

static

Definition at line 1095 of file client_main.c.

Referenced by real_timer_callback(), and set_seconds_to_turndone().

## ◆ user_name

char user_name[512] = "\0"

Definition at line 141 of file client_main.c.

Referenced by client_main(), client_start_server(), conn_by_user(), conn_by_user_prefix(), connect_callback(), connect_callback(), convert_playername_callback(), popup_join_game_dialog(), fc_client::slot_connect(), start_autoconnecting_to_server(), fc_client::switch_page(), try_to_autoconnect(), and update_network_page().

## ◆ waiting_for_end_turn

bool waiting_for_end_turn = FALSE

Definition at line 154 of file client_main.c.

Referenced by send_turn_done(), and update_turn_done_button_state().

## ◆ waiting_turn_change

bool waiting_turn_change = FALSE

static

Definition at line 1100 of file client_main.c.

Referenced by is_waiting_turn_change(), real_timer_callback(), start_turn_change_wait(), and stop_turn_change_wait().