//------- Begin of function GameFileArray::process_action ------// // // [int] saveNew - save on a new game file // (default : 0) // // return : <int> 1 - process ok // 0 - process cancelled // -1 - save/load failed // int GameFileArray::process_action(int saveNew) { //------------ save game --------------// if( action_mode == 1 ) { if( saveNew || browse_recno==0 ) // save on empty slot { if ( !save_new_game()) return -1; } else // save on existing slot { if( !box.ask( _("It will overwrite the existing saved game, proceed ?") ) ) return 0; GameFile* gameFile = game_file_array[browse_recno]; if( !gameFile->save_game()) return -1; strcpy( last_file_name, gameFile->file_name ); } return 1; } //----------- load game -------------// else { GameFile* gameFile = game_file_array[browse_recno]; int rc = gameFile->load_game((const char*)sys.dir_config, NULL); if( rc > 0 ) strcpy( last_file_name, gameFile->file_name ); return rc; } return 0; }
//------- Begin of function GameFileArray::process_action ------// // // [int] saveNew - save on a new game file // (default : 0) // // return : <int> 1 - process ok // 0 - process cancelled // -1 - save/load failed // int GameFileArray::process_action(int saveNew) { //------------ save game --------------// if( action_mode == 1 ) { if( saveNew || browse_recno==0 ) // save on empty slot { // #### begin Gilbert 20/1 ######// return save_new_game(NULL); // #### end Gilbert 20/1 ######// } else // save on existing slot { if( !box.ask(text_game_menu.str_ask_overwrite()) )// "It will overwrite the existing saved game, proceed ?" ) ) return 0; GameFile* gameFile = game_file_array[browse_recno]; // ###### begin Gilbert 20/1 ########// if( !gameFile->ask_desc() ) return 0; // ###### end Gilbert 20/1 ########// if( !gameFile->save_game(save_default_dir, NULL, NULL)) return -1; strcpy( last_file_name, gameFile->file_name ); } return 1; } //----------- load game -------------// else { GameFile* gameFile = game_file_array[browse_recno]; // check gameFile->campaign_id. Campaign save game can be loaded // if and only if in campaign mode if( !sys.debug_session && gameFile->scenario_cheat_flag < sys.scenario_cheat_flag ) { box.msg( text_game_menu.str_editor_cant_load() );// "Cannot load in scenario editor" ); return 0; } // ###### begin Gilbert 9/4 ########// if( !pre_game && (game.is_campaign_mode() || gameFile->campaign_id) ) { game.set_load_game_in_main_menu(gameFile->file_name); sys.signal_exit_flag = 2; // quit to main menu and it will load game automatically return 1; } // ###### end Gilbert 9/4 ########// int rc = gameFile->load_game(save_default_dir, NULL); if( rc > 0 ) strcpy( last_file_name, gameFile->file_name ); return rc; } return 0; }