void client_init (client_t *client) { prctl (PR_SET_TIMERSLACK, 1); initializing_client = true; buffer_create (&client->buffer, 1024, "command"); // We initialize the base dispatch table synchronously here, so that we // don't have to worry about the server thread trying to initialize it // at the same time. dispatch_table_get_base (); client_fill_dispatch_table (&client->dispatch); client->token = 0; sem_init (&client->server_signal, 0, 0); sem_init (&client->client_signal, 0, 0); client->active_state = NULL; client_start_server (client); initializing_client = false; }
/************************************************************************** ... **************************************************************************/ static int start_new_game_callback(struct widget *pWidget) { if (Main.event.button.button == SDL_BUTTON_LEFT) { popdown_start_menu(); if (is_server_running() || client_start_server()) { /* saved settings are sent in client/options.c load_settable_options() */ } } return -1; }
/************************************************************************** Sets the "page" that the client should show. See documentation in pages_g.h. **************************************************************************/ void real_set_client_page(enum client_pages page) { switch (old_page) { case PAGE_MAIN: popdown_start_menu(); break; case PAGE_LOAD: popdown_load_game_dialog(); break; case PAGE_NETWORK: close_connection_dialog(); break; case PAGE_START: popdown_conn_list_dialog(); break; case PAGE_GAME: close_game_page(); break; default: break; } switch (page) { case PAGE_MAIN: show_main_page(); break; case PAGE_LOAD: client_start_server(); break; case PAGE_NETWORK: popup_join_game_dialog(); break; case PAGE_START: conn_list_dialog_update(); break; case PAGE_GAME: show_game_page(); enable_main_widgets(); update_info_label(); unit_focus_update(); update_unit_info_label(get_units_in_focus()); update_turn_done_button_state(); refresh_overview(); menus_update(); break; default: break; } old_page = page; }
static PyObject* python_client_start_server(PyObject* self, PyObject* args) { if(PyArg_ParseTuple(args, "") == 0) return NULL; bool retval = client_start_server(); return Py_BuildValue("i", (int)retval); }