/*
	Asteroids
    Copyright (C) 2006  Darragh Coy.

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/*##############################################################################

Header name: Saves.hpp

##############################################################################*/

#ifndef SAVES_HPP
#define SAVES_HPP

   /****************************************************************************
   Defines
   ****************************************************************************/
      
      // File identifiers for save and hi-score files: nothing significant
      // about the meaning of these numbers: just made up!
      
      #define SAVE_FILE_ID   0xdc
      #define USER_FILE_ID   0x2f
      #define SCORE_FILE_ID  0xcd
      
      // Directory for user save games
      
      #define SAVE_DATA_DIR    "save\\"
      
      // Directory for user data
      
      #define USER_DATA_DIR    "user\\"      
      
      // Name and directory of high score file
      
      #define SCORE_FILE_NAME  "data\\game.dat"
      #define SCORE_FILE_DIR   "data\\"      

   /****************************************************************************
   Includes
   ****************************************************************************/

      #include <fstream>        // IO Functions
      #include <io.h>           // C IO Functions: mkdir especially
      #include <stdlib.h>       // memcpy
      #include "GLWin.h"        // Error messages
      #include "Game.h"         // Game data
      
      using namespace std;
      
   /****************************************************************************
   Externs
   ****************************************************************************/   
   
      //..
      
   /****************************************************************************
   Structs and enums
   ****************************************************************************/
      
       // User data file structure
       
       struct UserFile_t
       {
          unsigned int file_id;                    // 8-bit file identifier
          unsigned int bestScore;                  // Actual score
       };                  
      
   /****************************************************************************
   Prototypes
   ****************************************************************************/   

      // Load user high score
      
      void Saves_LoadUser ( struct GameData_t * gamedata );
      
      // Save user high score
      
      void Saves_SaveUser ( struct GameData_t * gamedata );
      
      // Save game data
      
      void Saves_SaveGame ( struct GameData_t * gamedata );

      // Load game data
      
      void Saves_LoadGame ( struct GameData_t * gamedata );   
      
      // Save high score
      
      void Saves_SaveScore();
      
      // Load the high score  
      
      void Saves_LoadScore(); 
   
#endif
