Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions | Variables
client_main.h File Reference
#include "fc_types.h"
#include "packets.h"
#include "worklist.h"

Go to the source code of this file.

Data Structures

struct  civclient
 

Macros

#define TIMER_INTERVAL   (int)(real_timer_callback() * 1000)
 
#define client_player()   client.conn.playing
 

Enumerations

enum  client_states {
  C_S_INITIAL , C_S_DISCONNECTED , C_S_PREPARING , C_S_RUNNING ,
  C_S_OVER
}
 

Functions

int client_main (int argc, char *argv[], bool postpone_tileset)
 
int default_tileset_select (void)
 
void client_packet_input (void *packet, int type)
 
void send_report_request (enum report_type type)
 
void send_attribute_block_request (void)
 
void send_turn_done (void)
 
void user_ended_turn (void)
 
void set_client_state (enum client_states newstate)
 
enum client_states client_state (void)
 
void set_server_busy (bool busy)
 
bool is_server_busy (void)
 
void client_remove_cli_conn (struct connection *pconn)
 
void client_remove_all_cli_conn (void)
 
void wait_till_request_got_processed (int request_id)
 
bool client_is_observer (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)
 
void set_seconds_to_turndone (double seconds)
 
int get_seconds_to_turndone (void)
 
bool is_waiting_turn_change (void)
 
void start_turn_change_wait (void)
 
void stop_turn_change_wait (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_client_change_view (void)
 
bool can_meet_with_player (const struct player *pplayer)
 
bool can_intel_with_player (const struct player *pplayer)
 
const chartitle_for_player (const struct player *pplayer, char *buf, size_t buf_len)
 
void fc__noreturn client_exit (int return_value)
 
bool is_client_quitting (void)
 
void start_quitting (void)
 

Variables

charlogfile
 
charscriptfile
 
charsavefile
 
char sound_plugin_name [512]
 
char sound_set_name [512]
 
char music_set_name [512]
 
char server_host [512]
 
char user_name [512]
 
char fc_password [MAX_LEN_PASSWORD]
 
char metaserver [512]
 
int server_port
 
bool auto_connect
 
bool auto_spawn
 
bool waiting_for_end_turn
 
struct civclient client
 
const char *const gui_character_encoding
 
const bool gui_use_transliteration
 

Macro Definition Documentation

◆ client_player

#define client_player ( )    client.conn.playing

Definition at line 106 of file client_main.h.

◆ TIMER_INTERVAL

#define TIMER_INTERVAL   (int)(real_timer_callback() * 1000)

Definition at line 30 of file client_main.h.

Enumeration Type Documentation

◆ client_states

Enumerator
C_S_INITIAL 
C_S_DISCONNECTED 
C_S_PREPARING 
C_S_RUNNING 
C_S_OVER 

Definition at line 43 of file client_main.h.

Function Documentation

◆ 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_paths(), request_toggle_pollution(), request_toggle_resources(), 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  )

◆ 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(), client_init_meeting(), 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(), gui_init_meeting(), handle_city_name_suggestion_info(), handle_city_sabotage_list(), 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_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)

◆ client_exit()

void fc__noreturn client_exit ( int  return_value)

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

Definition at line 724 of file client_main.c.

Referenced by client_main(), and default_tileset_select().

◆ client_has_player()

bool client_has_player ( void  )

◆ client_is_global_observer()

bool client_is_global_observer ( void  )

◆ client_is_observer()

bool client_is_observer ( void  )

◆ client_main()

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

Entry point for common client code.

Definition at line 351 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 774 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.

◆ 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 1053 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 1035 of file client_main.c.

Referenced by client_remove_all_cli_conn(), and handle_conn_info().

◆ client_state()

enum client_states client_state ( void  )

◆ default_tileset_select()

int default_tileset_select ( void  )

Do the initial default tileset selection.

Definition at line 323 of file client_main.c.

Referenced by client_main(), and qtg_ui_main().

◆ 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 1128 of file client_main.c.

Referenced by get_timeout_label_text(), and real_menus_update().

◆ 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(), 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 1067 of file client_main.c.

◆ send_report_request()

void send_report_request ( enum report_type  type)

◆ send_turn_done()

void send_turn_done ( void  )

Send information about player having finished their turn to server.

Definition at line 806 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)

◆ 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 1111 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 1136 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 create_diplomacy_dialog(), diplo_wdg::diplo_wdg(), and plr_widget::nation_selected().

◆ user_ended_turn()

void user_ended_turn ( void  )

Handle user ending their turn.

Definition at line 798 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 1075 of file client_main.c.

Referenced by wait_for_requests().

Variable Documentation

◆ auto_connect

bool auto_connect
extern

Definition at line 146 of file client_main.c.

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

◆ auto_spawn

bool auto_spawn
extern

Definition at line 147 of file client_main.c.

Referenced by client_main(), and set_client_state().

◆ client

struct civclient client

◆ fc_password

char fc_password[MAX_LEN_PASSWORD]
extern

◆ gui_character_encoding

const char* const gui_character_encoding
extern

Definition at line 161 of file gui_main.c.

Referenced by client_main().

◆ gui_use_transliteration

const bool gui_use_transliteration
extern

Definition at line 162 of file gui_main.c.

Referenced by client_main().

◆ logfile

char* logfile
extern

Definition at line 134 of file client_main.c.

Referenced by client_main(), and client_start_server().

◆ metaserver

char metaserver[512]
extern

Definition at line 144 of file client_main.c.

Referenced by client_main().

◆ music_set_name

char music_set_name[512]
extern

◆ savefile

char* savefile
extern

Definition at line 136 of file client_main.c.

Referenced by client_main(), and client_start_server().

◆ scriptfile

char* scriptfile
extern

Definition at line 135 of file client_main.c.

Referenced by client_main(), and client_start_server().

◆ server_host

char server_host[512]
extern

◆ server_port

int server_port
extern

◆ sound_plugin_name

char sound_plugin_name[512]
extern

Definition at line 138 of file client_main.c.

Referenced by audio_restart(), and client_main().

◆ sound_set_name

char sound_set_name[512]
extern

◆ user_name

char user_name[512]
extern

◆ waiting_for_end_turn

bool waiting_for_end_turn
extern

Definition at line 155 of file client_main.c.

Referenced by send_turn_done(), and update_turn_done_button_state().