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