]> ruin.nu Git - hbs.git/blobdiff - bs/fleet.cpp
initial commit of the BSConf class.
[hbs.git] / bs / fleet.cpp
index a57d25e86db06c0a359928fee7b3a70e50729d6b..c2bf40ed4b634e5399f2f08e03bc7b1a8669ac64 100644 (file)
 
 #include "fleet.h"
 
-Fleet::Fleet(){
+using namespace std;
+
+//Static variables
+map<string, vector<int> > Fleet::s_Races;
+map<string, UnitType > Fleet::s_Units;
+
+Fleet::Fleet()
+{
+       m_iETA = 0;
 }
 Fleet::~Fleet(){
 }
+
+//////////////////////////////////////////////////////////////////////////
+//
+void Fleet::setName(string sName)
+{
+       m_sName = sName;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+string Fleet::Name()
+{
+       return m_sName;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+/** This function first sets the race, then it iterates through the the 
+ * s_Races and checks if it finds the race it returns true, if it reaches
+ * the end without finding it it returns false.
+ */
+bool Fleet::setRace(std::string sRace)
+{
+       m_sRace = sRace;
+       for (map<string, vector<int> >::iterator i = s_Races.begin(); i != s_Races.end(); i++)
+       {
+               if (m_sRace == (*i).first)
+                       return true;
+       }
+       return false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+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;
+}
+
+