123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- #ifndef __OGFILE_H
- #define __OGFILE_H
- #ifndef __OFILE_H
- #include <OFILE.h>
- #endif
- #ifndef __ODYNARR_H
- #include <ODYNARR.h>
- #endif
- #ifndef __ONATION_Hd
- #include <ONATION.h>
- #endif
- #ifdef AMPLUS
- #define VERSION_1_MAX_RACE 7
- #define VERSION_1_MAX_UNIT_TYPE 37
- #define VERSION_1_RACERES_NAME_COUNT 1582
- #define VERSION_1_UNITRES_UNIT_INFO_COUNT 37
- #define VERSION_1_TOWNRES_TOWN_NAME_COUNT 367
- #define VERSION_1_GODRES_GOD_COUNT 7
- #define VERSION_1_TECH_COUNT 7
- #endif
- enum { HALL_FAME_NUM = 6 };
- #pragma pack(1)
- struct HallFame
- {
- char player_name[NationArray::HUMAN_NAME_LEN+1];
- char race_id;
- short start_year;
- short end_year;
- int score;
- int population;
- short difficulty_rating;
- public:
- void disp_info(int,int,int);
- void record_data(int);
- };
- #pragma pack()
- #pragma pack(1)
- class GameFile
- {
- public:
- size_t class_size;
- char file_name[MAX_PATH+1];
- char player_name[NationArray::HUMAN_NAME_LEN+1];
- char race_id;
- char nation_color;
- int game_date;
- FILETIME file_date;
- short terrain_set;
- static File* file_ptr;
- static char last_read_success_flag;
- public:
- int save_game(char* =NULL);
- int load_game(char* =NULL);
- void set_file_name();
- void disp_info(int x, int y);
- int validate_header();
- private:
- void save_process();
- void load_process();
- int write_game_header(File* filePtr);
- int write_file(File*);
- int write_file_1(File*);
- int write_file_2(File*);
- int write_file_3(File*);
- int read_file(File*);
- int read_file_1(File*);
- int read_file_2(File*);
- int read_file_3(File*);
- void write_book_mark(short bookMark);
- int read_book_mark(short bookMark);
- };
- #pragma pack()
- class GameFileArray : public DynArray
- {
- public:
- char demo_format;
- char has_read_hall_of_fame;
- char last_file_name[MAX_PATH+1];
-
- #ifdef AMPLUS
- short load_file_game_version;
- char same_version;
- #endif
-
- HallFame hall_fame_array[HALL_FAME_NUM];
- public:
- GameFileArray();
- void init(char *extStr);
- void deinit();
- int menu(int, int *recno=NULL);
- int save_game() { return menu(1); }
- int load_game() { return menu(2); }
- void save_new_game(char* =NULL);
- int read_hall_of_fame();
- int write_hall_of_fame();
- void disp_hall_of_fame();
- int add_hall_of_fame(int);
- GameFile* operator[](int recNo);
- private:
- void disp_browse();
- void load_all_game_header(char *extStr);
- int process_action(int=0);
- void del_game();
- };
- extern GameFileArray game_file_array;
- extern GameFile game_file;
- #endif
|