00001 //Filename : OFIRMRES.h 00002 //Description : FirmRes Class Declaration 00003 //owner : ho 00004 00005 #ifndef __OFIRMRES_H 00006 #define __OFIRMRES_H 00007 00008 #ifndef __ORESX_H 00009 #include <ORESX.H> 00010 #endif 00011 00012 //------- Define FirmRec --------// 00013 00016 struct FirmRec { 00017 enum { CODE_LEN=8, NAME_LEN=50 }; 00018 00019 char code[CODE_LEN]; 00020 char name[NAME_LEN]; 00021 00022 char field; 00023 }; 00024 00025 //------- Define FirmBitmapRec --------// 00026 00029 struct FirmBitmapRec { 00030 enum { CODE_LEN=8, LOC_WIDTH_LEN=2, LOC_HEIGHT_LEN=2 }; 00031 00032 char code[CODE_LEN]; 00033 char loc_width[LOC_WIDTH_LEN]; 00034 char loc_height[LOC_HEIGHT_LEN]; 00035 }; 00036 00037 //------ Define struct FirmInfo --------// 00038 00041 struct FirmInfo { 00042 public: 00043 enum { CODE_LEN=8, NAME_LEN=50 }; 00044 00045 char code[CODE_LEN+1]; 00046 char name[NAME_LEN+1]; 00047 00048 short field_id; // >0 if this is an academic departmental building, this tells the field of the department 00049 00050 char loc_width; 00051 char loc_height; 00052 00053 char* bitmap_ptr[MAX_ZOOM_LEVEL]; 00054 short bitmap_width[MAX_ZOOM_LEVEL]; 00055 short bitmap_height[MAX_ZOOM_LEVEL]; 00056 00057 public: 00058 int is_available() { // err_when(loc_width<=0); if loc_width==0, that means there is no such firm in the current university type 00059 return loc_width > 0; 00060 } 00061 int can_build(int xLoc, int yLoc); 00062 int is_fully_visible(int xLoc1, int yLoc1); 00063 }; 00064 00065 //------- Define class FirmRes ---------// 00066 00069 class FirmRes { 00070 public: 00071 bool init_flag; 00072 00073 short firm_count; 00074 FirmInfo* info_array; 00075 00076 ResourceIdx res_bitmap[MAX_ZOOM_LEVEL]; 00077 00078 public: 00079 FirmRes(); 00080 ~FirmRes(); // public for compilation error if private 00081 00082 void init(); 00083 void deinit(); 00084 00085 short* get_color_remap_table(int selectedFlag); 00086 00087 FirmInfo* operator[](int firmId); 00088 00089 private: 00090 void load_info(); 00091 void load_bmp_info(char* fileName); 00092 00093 void load_res(int bmpSizeType, char* namePrefix, char* nameSuffix); 00094 }; 00095 00096 extern FirmRes firm_res; 00097 00098 //-----------------------------------------------// 00099 #endif