OGODRES.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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 : OGODRES.H
  21. //Description : Header file of object RaceRes
  22. #ifndef __OGODRES_H
  23. #define __OGODRES_H
  24. #ifndef __ONATION_H
  25. #include <ONATION.h>
  26. #endif
  27. #ifndef __OFILE_H
  28. #include <OFILE.h>
  29. #endif
  30. //------------ Define god id. -------------//
  31. #ifdef AMPLUS
  32. enum { MAX_GOD=10 };
  33. #else
  34. enum { MAX_GOD=7 };
  35. #endif
  36. enum { GOD_NORMAN=1,
  37. GOD_MAYA,
  38. GOD_GREEK,
  39. GOD_VIKING,
  40. GOD_PERSIAN,
  41. GOD_CHINESE,
  42. GOD_JAPANESE,
  43. #ifdef AMPLUS
  44. GOD_EGYPTIAN,
  45. GOD_INDIAN,
  46. GOD_ZULU,
  47. #endif
  48. };
  49. //------------ Define struct GodRec ---------------//
  50. struct GodRec
  51. {
  52. enum { RACE_CODE_LEN=8, UNIT_CODE_LEN=8, PRAY_POINTS_LEN=3,
  53. CAST_POWER_RANGE_LEN=3, RACE_ID_LEN=3, UNIT_ID_LEN=3 };
  54. char race[RACE_CODE_LEN];
  55. char unit[UNIT_CODE_LEN];
  56. char exist_pray_points[PRAY_POINTS_LEN];
  57. char power_pray_points[PRAY_POINTS_LEN];
  58. char can_cast_power; // whether this god creature can cast power or not
  59. char cast_power_range[CAST_POWER_RANGE_LEN];
  60. char race_id[RACE_ID_LEN];
  61. char unit_id[UNIT_ID_LEN];
  62. };
  63. //------------- Define struct GodInfo --------------//
  64. #pragma pack(1)
  65. struct GodInfo
  66. {
  67. public:
  68. //----- constant vars ------//
  69. char god_id;
  70. char race_id;
  71. char unit_id;
  72. short exist_pray_points; // pray points consumption for the god to exist for 100 frames
  73. short power_pray_points; // pray points consumption for each casting of its power
  74. char can_cast_power; // whether this god creature can cast power or not
  75. char cast_power_range; // location range of casting power
  76. //------ game vars ------//
  77. char nation_know_array[MAX_NATION];
  78. int is_nation_know(int nationRecno) { return nation_know_array[nationRecno-1]; }
  79. public:
  80. short invoke(int firmRecno, int xLoc, int yLoc);
  81. void enable_know(int nationRecno);
  82. void disable_know(int nationRecno);
  83. };
  84. #pragma pack()
  85. //----------- Define class GodRes ---------------//
  86. class GodRes
  87. {
  88. public:
  89. char init_flag;
  90. short god_count;
  91. GodInfo* god_info_array;
  92. public:
  93. GodRes();
  94. void init();
  95. void deinit();
  96. int is_god_unit(int unitId);
  97. void init_nation_know(int nationRecno);
  98. void enable_know_all(int nationRecno);
  99. int write_file(File*);
  100. int read_file(File*);
  101. GodInfo* operator[](int godId); // pass godId as recno
  102. private:
  103. void load_god_info();
  104. };
  105. extern GodRes god_res;
  106. //----------------------------------------------------//
  107. #endif