1 // ============================================================== 2 // This file is part of Glest (www.glest.org) 3 // 4 // Copyright (C) 2001-2008 Marti�o Figueroa 5 // 6 // You can redistribute this code and/or modify it under 7 // the terms of the GNU General Public License as published 8 // by the Free Software Foundation; either version 2 of the 9 // License, or (at your option) any later version 10 // ============================================================== 11 12 #ifndef _GLEST_GAME_UPGRADETYPE_H_ 13 #define _GLEST_GAME_UPGRADETYPE_H_ 14 15 #include "element_type.h" 16 #include "checksum.h" 17 18 using Shared::Util::Checksum; 19 20 namespace Glest{ namespace Game{ 21 22 class TechTree; 23 class FactionType; 24 class UnitType; 25 26 // =============================== 27 // class UpgradeTypeBase 28 // =============================== 29 30 class UpgradeTypeBase{ 31 protected: 32 int maxHp; 33 int sight; 34 int maxEp; 35 int armor; 36 int attackStrength; 37 int attackRange; 38 int moveSpeed; 39 int prodSpeed; 40 41 public: getMaxHp()42 int getMaxHp() const {return maxHp;} getSight()43 int getSight() const {return sight;} getMaxEp()44 int getMaxEp() const {return maxEp;} getArmor()45 int getArmor() const {return armor;} getAttackStrength()46 int getAttackStrength() const {return attackStrength;} getAttackRange()47 int getAttackRange() const {return attackRange;} getMoveSpeed()48 int getMoveSpeed() const {return moveSpeed;} getProdSpeed()49 int getProdSpeed() const {return prodSpeed;} 50 }; 51 52 // =============================== 53 // class UpgradeType 54 // =============================== 55 56 class UpgradeType: public UpgradeTypeBase, public ProducibleType{ 57 private: 58 vector<const UnitType*> effects; 59 60 public: 61 void preLoad(const string &dir); 62 void load(const string &dir, const TechTree *techTree, const FactionType *factionType, Checksum* checksum); 63 64 //get all getEffectCount()65 int getEffectCount() const {return effects.size();} getEffect(int i)66 const UnitType * getEffect(int i) const {return effects[i];} 67 bool isAffected(const UnitType *unitType) const; 68 69 //other methods 70 virtual string getReqDesc() const; 71 }; 72 73 // =============================== 74 // class TotalUpgrade 75 // =============================== 76 77 class TotalUpgrade: public UpgradeTypeBase{ 78 public: 79 TotalUpgrade(); 80 81 void reset(); 82 void sum(const UpgradeType *ut); 83 void incLevel(const UnitType *ut); 84 }; 85 86 }}//end namespace 87 88 #endif 89