OMONSRES.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 : OMONSRES.H
  21. //Description : Header file of object RaceRes
  22. #ifndef __OMONSRES_H
  23. #define __OMONSRES_H
  24. #ifndef __ORESDB_H
  25. #include <ORESDB.h>
  26. #endif
  27. //----------- Define constant ------------//
  28. enum { MAX_MONSTER_LEVEL = 9 };
  29. enum { MAX_ACTIVE_MONSTER = 3 }; // No. of monster type in each game
  30. //----------- Define constant ------------//
  31. #define REPUTATION_INCREASE_PER_ATTACK_MONSTER ((float)0.001)
  32. //------------ Define struct RaceRec ---------------//
  33. struct MonsterRec
  34. {
  35. enum { UNIT_CODE_LEN=8, RANK_LEN=8, NAME_LEN=20, FIRM_BUILD_CODE_LEN=8, UNIT_ID_LEN=3 };
  36. char unit_code[UNIT_CODE_LEN];
  37. char name[NAME_LEN];
  38. char level; // the level of the 1-9 monster, the higher the level is, the more powerful the monster is.
  39. char firm_build_code[FIRM_BUILD_CODE_LEN];
  40. char unit_id[UNIT_ID_LEN];
  41. };
  42. //------------- Define struct MonsterInfo --------------//
  43. struct MonsterInfo
  44. {
  45. public:
  46. //------- constant vars --------//
  47. enum { NAME_LEN=20, FIRM_BUILD_CODE_LEN=8 };
  48. short monster_id;
  49. char name[NAME_LEN+1];
  50. short unit_id;
  51. char level;
  52. char firm_build_code[FIRM_BUILD_CODE_LEN+1];
  53. public:
  54. int create_firm_monster();
  55. int build_firm_monster(int xLoc, int yLoc, int fullHitPoints=1);
  56. };
  57. //----------- Define class MonsterRes ---------------//
  58. class MonsterRes
  59. {
  60. public:
  61. char init_flag;
  62. short monster_count;
  63. MonsterInfo* monster_info_array;
  64. short active_monster_array[MAX_ACTIVE_MONSTER];
  65. ResourceDb res_bitmap;
  66. public:
  67. MonsterRes();
  68. void init();
  69. void deinit();
  70. void init_active_monster();
  71. void generate(int generateCount);
  72. void stop_attack_nation(short nationRecno);
  73. int write_file(File* filePtr);
  74. int read_file(File* filePtr);
  75. MonsterInfo* operator[](int monsterId); // pass monsterId as recno
  76. private:
  77. void load_monster_info();
  78. };
  79. extern MonsterRes monster_res;
  80. //----------------------------------------------------//
  81. #endif