X-Git-Url: https://ruin.nu/git/index.pl?a=blobdiff_plain;f=bs%2Ffleet.cpp;h=4989573d87f069b3e3bd6e27c4b009e9a0e7268c;hb=e07f49323a1936c90605d06f6f63e4c39b4c4aca;hp=b562b8150186def125235ef19275ef646f15a86e;hpb=fb2a45b071b141a63140645c135ade3c731fa503;p=hbs.git diff --git a/bs/fleet.cpp b/bs/fleet.cpp index b562b81..4989573 100644 --- a/bs/fleet.cpp +++ b/bs/fleet.cpp @@ -67,4 +67,20 @@ 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; +}