RTS2D
|
00001 #ifndef BUILDINGPROPERTY_H 00002 #include <cstdio> 00003 #include <map> 00004 #include <vector> 00005 #include <string> 00006 #include "TileProperty.h" 00007 #include "allegro5/allegro.h" 00008 #define BUILDINGPROPERTY_H 00009 00010 enum BUILDING_TYPE {HALL, GOLD_MINE, BARRACKS, b_count}; 00011 00015 class BuildingProperty { 00016 public: 00017 virtual ~BuildingProperty(); 00018 static BuildingProperty* getInstance() { 00019 if (instance == NULL) { 00020 instance = new BuildingProperty(); 00021 } 00022 return instance; 00023 } 00024 void loadCost(); 00025 void loadDimension(); 00026 void loadTileType(); 00027 void loadMaxSlot(); 00028 void loadMaxQueue(); 00029 void loadMiningGain(); 00030 void loadMiningCooldown(); 00031 void loadMaxHp(); 00032 void loadRadius(); 00033 void loadTime(); 00034 void loadName(); 00035 void loadAction(); 00036 void loadBitmap(); 00037 void loadIcon(); 00038 00039 int getCost(int type); 00040 int getDimension(int type); 00041 int getTileType(int type); 00042 int getMaxSlot(int type); 00043 int getMaxQueue(int type); 00044 int getMiningGain(int type); 00045 float getMiningCooldown(int type); 00046 float getMaxHp(int type); 00047 float getRadius(int type); 00048 float getTime(int type); 00049 std::string getName(int type); 00050 std::vector<std::string> getAction(int type); 00051 ALLEGRO_BITMAP* getBitmap(int type); 00052 ALLEGRO_BITMAP* getIcon(int type); 00053 00054 int getType(std::string name); 00055 00056 protected: 00057 private: 00058 BuildingProperty(); 00059 static BuildingProperty* instance; 00060 std::map <int,int> cost_; 00061 std::map <int,int> dimension_; 00062 std::map <int,int> tileType_; 00063 std::map <int,int> maxSlot_; 00064 std::map <int,int> maxQueue_; 00065 std::map <int,int> miningGain_; 00066 std::map <int,float> miningCooldown_; 00067 std::map <int,float> maxhp_; 00068 std::map <int,float> time_; 00069 std::map <int,float> radius_; 00070 std::map <int,std::string> name_; 00071 std::map <int,std::vector<std::string>> action_; 00072 std::map <int,ALLEGRO_BITMAP*> bitmap_; 00073 std::map <int,ALLEGRO_BITMAP*> icon_; 00074 }; 00075 00076 #endif // BUILDINGPROPERTY_H