]> ruin.nu Git - hbs.git/blobdiff - bs/bsdoc.cpp
fleetview now generates the correct "unit table" when it's created.
[hbs.git] / bs / bsdoc.cpp
index e5504f93d16d9e5c70cf8151b3effb44e91b3910..c65903bc728a5644013f85cd464d275bef764c22 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "bsdoc.h"
 
+using namespace std;
 
 BSDoc::BSDoc()
 {
@@ -68,8 +69,34 @@ int BSDoc::newBattle(QString name)
 /////////////////////////////////////////////////////////////////////////
 //
 
-const std::map<QString, std::map<QString, std::map<QString, Fleet> > >& BSDoc::Battles() const
+const std::map<QString, std::map<QString, std::map<QString, Fleet> > >& BSDoc::battles() const
 {
        return m_Battles;
 }
 
+//////////////////////////////////////////////////////////////////////////
+//
+Fleet BSDoc::specificFleet(QString battle, QString group, QString fleet) const
+{
+       for (map<QString, map<QString, map<QString, Fleet> > >::const_iterator i = m_Battles.begin(); i != m_Battles.end(); ++i)
+       {
+               if (i->first == battle)
+               {
+                       for (map<QString, map<QString, Fleet> >::const_iterator j = i->second.begin(); j != i->second.end(); j++)
+                       {
+                               if (j->first == group)
+                               {
+                                       for (map<QString, Fleet>::const_iterator k = j->second.begin(); k != j->second.end(); ++k)
+                                       {
+                                               if (k->first == fleet)
+                                               {
+                                                       return k->second;
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+}
+
+