void fs2netd_store_stats() { if ( !Logged_in ) { return; } ml_string("Sending stats to server"); // default to not saving the stats Multi_debrief_stats_accept_code = 0; if (Duplicate_login_detected) { Duplicate_login_detected = false; multi_display_chat_msg( XSTR("<Duplicate login detected - stats have been tossed>", 1582), 0, 0 ); ml_string( XSTR("<Duplicate login detected - stats have been tossed>", 1583) ); fs2netd_store_stats_results(); return; } if ( game_hacked_data() ) { multi_display_chat_msg( XSTR("<Hacked tables detected - stats have been tossed>", 1584), 0, 0 ); popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR("You are playing with a hacked tables, your stats will not be saved", 1585) ); fs2netd_store_stats_results(); return; } if ( (multi_num_players() <= 1) && (Multi_num_players_at_start <= 1) ) { multi_display_chat_msg(XSTR("<Not enough players were present at game start or end, stats will not be saved>", 1048), 0, 0); ml_string( XSTR("<Not enough players were present at game start or end, stats will not be saved>", 1048) ); fs2netd_store_stats_results(); return; } /* // if any players have hacked info for(int idx = 0; idx < MAX_PLAYERS; idx++) { if ( MULTI_CONNECTED(Net_players[idx]) && !MULTI_STANDALONE(Net_players[idx]) && (Net_players[idx].flags & NETINFO_FLAG_HAXOR) ) { multi_display_chat_msg( XSTR("<Connected player has hacked info - tossing invalid stats>", -1), 0, 0 ); return; } } */ if ( !fs2netd_check_mission(Netgame.mission_name) ) { multi_display_chat_msg(XSTR("<Server detected a non PXO validated mission. Stats will not be saved>", 1049), 0, 0); popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR("This is not a PXO validated mission, your stats will not be saved", 1050)); fs2netd_store_stats_results(); return; } int spd_ret = fs2netd_send_player(); switch (spd_ret) { // 0 = pilot updated, 1 = invalid pilot, 2 = invalid (expired?) sid case -1: ml_string("<stats have been tossed - server error>"); break; case 0: ml_string( XSTR("<stats have been accepted>", 850) ); Multi_debrief_stats_accept_code = 1; break; case 1: ml_string("<stats have been tossed - pilot error>"); break; case 2: // we should never get here with the new code Int3(); ml_string("<stats have been tossed - invalid tracker id>"); break; default: multi_display_chat_msg( XSTR("Unknown Stats Store Request Reply", 1586), 0, 0 ); break; } fs2netd_store_stats_results(); }
void fs2netd_debrief_init() { if ( !(Game_mode & GM_MULTIPLAYER) ) { return; } if ( !Om_tracker_flag ) { return; } if ( !Is_connected ) { return; } uint CurrentMissionChsum; bool mValidStatus = false; cf_chksum_long(Netgame.mission_name, &CurrentMissionChsum); mValidStatus = FS2NetD_CheckSingleMission(Netgame.mission_name, CurrentMissionChsum); if ( ((multi_num_players() > 1) || (Multi_num_players_at_start > 1)) && !game_hacked_data() && mValidStatus ) { // verify that we are logged in before doing anything else fs2netd_login(); int spd_ret = FS2NetD_SendPlayerData(PXO_SID, Players[Player_num].callsign, Multi_tracker_login, &Players[Player_num]); switch (spd_ret) { // 0 = pilot updated, 1 = invalid pilot, 2 = invalid (expired?) sid case -1: multi_display_chat_msg( XSTR("<Did not receive response from server within timeout period>", -1), 0, 0 ); multi_display_chat_msg( XSTR("<Your stats may not have been stored>", -1), 0, 0 ); multi_display_chat_msg( XSTR("<This is not a critical error>", -1), 0, 0 ); Multi_debrief_stats_accept_code = 1; break; case 0: multi_display_chat_msg( XSTR("<stats have been accepted>", 850), 0, 0 ); Multi_debrief_stats_accept_code = 1; break; case 1: multi_display_chat_msg( XSTR("<stats have been tossed>", 850), 0, 0 ); multi_display_chat_msg( XSTR("WARNING: Your pilot was invalid, this is a serious error, possible data corruption", -1), 0, 0 ); Multi_debrief_stats_accept_code = 0; break; case 2: // we really shouldn't be here with the new code, but handle it just in case Int3(); fs2netd_login(); if (PXO_SID != -1) { if ( !FS2NetD_SendPlayerData(PXO_SID, Players[Player_num].callsign, Multi_tracker_login, &Players[Player_num]) ) { multi_display_chat_msg( XSTR("<stats have been accepted>", 850), 0, 0 ); Multi_debrief_stats_accept_code = 1; break; } } multi_display_chat_msg( XSTR("<stats have been tossed>", 851), 0, 0 ); Multi_debrief_stats_accept_code = 0; break; default: multi_display_chat_msg( XSTR("Unknown Stats Store Request Reply", -1), 0, 0 ); break; } } else { multi_display_chat_msg( XSTR("<stats have been tossed>", 851), 0, 0 ); Multi_debrief_stats_accept_code = 0; } }