X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=bs%2Funittype.cpp;h=836ddb95056f0d79978e78a48d4d5f9735762006;hb=20b89dab5346f13dc17b368b92de89eebf00ac11;hp=6f3ef82ed8b071c5c858b601fac94556555f16c8;hpb=15d92b3097a80faf26b8ce4cb4a6b957d17bc092;p=hbs.git diff --git a/bs/unittype.cpp b/bs/unittype.cpp index 6f3ef82..836ddb9 100644 --- a/bs/unittype.cpp +++ b/bs/unittype.cpp @@ -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::iterator i = m_vTarget.begin(); @@ -112,14 +112,14 @@ void UnitType::insTarget(string target, int index = 0) ////////////////////////////////////////////////////////////////////////// // -vector UnitType::Target() const +vector 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 res) { - return m_iTotalResources; + m_Resources = res; +} + +////////////////////////////////////////////////////////////////////////// +// +std::map UnitType::resources() +{ + return m_Resources; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::totRes() const +{ + int totres = 0; + for (map::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; }