File: OPOWER.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 (141 lines) | stat: -rw-r--r-- 3,738 bytes parent folder | download | duplicates (7)
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
133
134
135
136
137
138
139
140
141
/*
 * 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    : OPOWER.H
//Description : Header file of Object Power

#ifndef __OPOWER_H
#define __OPOWER_H

#ifndef __ALL_H
#include <ALL.h>
#endif

//-------- Define command id. -----------//

enum { COMMAND_BUILD_FIRM=1,
		 COMMAND_ASSIGN,
		 COMMAND_BURN,
		 COMMAND_SETTLE,
		 COMMAND_SET_CARAVAN_STOP,
		 COMMAND_SET_SHIP_STOP,
		 COMMAND_BUILD_WALL,
		 COMMAND_DESTRUCT_WALL,
		 COMMAND_GOD_CAST_POWER,
	  };

// --------- define ScreenObjectType --------//

enum ScreenObjectType
{
	SCREEN_OBJECT_NONE,
	SCREEN_OBJECT_FRIEND_UNIT,
	SCREEN_OBJECT_UNIT_GROUP,
	SCREEN_OBJECT_ENEMY_UNIT,
	SCREEN_OBJECT_SPY_UNIT,		// our spy, shealthed to other nation, selected object only
	SCREEN_OBJECT_FRIEND_TOWN,
	SCREEN_OBJECT_ENEMY_TOWN,
	SCREEN_OBJECT_FRIEND_FIRM,
	SCREEN_OBJECT_ENEMY_FIRM,
	SCREEN_OBJECT_WALL,
	SCREEN_OBJECT_SITE,
};


//-------- Map modes ------------//

enum { MAP_MODE_NUM = 5 };
enum { MAP_NORMAL=0, MAP_CLIMATE, MAP_RESOURCE, MAP_PROFIT, MAP_LINK };

//----------- Define constant -----------//

enum { MAX_KEY_STR = 5 };       // Maximum 5 different key string

//--------- Define class Power ----------//

struct Location;

#pragma pack(1)
class Power
{
public:
	int   		command_id;
	int   		command_unit_recno, command_para;

	char			win_opened;
	char			enable_flag;

	int  			key_str_pos[MAX_KEY_STR];  // for detecting cheating codes

public:
	Power();
	~Power();

	void			init();

	void 			enable()		{ enable_flag=1; }
	void 			disable()	{ enable_flag=0; }

	void			issue_command(int,int=0,int=0);
	void			reset_command()			{ command_id=0; }

	void			mouse_handler();
	void  		reset_selection();

	char*			get_link_icon(char linkStatus, int sameNation);

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

	//------- cursor related functions ------//

	int			choose_cursor(int scrnX, int scrnY,
						ScreenObjectType selectedObjectType, short selectedObjectRecno,
						ScreenObjectType pointingObjectType, short pointingObjectRecno);

	int			choose_cursor_units(short selectedUnitRecno, short pointingUnitRecno);
	int			choose_cursor_unit_group(short pointingUnitRecno);

	ScreenObjectType	find_selected_type( short *);
	ScreenObjectType	find_pointing_type( Location *, short *);

public:
	int  			detect_frame();
	int 			detect_action();
	// ###### begin Gilbert 31/7 ######//
	// Location* 	test_detect(int curX, int curY);
	Location*       test_detect(int curX, int curY, char *mobileType=NULL);
	// ###### end Gilbert 31/7 ######//
	int 		 	detect_select(int selX1, int selY1, int selX2, int selY2, int recallGroup, int shiftSelect);
	int			detect_scroll();
	// ###### begin Gilbert 22/10 #######//
	int			unit_can_assign_firm(int unitRecno, int firmRecno, int ownNationRecno);
	// ###### end Gilbert 22/10 #######//
	//### begin alex 19/3 ###//
	short			select_active_unit(short *selectedArray, short selectedCount);
	//#### end alex 19/3 ####//
};
#pragma pack()

extern Power power;

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

#endif