X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=bs%2Funittype.cpp;h=836ddb95056f0d79978e78a48d4d5f9735762006;hb=9fa0d25038087d8417c0849a495eeae1abcb9504;hp=20c30a39e7e87660cb8810ff6391dbac5e1687aa;hpb=5940cfda3be2c7b4ecbd64c814948b29139177c0;p=hbs.git diff --git a/bs/unittype.cpp b/bs/unittype.cpp index 20c30a3..836ddb9 100644 --- a/bs/unittype.cpp +++ b/bs/unittype.cpp @@ -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(); @@ -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; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setResources(map res) +{ + m_Resources = res; +} + +////////////////////////////////////////////////////////////////////////// +// +std::map UnitType::resources() +{ + return m_Resources; } ////////////////////////////////////////////////////////////////////////// // int UnitType::totRes() const { - return m_iTotalResources; + int totres = 0; + for (map::const_iterator i = m_Resources.begin(); i != m_Resources.end(); ++i) + totres += i->second; + return totres; } //////////////////////////////////////////////////////////////////////////