]> ruin.nu Git - hbs.git/blobdiff - bs/fleet.cpp
initial commit of the BSConf class.
[hbs.git] / bs / fleet.cpp
index b562b8150186def125235ef19275ef646f15a86e..c2bf40ed4b634e5399f2f08e03bc7b1a8669ac64 100644 (file)
@@ -25,6 +25,7 @@ map<string, UnitType > Fleet::s_Units;
 
 Fleet::Fleet()
 {
+       m_iETA = 0;
 }
 Fleet::~Fleet(){
 }
@@ -67,4 +68,35 @@ string Fleet::Race()
        return m_sRace;
 }
 
+//////////////////////////////////////////////////////////////////////////
+//
+/** This function iterates through m_Fleet and adds all numbers together to
+ * produce a total.
+ */
+int Fleet::NumberOfShips()
+{
+       int total = 0;
+
+       for (map<string, vector<int> >::iterator i = m_Fleet.begin(); i != m_Fleet.end(); i++)
+       {
+               total += m_Fleet[(*i).first][0];
+       }
+
+       return total;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+void Fleet::setETA(int eta)
+{
+       m_iETA = eta;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+int  Fleet::ETA()
+{
+       return m_iETA;
+}
+