Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

OPLANT3.H Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

OPLANT3.H

Go to the documentation of this file.
00001 //Filename    : OPLANT.H
00002 //Description : Header file of object PlantRes
00003 //Owner       : Gilbert
00004 
00005 #ifndef __OPLANT_H
00006 #define __OPLANT_H
00007 
00008 #ifndef __ORESDB_H
00009 #include <ORESDB.H>
00010 #endif
00011 
00012 //------------- Define climate zone ------------//
00013 
00014 enum {
00015     ZONE_TROPICAL =1,
00016     ZONE_TEMPERATE=2
00017 };
00018 
00019 //------------ Define struct PlantRec ---------------//
00020 
00023 struct PlantRec {
00024     enum { CODE_LEN=8, ZONE_LEN=1, TERA_TYPE_LEN=2, FIRST_BITMAP_LEN=3, BITMAP_COUNT_LEN=3 };
00025 
00026     char code[CODE_LEN];
00027     char climate_zone[ZONE_LEN];
00028 
00029     char tera_type1[TERA_TYPE_LEN];
00030     char tera_type2[TERA_TYPE_LEN];
00031     char tera_type3[TERA_TYPE_LEN];
00032 
00033     char first_bitmap[FIRST_BITMAP_LEN];
00034     char bitmap_count[BITMAP_COUNT_LEN];
00035 };
00036 
00037 //------------ Define struct PlantBitmapRec ---------------//
00038 
00040 struct PlantBitmapRec {
00041     enum { PLANT_LEN=8, SIZE_LEN=2, OFFSET_LEN=4, FILE_NAME_LEN=8, BITMAP_PTR_LEN=4 };
00042 
00043     char plant[PLANT_LEN];
00044     char size[SIZE_LEN];
00045 
00046     char offset_x[OFFSET_LEN];
00047     char offset_y[OFFSET_LEN];
00048 
00049     char town_age;
00050 
00051     char file_name[FILE_NAME_LEN];
00052     char bitmap_ptr[BITMAP_PTR_LEN];
00053 };
00054 
00055 //------------- Define struct PlantInfo --------------//
00056 
00059 struct PlantInfo {
00060     enum { CODE_LEN=8 };
00061 
00062     char  code[CODE_LEN+1];
00063     char  climate_zone;
00064     char  tera_type[3];
00065 
00066     short first_bitmap;
00067     short bitmap_count;
00068 };
00069 
00070 //------------- Define struct PlantBitmap -------------//
00071 
00073 struct PlantBitmap {
00074 public:
00075     char  size;
00076     short offset_x, offset_y;
00077     char  town_age;
00078 
00079     short bitmap_width, bitmap_height;
00080     char* bitmap_ptr;
00081 
00082 public:
00083     void  draw(int xLoc, int yLoc);               // plant on Location
00084     // plant in town
00085     void  draw_at(int curX, int curY, int curZ, int constructionCompletionPercent = 100);
00086 };
00087 
00088 //----------- Define class PlantRes ---------------//
00089 
00092 class PlantRes {
00093 public:
00094     short      plant_count;
00095     short      plant_bitmap_count;
00096 
00097     PlantInfo*   plant_info_array;
00098     PlantBitmap* plant_bitmap_array;
00099     short*     scan_id_array;                     // a buffer for scaning
00100 
00101     char       plant_map_color;
00102 
00103     char       init_flag;
00104     ResourceDb   res_bitmap;
00105 
00106 public:
00107     PlantRes();
00108 
00109     void       init();
00110     void       deinit();
00111 
00112     int        scan(int climateZone, int teraType, int townAge);
00113 
00114     short      plant_recno(short bitmapId);
00115 
00116 #ifdef DEBUG
00117     PlantBitmap* get_bitmap(int bitmapId);
00118     PlantInfo*   operator[](int plantId);
00119 #else
00120     PlantBitmap* get_bitmap(int bitmapId)   { return plant_bitmap_array+bitmapId-1; }
00121     PlantInfo*   operator[](int plantId)  { return plant_info_array+plantId-1; }
00122 #endif
00123 
00124 private:
00125     void        load_plant_info();
00126     void        load_plant_bitmap();
00127 };
00128 
00129 extern PlantRes plant_res;
00130 
00131 //----------------------------------------------------//
00132 #endif

Generated on Fri Aug 23 01:38:11 2002 for VirtualU by doxygen1.2.17