Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

Ogfile.h Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

Ogfile.h

Go to the documentation of this file.
00001 //Filename    : OGFILE.H
00002 //Description : Oject Game file, save and restore game
00003 //
00004 
00005 #ifndef __OGFILE_H
00006 #define __OGFILE_H
00007 
00008 #include <OFILE.H>
00009 #include <ODYNARR.H>
00010 #include <OPSCHOOL.H>
00011 
00012 #define MIN_FREE_SPACE 1000
00013 
00014 //-------- Define struct HallFame ----------//
00015 
00016 enum {                                            // No. of Hall of Fame entries
00017     HALL_FAME_NUM = 5
00018 };
00019 
00022 struct HallFame {                                 // Hall of Fame
00023     char school_name[PlayerSchool::SCHOOL_NAME_LEN+1];
00024     char  player_first_name[PlayerSchool::FIRST_NAME_LEN+1];
00025     char  player_last_name[PlayerSchool::LAST_NAME_LEN+1];
00026 
00027     int   score;                                    // it's the sorting key of hall_fame_array
00028     int   trust_score;
00029 
00030     short start_year;
00031     short end_year;
00032     short scenario_id;                              // 0: invalid
00033 
00034     //short difficulty_rating;
00035 
00036 public:
00037     void  disp_info(int,int,int);
00038     void  record_data(int);
00039 };
00040 
00041 //-------- Define class GameFile -----------//
00042 
00046 class GameFile {
00047     enum { PLAYER_NAME_LEN = 41};
00048 
00049 public:
00050     size_t   class_size;                          // for version compare
00051     char     file_name[MAX_PATH+1];
00052     char*   get_save_name();
00053 
00054     char     player_name[PLAYER_NAME_LEN];
00055 
00056     int      game_date;                           // the game date of the saved game
00057     FILETIME file_date;                           // saving game date
00058     int   school_type;
00059 
00060     static   File* file_ptr;
00061     static   char  last_read_success_flag;
00062 
00063     //### begin zb 02/25/99
00064     int   game_speed;
00065     //### end zb 02/25/99
00066 
00067 public:
00068     int   save_game(char* =NULL);
00069     int   load_game(char* =NULL);
00070 
00071     int   save_express_game(char* =NULL);
00072     int   load_express_game(char* =NULL);
00073 
00074     void  set_file_name();
00075     //void  disp_info(int x, int y);
00076     int   validate_header();
00077 
00078 #if(GAME_VERSION>=200)
00079     // write log file
00080     int create_game_log(char *);
00081     int append_game_log(char *);
00082 #endif
00083 
00084 private:
00085     void  save_process();
00086     void  load_process();
00087     int   write_game_header(File* filePtr);
00088 
00089     int   write_file(File*);
00090     int   write_file_1(File*);
00091     int   write_file_2(File*);
00092     int   write_file_3(File*);
00093 
00094     int   read_file(File*);
00095     int   read_file_1(File*);
00096     int   read_file_2(File*);
00097     int   read_file_3(File*);
00098 
00099     void  write_book_mark(short bookMark);
00100     int   read_book_mark(short bookMark);
00101 
00102 #if(GAME_VERSION>=200)
00103     // write log
00104     int   write_log_header(File*);
00105     int   write_log(File*);
00106 #endif
00107 };
00108 
00109 //------- Define class GameFileArray --------//
00110 
00113 class GameFileArray : public DynArray {
00114     //-----------------------------------------//
00115 public:
00116     //int  save_game()    { return menu(1); }
00117     //int  load_game()    { return menu(2); }
00118     //int  menu(int, int *recno=NULL);
00119 
00120 private:
00121     //void disp_browse();
00122     //int  process_action(int=0);
00123 
00124     //-----------------------------------------//
00125 public:
00126     bool  demo_format;
00127     char  has_read_hall_of_fame;
00128     char last_file_name[MAX_PATH+1];
00129 
00130     HallFame hall_fame_array[HALL_FAME_NUM];
00131 
00132 public:
00133     GameFileArray();
00134 
00135     void init(char *extStr);
00136     void deinit();
00137 
00138     void save_new_game(char* =NULL);              // save a new game immediately without prompting menu
00139     void del_game(int recNo);
00140     void del_express_game(int recNo);
00141 
00142     int  read_hall_of_fame();
00143     int  write_hall_of_fame();                    // it may be called by group_res.gen_group() in writting default name
00144 
00145     //void disp_hall_of_fame();
00146     int  add_hall_of_fame(int);
00147 
00148     GameFile* operator[](int recNo);
00149 
00150 private:
00151     void load_all_game_header(char *extStr, int readAutoSave=1);
00152 };
00153 
00154 extern GameFileArray game_file_array;
00155 extern GameFile      game_file;                   // for saving autosave...
00156 
00157 //-----------------------------------------
00158 #endif

Generated on Fri Aug 23 01:37:46 2002 for VirtualU by doxygen1.2.17