int server_create_session (void) { int connection_created; connection_data_type *comms_connection; comms_connection = direct_play_get_connection_data (); if ( ( comms_connection ) && ( comms_connection->is_initialised ) ) { if ( !comms_connection->one_way_hosting_setup ) { direct_play_close_session (); connection_created = FALSE; if ( direct_play_create_session (get_game_type ()) ) { if ( direct_play_session_capabilities () ) { // Jabberwock 050303 Remove DP groups // if ( direct_play_create_group () ) { if ( direct_play_create_player () ) { set_server_id (direct_play_get_player_id ()); connection_created = TRUE; } } } } if ( !connection_created ) { comms_connection->is_initialised = FALSE; } } else { direct_play_set_session_type_and_name ( get_game_type () ); } } return ( TRUE ); }
void set_serial_connection_status ( void ) { char text_buffer [256]; connection_data_type *this_connection; this_connection = direct_play_get_connection_data (); #ifdef _WIN32 if ( ( this_connection ) && ( this_connection->service_provider.guid ) ) { if ( memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_SERIAL, sizeof ( GUID ) ) == TRUE ) { set_direct_play_serial_address ( get_global_comms_port (), get_global_baud_rate (), get_global_stop_bits (), get_global_parity (), get_global_flow () ); if ( direct_play_create_session ( 0 ) ) { sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_CONNECTED")); set_ui_object_text (serial_status_text, text_buffer); direct_play_close_session (); this_connection->is_initialised = TRUE; } else { sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_INVALID_PROPERTIES")); set_ui_object_text (serial_status_text, text_buffer); this_connection->is_initialised = FALSE; } } } #elif defined __unix__ if ( ( this_connection ) && ( this_connection->service_provider.guid ) ) { if (1)//ö memncmp ( ( char * ) this_connection->service_provider.guid, ( char * ) &DPSPGUID_SERIAL, sizeof ( GUID ) ) == TRUE ) { set_direct_play_serial_address ( get_global_comms_port (), get_global_baud_rate (), get_global_stop_bits (), get_global_parity (), get_global_flow () ); if ( direct_play_create_session ( 0 ) ) { sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_CONNECTED")); set_ui_object_text (serial_status_text, text_buffer); direct_play_close_session (); this_connection->is_initialised = TRUE; } else { sprintf (text_buffer, "%s: %s", get_trans ("MP_STATUS"), get_trans ("MP_INVALID_PROPERTIES")); set_ui_object_text (serial_status_text, text_buffer); this_connection->is_initialised = FALSE; } } } }