File: OGODRES.h

package info (click to toggle)
7kaa 2.15.6%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 131,312 kB
  • sloc: cpp: 134,790; asm: 3,523; ansic: 1,949; perl: 1,665; makefile: 1,181; sh: 126; pascal: 27
file content (132 lines) | stat: -rw-r--r-- 3,095 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
 * Seven Kingdoms: Ancient Adversaries
 *
 * Copyright 1997,1998 Enlight Software Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

//Filename    : OGODRES.H
//Description : Header file of object RaceRes

#ifndef __OGODRES_H
#define __OGODRES_H

#ifndef __ONATION_H
#include <ONATION.h>
#endif

#ifndef __OFILE_H
#include <OFILE.h>
#endif

//------------ Define god id. -------------//

enum { MAX_GOD=10 };

enum { GOD_NORMAN=1,
		 GOD_MAYA,
		 GOD_GREEK,
		 GOD_VIKING,
		 GOD_PERSIAN,
		 GOD_CHINESE,
		 GOD_JAPANESE,
		 GOD_EGYPTIAN,
		 GOD_INDIAN,
		 GOD_ZULU,
	  };

//------------ Define struct GodRec ---------------//

struct GodRec
{
	enum { RACE_CODE_LEN=8, UNIT_CODE_LEN=8, PRAY_POINTS_LEN=3,
			 CAST_POWER_RANGE_LEN=3, RACE_ID_LEN=3, UNIT_ID_LEN=3 };

	char race[RACE_CODE_LEN];
	char unit[UNIT_CODE_LEN];
	char exist_pray_points[PRAY_POINTS_LEN];
	char power_pray_points[PRAY_POINTS_LEN];
	char can_cast_power;			// whether this god creature can cast power or not
	char cast_power_range[CAST_POWER_RANGE_LEN];

	char race_id[RACE_ID_LEN];
	char unit_id[UNIT_ID_LEN];
};

//------------- Define struct GodInfo --------------//

#pragma pack(1)
struct GodInfo
{
public:
	//----- constant vars ------//

	char  god_id;
	char  race_id;
	char  unit_id;
	short	exist_pray_points;		// pray points consumption for the god to exist for 100 frames
	short power_pray_points;		// pray points consumption for each casting of its power
	char	can_cast_power;			// whether this god creature can cast power or not
	char	cast_power_range;			// location range of casting power

	//------ game vars ------//

	char	nation_know_array[MAX_NATION];
	int	is_nation_know(int nationRecno)	{ return nation_know_array[nationRecno-1]; }

public:
	short	invoke(int firmRecno, int xLoc, int yLoc);

	void	enable_know(int nationRecno);
	void	disable_know(int nationRecno);
};
#pragma pack()

//----------- Define class GodRes ---------------//

class GodRes
{
public:
	char        init_flag;

	short       god_count;
	GodInfo*    god_info_array;

public:
	GodRes();

	void        init();
	void        deinit();

   int			is_god_unit(int unitId);		

	void			init_nation_know(int nationRecno);
	void			enable_know_all(int nationRecno);

	int         write_file(File*);
	int         read_file(File*);

	GodInfo*    operator[](int godId);      // pass godId  as recno

private:
	void        load_god_info();
};

extern GodRes god_res;

//----------------------------------------------------//

#endif