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 : OSITE.H 22 //Description : Object Site 23 24 #ifndef __OSITE_H 25 #define __OSITE_H 26 27 #ifndef __ODYNARRB_H 28 #include <ODYNARRB.h> 29 #endif 30 31 #ifndef __ORAWRES_H 32 #include <ORAWRES.h> 33 #endif 34 35 //-------- Define Site Type --------// 36 37 enum { MAX_SITE_TYPE=3 }; 38 39 enum { SITE_RAW=1, 40 SITE_SCROLL, 41 SITE_GOLD_COIN }; 42 43 //--------- Define class Site ----------// 44 45 #pragma pack(1) 46 class Site 47 { 48 public: 49 short site_recno; 50 51 char site_type; // SITE_RAW, SITE_ARTIFACT or SITE_SCROLL 52 53 short object_id; // id. of the object, 54 int reserve_qty; // for raw material only 55 char has_mine; // whether there is a mine on this site 56 57 short map_x_loc; 58 short map_y_loc; 59 60 uint8_t region_id; 61 62 public: 63 void init(int siteRecno, int siteType, int xLoc, int yLoc); 64 void deinit(); 65 66 void disp_info(int refreshFlag); 67 void detect_info(); 68 69 void draw(int x, int y); 70 void draw_selected(); 71 72 int get_site_object(int unitRecno); 73 int ai_get_site_object(); 74 }; 75 #pragma pack() 76 77 //--------- Define class SiteArray ----------// 78 79 #pragma pack(1) 80 class SiteArray : public DynArrayB 81 { 82 public: 83 short selected_recno; // the firm current being selected 84 short untapped_raw_count; // no. of unoccupied raw site available 85 short scroll_count; 86 short gold_coin_count; 87 short std_raw_site_count; // standard no. of raw site in one game, based on this number, new mines pop up when existing mines run out of deposit 88 89 public: 90 SiteArray(); 91 ~SiteArray(); 92 93 void init(); 94 void deinit(); 95 96 int add_site(int xLoc, int yLoc, int siteType, int objectId, int reserveQty=0); 97 void del_site(int siteRecno); 98 99 void generate_raw_site(int stdRawSiteCount=0); 100 int create_raw_site(int regionId, int townRecno=0); 101 102 int scan_site(int xLoc, int yLoc, int siteType=0); 103 void go_to_a_raw_site(); 104 void ai_get_site_object(); 105 106 void next_day(); 107 void draw_dot(); 108 109 int write_file(File* filePtr); 110 int read_file(File* filePtr); 111 112 //--------------------------------------// 113 114 int is_deleted(int recNo); 115 116 #ifdef DYNARRAY_DEBUG_ELEMENT_ACCESS 117 Site* operator()(); // reference to current Site record 118 Site* operator[](int recNo); 119 #else operator()120 Site* operator()() { return (Site*) get(); } 121 Site* operator[](int recNo) { return (Site*) get(recNo); } 122 #endif 123 124 void disp_next(int seekDir, int sameNation); 125 }; 126 #pragma pack() 127 128 extern SiteArray site_array; 129 130 //--------------------------------------------// 131 132 #endif 133