]> ruin.nu Git - hbs.git/blobdiff - bs/bsdoc.h
adding, removing and chaning fleets now works.
[hbs.git] / bs / bsdoc.h
index eac45f40432b1a62ee0865ba64d3a8961d07f9a0..bcfcfd08e450123c32a0aa6322d0280f3e06698a 100644 (file)
@@ -26,6 +26,7 @@
 // application specific includes
 #include "fleet.h"
 
+typedef std::map<QString, std::map<QString, std::map<QString, Fleet*> > > BattleList;
 //! The document class
 /** This class is holding all the data, handles the transportation of the
   * data to a couple of different mediums and informs users of the data
@@ -40,7 +41,7 @@ class BSDoc : public QObject
   Q_OBJECT
 
   public:
-    BSDoc();
+       BSDoc();
     ~BSDoc();
     void newDoc();
     bool save();
@@ -58,15 +59,37 @@ class BSDoc : public QObject
         * change it.
         * \todo remove this, and replace it with a better more closed interface.
         */
-       std::map<QString, std::map<QString, std::map<QString, Fleet> > >& Battles();
+       const BattleList& battles() const;
 
+       
+       /**Looks for the fleet with the specified name, in the specified group in the
+        * specified battle.
+        * \return Returns '\0' (NULL) if the fleet isn't found, if it is found it
+        * returns a const pointer to the fleet.
+        */
+       const Fleet* specificFleet(QString battle, QString group, QString fleet) const;
+
+       void changeFleet(QString battle, QString group, QString fleet, const Fleet* fl);
+
+       void newFleet(QString battle, QString group, QString fleet, Fleet* fl);
+
+       void removeFleet(QString battle, QString group, QString fleet);
+
+       void runBattleSimulation();
   signals:
     void documentChanged();
 
   protected:
     bool modified;
 
-       std::map<QString, std::map<QString, std::map<QString, Fleet> > > m_Battles;
+       /**This is the main datastructure of the battlecalc, it's more or less the
+        * core that everything else works around. A short explanation of the fields:
+        * -# The name of the battle (usually coordinates)
+        * -# The name of the group (ie. Friendly/Hostile)
+        * -# The fleetname (Home Planet, coordinates, irc nicks and so on)
+        * - and in the end you got the actual Fleet object with it's data.
+        */
+        BattleList m_Battles;
 };
 
 #endif