]> ruin.nu Git - hbs.git/blobdiff - bs/unittype.cpp
now compiles with gcc 3.1, might not work with gcc 3.0 though (not sure)
[hbs.git] / bs / unittype.cpp
index 6f3ef82ed8b071c5c858b601fac94556555f16c8..836ddb95056f0d79978e78a48d4d5f9735762006 100644 (file)
@@ -54,21 +54,21 @@ void UnitType::setRace(int iRace)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int UnitType::Race() const
+int UnitType::race() const
 {
        return m_iRace;
 }
 
 //////////////////////////////////////////////////////////////////////////
 //
-void UnitType::setClass(string sClass)
+void UnitType::setUnitClass(string sClass)
 {
        m_sClass = sClass;
 }
 
 //////////////////////////////////////////////////////////////////////////
 //
-string UnitType::Class() const
+string UnitType::unitClass() const
 {
        return m_sClass;
 }
@@ -93,7 +93,7 @@ void UnitType::addTarget(string target)
  * If it finds the position it inserts the target there, if it reaches the end 
  * before it finds the correct possition it adds the target to the end. 
  */
-void UnitType::insTarget(string target, int index = 0)
+void UnitType::insTarget(string target, int index)
 {
 
        vector<string>::iterator i = m_vTarget.begin(); 
@@ -112,14 +112,14 @@ void UnitType::insTarget(string target, int index = 0)
 
 //////////////////////////////////////////////////////////////////////////
 //
-vector<string> UnitType::Target() const
+vector<string> UnitType::target() const
 {
        return m_vTarget;
 }
 
 //////////////////////////////////////////////////////////////////////////
 //
-string UnitType::Target(int index) const
+string UnitType::target(int index) const
 {
        return m_vTarget[index];
 }
@@ -133,7 +133,7 @@ void UnitType::setInitiative(int iInit)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int     UnitType::Initiative() const
+int     UnitType::initiative() const
 {
        return m_iInitiative;
 }
@@ -147,7 +147,7 @@ void UnitType::setAgility (int iAgil)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int  UnitType::Agility() const
+int  UnitType::agility() const
 {
        return m_iAgility;
 }
@@ -161,7 +161,7 @@ void UnitType::setWeaponSpeed(int iWPSP)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int  UnitType::WeaponSpeed() const
+int  UnitType::weaponSpeed() const
 {
        return m_iWeaponSpeed;
 }
@@ -175,7 +175,7 @@ void UnitType::setGuns(int iGuns)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int UnitType::Guns() const
+int UnitType::guns() const
 {
        return m_iGuns;
 }
@@ -189,7 +189,7 @@ void UnitType::setPower(int iPower)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int  UnitType::Power() const
+int  UnitType::power() const
 {
        return m_iPower;
 }
@@ -203,7 +203,7 @@ void UnitType::setArmor(int iArmor)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int  UnitType::Armor() const
+int  UnitType::armor() const
 {
        return m_iArmor;
 }
@@ -224,16 +224,33 @@ int  UnitType::EMP() const
 
 //////////////////////////////////////////////////////////////////////////
 //
-void UnitType::setTotalResources(int iTR)
+void UnitType::setResources(std::string type, int i)
 {
-       m_iTotalResources = iTR;
+       m_Resources[type] = i;
 }
 
 //////////////////////////////////////////////////////////////////////////
 //
-int UnitType::TotRes() const
+void UnitType::setResources(map<std::string, int> res)
 {
-       return m_iTotalResources;
+       m_Resources = res;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+std::map<std::string, int> UnitType::resources()
+{
+       return m_Resources;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+int UnitType::totRes() const
+{
+       int totres = 0;
+       for (map<string, int>::const_iterator i = m_Resources.begin(); i != m_Resources.end(); ++i)
+               totres += i->second;
+       return totres;
 }
 
 //////////////////////////////////////////////////////////////////////////
@@ -245,7 +262,7 @@ void UnitType::setFuel(int iFuel)
 
 //////////////////////////////////////////////////////////////////////////
 //
-int  UnitType::Fuel() const
+int  UnitType::fuel() const
 {
        return m_iFuel;
 }
@@ -273,7 +290,7 @@ void UnitType::setType(string type)
 
 //////////////////////////////////////////////////////////////////////////
 //
-string  UnitType::Type() const
+string  UnitType::type() const
 {
        return m_sType;
 }