void multiplayer_modem_dial_update_function ( void ) { char text_buffer [256]; int game_update_time; static int update_ticks = 0; game_update_time = TIME_1_SECOND; if ( update_ticks < get_system_time () ) { session_table_type *this_session; connection_data_type *this_connection; unsigned int connection_code; connection_code = direct_play_dial_modem_status (); if ( connection_code == DP_OK ) { // // Need to do the final enumeration // sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_FINDING_GAMES")); if ( direct_play_enumerate_sessions () ) { set_comms_model ( COMMS_MODEL_CLIENT ); this_session = direct_play_get_session_table (); if ( this_session ) { int baudrate; this_connection = direct_play_get_connection_data (); this_connection->this_session.session = this_session->session; sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_JOINING_GAMES")); direct_play_join_session (); direct_play_session_capabilities (); if (!direct_play_enumerate_groups ()) { debug_fatal ("SESSION: Client can't enumerate any groups - but connected someway"); } this_connection->this_group = direct_play_get_group_table (); direct_play_create_player (); direct_play_join_group (); baudrate = direct_play_get_connection_baudrate (); sprintf (text_buffer, "%s: %s %d", get_trans ("MP_STATUS"), get_trans ("MP_CONNECTED_AT"), baudrate * 100); set_ui_object_text (modem_status_text, text_buffer); // set_ui_object_drawable ( multi_player_back_button, UI_OBJECT_STATE_ON ); ghost_ui_objects_for_modem (NULL, FALSE); modem_state = MODEM_DIALLED_CONNECTED; ui_set_user_function ( multiplayer_modem_connection_update_function ); } } } else { if ( connection_code == DPERR_CONNECTING ) { sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_CONNECTING")); set_ui_object_text ( modem_status_text, text_buffer ); } else { sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_UNCONNECTED")); set_ui_object_text ( modem_status_text, text_buffer ); modem_state = MODEM_NOT_CONNECTED; // set_ui_object_drawable ( multi_player_back_button, UI_OBJECT_STATE_ON ); ghost_ui_objects_for_modem (NULL, FALSE); ui_set_user_function ( NULL ); } } update_ticks = get_system_time () + game_update_time; set_delta_time (); } }
void compile_multi_session_list (session_list_data_type **list) { #if !DEMO_VERSION int session_number = 0; session_table_type *this_session; connection_data_type *this_connection; char text [128]; this_connection = direct_play_get_connection_data (); if ( ( this_connection ) && ( this_connection->is_initialised ) ) { int number_of_sessions; int currentServer; // Jabberwock 040201 Session filter if (command_line_session_filter) { if ((strcmp(session_filter_value, "root") == 0) || (strcmp(session_filter_value, "-Multiplayer-") == 0)) { add_session ("-Multiplayer-", SESSION_LIST_TYPE_FILTER, 1, NULL, "-Multiplayer-", NULL, NULL, "-Multiplayer-", list, NULL, SESSION_SEASON_INVALID); } } if ( !this_connection->one_way_hosting_setup ) { number_of_sessions = direct_play_enumerate_sessions (); } else { validate_modem_connection (); if ( this_connection->is_initialised ) { number_of_sessions = direct_play_refresh_modem_session (); } } if ( number_of_sessions ) { this_session = direct_play_get_session_table (); while (this_session) { //if (this_session->session->dwUser1 == get_game_type ()) // Jabberwock 031118 MP - campaigns shows in skirmishes and vice versa { if ((!command_line_session_filter) || (strcmp ("-Multiplayer-", session_filter_value) == 0)) // Jabberwock 031210 Session filter { sprintf (text, "%s", this_session->session->lpszSessionNameA); session_number ++; add_session (text, SESSION_LIST_TYPE_JOIN, session_number, this_session, NULL, NULL, NULL, "-Multiplayer-", list, NULL, SESSION_SEASON_INVALID); // Jabberwock 031210 Session filter } } this_session = this_session->next_session; } } //Werewolf 14 May 2003 //Fetch active servers from masterserver net_getServerList(); for (currentServer=0; currentServer<numServers; currentServer++) { if ((!command_line_session_filter) || (strcmp ("-Multiplayer-", session_filter_value) == 0)) // Jabberwock 031210 Session filter { sprintf (text, "%s (%i/%i) %s", Servers[currentServer].Name, Servers[currentServer].CurClients, Servers[currentServer].MaxClients, Servers[currentServer].Version); session_number ++; add_session (text, SESSION_LIST_TYPE_MASTER, session_number, NULL, NULL, NULL, NULL, "-Multiplayer-", list, Servers[currentServer].Adress, SESSION_SEASON_INVALID); // Jabberwock 031210 Session filter } } } #endif }