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 : OPOWER.H 22 //Description : Header file of Object Power 23 24 #ifndef __OPOWER_H 25 #define __OPOWER_H 26 27 #ifndef __ALL_H 28 #include <ALL.h> 29 #endif 30 31 //-------- Define command id. -----------// 32 33 enum { COMMAND_BUILD_FIRM=1, 34 COMMAND_ASSIGN, 35 COMMAND_BURN, 36 COMMAND_SETTLE, 37 COMMAND_SET_CARAVAN_STOP, 38 COMMAND_SET_SHIP_STOP, 39 COMMAND_BUILD_WALL, 40 COMMAND_DESTRUCT_WALL, 41 COMMAND_GOD_CAST_POWER, 42 }; 43 44 // --------- define ScreenObjectType --------// 45 46 enum ScreenObjectType 47 { 48 SCREEN_OBJECT_NONE, 49 SCREEN_OBJECT_FRIEND_UNIT, 50 SCREEN_OBJECT_UNIT_GROUP, 51 SCREEN_OBJECT_ENEMY_UNIT, 52 SCREEN_OBJECT_SPY_UNIT, // our spy, shealthed to other nation, selected object only 53 SCREEN_OBJECT_FRIEND_TOWN, 54 SCREEN_OBJECT_ENEMY_TOWN, 55 SCREEN_OBJECT_FRIEND_FIRM, 56 SCREEN_OBJECT_ENEMY_FIRM, 57 SCREEN_OBJECT_WALL, 58 SCREEN_OBJECT_SITE, 59 }; 60 61 62 //-------- Map modes ------------// 63 64 enum { MAP_MODE_NUM = 5 }; 65 enum { MAP_NORMAL=0, MAP_CLIMATE, MAP_RESOURCE, MAP_PROFIT, MAP_LINK }; 66 67 //----------- Define constant -----------// 68 69 enum { MAX_KEY_STR = 5 }; // Maximum 5 different key string 70 71 //--------- Define class Power ----------// 72 73 struct Location; 74 75 #pragma pack(1) 76 class Power 77 { 78 public: 79 int command_id; 80 int command_unit_recno, command_para; 81 82 char win_opened; 83 char enable_flag; 84 85 int key_str_pos[MAX_KEY_STR]; // for detecting cheating codes 86 87 public: 88 Power(); 89 ~Power(); 90 91 void init(); 92 enable()93 void enable() { enable_flag=1; } disable()94 void disable() { enable_flag=0; } 95 96 void issue_command(int,int=0,int=0); reset_command()97 void reset_command() { command_id=0; } 98 99 void mouse_handler(); 100 void reset_selection(); 101 102 char* get_link_icon(char linkStatus, int sameNation); 103 104 int write_file(File* filePtr); 105 int read_file(File* filePtr); 106 107 //------- cursor related functions ------// 108 109 int choose_cursor(int scrnX, int scrnY, 110 ScreenObjectType selectedObjectType, short selectedObjectRecno, 111 ScreenObjectType pointingObjectType, short pointingObjectRecno); 112 113 int choose_cursor_units(short selectedUnitRecno, short pointingUnitRecno); 114 int choose_cursor_unit_group(short pointingUnitRecno); 115 116 ScreenObjectType find_selected_type( short *); 117 ScreenObjectType find_pointing_type( Location *, short *); 118 119 public: 120 int detect_frame(); 121 int detect_action(); 122 // ###### begin Gilbert 31/7 ######// 123 // Location* test_detect(int curX, int curY); 124 Location* test_detect(int curX, int curY, char *mobileType=NULL); 125 // ###### end Gilbert 31/7 ######// 126 int detect_select(int selX1, int selY1, int selX2, int selY2, int recallGroup, int shiftSelect); 127 int detect_scroll(); 128 // ###### begin Gilbert 22/10 #######// 129 int unit_can_assign_firm(int unitRecno, int firmRecno, int ownNationRecno); 130 // ###### end Gilbert 22/10 #######// 131 //### begin alex 19/3 ###// 132 short select_active_unit(short *selectedArray, short selectedCount); 133 //#### end alex 19/3 ####// 134 }; 135 #pragma pack() 136 137 extern Power power; 138 139 //---------------------------------------// 140 141 #endif 142