X-Git-Url: https://ruin.nu/git/?p=hbs.git;a=blobdiff_plain;f=bs%2Ffleet.cpp;h=c2bf40ed4b634e5399f2f08e03bc7b1a8669ac64;hp=35de49b849adc58016de508afd2217036f50da2d;hb=f1e79e13d76a63700e6345503e338afaa93c102d;hpb=4449ffee20fa04e3b865cbd37ba8027bae599018 diff --git a/bs/fleet.cpp b/bs/fleet.cpp index 35de49b..c2bf40e 100644 --- a/bs/fleet.cpp +++ b/bs/fleet.cpp @@ -19,8 +19,13 @@ using namespace std; +//Static variables +map > Fleet::s_Races; +map Fleet::s_Units; + Fleet::Fleet() { + m_iETA = 0; } Fleet::~Fleet(){ } @@ -48,7 +53,6 @@ string Fleet::Name() bool Fleet::setRace(std::string sRace) { m_sRace = sRace; - s_Units.begin(); for (map >::iterator i = s_Races.begin(); i != s_Races.end(); i++) { if (m_sRace == (*i).first) @@ -64,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 >::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; +} +