X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;ds=sidebyside;f=bs%2Fbsdoc.cpp;h=c65903bc728a5644013f85cd464d275bef764c22;hb=15d92b3097a80faf26b8ce4cb4a6b957d17bc092;hp=3d32cad004dd1aa92a123bdbc730ab7755d4115d;hpb=1bb3da557a983d00ec3ff37ff94152e6f109ee4a;p=hbs.git diff --git a/bs/bsdoc.cpp b/bs/bsdoc.cpp index 3d32cad..c65903b 100644 --- a/bs/bsdoc.cpp +++ b/bs/bsdoc.cpp @@ -17,6 +17,8 @@ #include "bsdoc.h" +using namespace std; + BSDoc::BSDoc() { modified = false; @@ -50,3 +52,51 @@ bool BSDoc::isModified() const { return modified; } + +/////////////////////////////////////////////////////////////////////////// +// + +int BSDoc::newBattle(QString name) +{ + m_Battles[name]["Friendly"]["Home Planet"]; + m_Battles[name]["Hostile"]; + + modified = true; + emit documentChanged(); + return 0; +} + +///////////////////////////////////////////////////////////////////////// +// + +const std::map > >& BSDoc::battles() const +{ + return m_Battles; +} + +////////////////////////////////////////////////////////////////////////// +// +Fleet BSDoc::specificFleet(QString battle, QString group, QString fleet) const +{ + for (map > >::const_iterator i = m_Battles.begin(); i != m_Battles.end(); ++i) + { + if (i->first == battle) + { + for (map >::const_iterator j = i->second.begin(); j != i->second.end(); j++) + { + if (j->first == group) + { + for (map::const_iterator k = j->second.begin(); k != j->second.end(); ++k) + { + if (k->first == fleet) + { + return k->second; + } + } + } + } + } + } +} + +