ORES.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Seven Kingdoms: Ancient Adversaries
  3. *
  4. * Copyright 1997,1998 Enlight Software Ltd.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. //Filename : ORES.H
  21. //Description : Header file of Object Resource
  22. #ifndef __ORES_H
  23. #define __ORES_H
  24. #ifndef __OFILE_H
  25. #include <OFILE.h>
  26. #endif
  27. //--------- Define class Resource ----------//
  28. class Resource : public File
  29. {
  30. public:
  31. int rec_count; // total no. of records
  32. private:
  33. enum { DEF_BUF_SIZE = 5120 }; // default buffer size : 5K
  34. long *index_buf; // index buffer pointer
  35. char *data_buf; // data buffer pointer
  36. unsigned data_buf_size; // size of the data buffer
  37. char init_flag;
  38. char read_all; // read all data from resource file to memory
  39. char use_common_buf; // use vga's buffer as data buffer or not
  40. int cur_rec_no; // current record no
  41. public:
  42. Resource() { init_flag=0; }
  43. ~Resource() { deinit(); }
  44. Resource(char* resFile, int readAll, int useCommonBuf=0)
  45. { init_flag=0; init(resFile, readAll, useCommonBuf); }
  46. void init(char* resFile, int readAll, int useCommonBuf=0);
  47. void deinit();
  48. int is_inited() { return init_flag; }
  49. char* read(int= -1);
  50. File* get_file(int, int&);
  51. };
  52. //-------------------------------------------//
  53. #endif