]> ruin.nu Git - hbs.git/blobdiff - bs/unittype.cpp
hbs now handles salvage.. not fully correctly yet though, need to fix
[hbs.git] / bs / unittype.cpp
index 20c30a39e7e87660cb8810ff6391dbac5e1687aa..36bd4ed7c333c80bc063a8384980222f06b1a431 100644 (file)
@@ -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<std::string, int> res)
+{
+       m_Resources = res;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+std::map<std::string, int> UnitType::resources()
+{
+       return m_Resources;
 }
 
 //////////////////////////////////////////////////////////////////////////
 //
 int UnitType::totRes() const
 {
-       return m_iTotalResources;
+       int totres = 0;
+       for (map<string, int>::const_iterator i = m_Resources.begin(); i != m_Resources.end(); ++i)
+               totres += i->second;
+       return totres;
 }
 
 //////////////////////////////////////////////////////////////////////////