]> ruin.nu Git - hbs.git/blobdiff - bs/planet.h
started to work on the battle report.. almost there =)
[hbs.git] / bs / planet.h
index 2d513618342c26c44253178712b3bea0cfabbcd7..78c00b94531305a2a144227f363b604b821b79fe 100644 (file)
@@ -21,6 +21,7 @@
 #include "fleet.h"
 
 typedef std::map<std::string, std::vector<int> > RoidList;
+typedef std::map<int, std::map<int, std::map<std::string, std::map<std::string, std::map<std::string, int> > > > > ReportList;
 
 /**This class is the implementation of a planet.
  *
@@ -33,25 +34,82 @@ typedef std::map<std::string, std::vector<int> > RoidList;
  * planets aren't available in this game).
   *@author Michael Andreen
   */
-
-class Planet : public Fleet  {
+class Planet : public Fleet  
+{
 public: 
        Planet();
        virtual ~Planet();
 
-       unsigned planetScore() const;
-       void setPlanetScore(unsigned i);
+       /** The score for the current planet. 
+        * \returns the score as an unsigned int. 
+        * \todo add a param to specify what tick to use.
+        */
+       unsigned planetScore(int tick = 0) const;
+
+       /** Sets the score for the current fleet. 
+        * \param score this param is a unsigned int holding the score
+        * \todo add a param to specify what tick to use.
+        */
+       void setPlanetScore(unsigned score, int tick = 0);
+
+       /** Adds score to the current fleet. 
+        * \param score this param is a unsigned int holding the score
+        * \todo add a param to specify what tick to use.
+        */
+       void addPlanetScore(unsigned score, int tick = 0);
 
+       /** This function is used to get the number of roids of a specific type.
+        * \param type the for this roid (for pa: metal, crystal, eonium, uninit)
+        * \param tick what tick you want to get the number from.
+        * \returns the number of the specified type at the specified tick
+        */
        int roids(std::string type, int tick = 0) const;
-       void setRoids(std::string type, int number);
+       /**     Used to set the number of roid at a specific tick
+        * \param type the for this roid (for pa: metal, crystal, eonium, uninit)
+        * \param tick what tick you want to get the number from.
+        * \param number the number of roids you want to set.
+        */
+       void setRoids(std::string type, int number, int tick = 0);
+       /** This function is used to remove a specific number of roids without
+        * knowing how many the total is.
+        * \param type the for this roid (for pa: metal, crystal, eonium, uninit)
+        * \param tick what tick you want to get the number from.
+        * \param number the number of roids you want to take.
+        */
+       void takeRoids(std::string type, int number, int tick = 0);
 
+       /** This function is used to start the batlle calculations on the current
+        * planet. It doesn't touch tick 0 on any of the fleet that fight in the
+        * battle, but all other ticks might be touched.
+        * \param friendly a vector with pointers to all friendly Fleet:s.
+        * \param hostile a vector with pointers to all hostile Fleet:s.
+        */
        void runBattle(std::vector<Fleet*> friendly, std::vector<Fleet*> hostile);
 
+       void calculateScoreLoss(std::vector<Fleet*> friendly, int tick = 1);
+
+       float capping(int tick = 0);
+       void setCapping(float capping, int tick = 0);
+
+       ReportList report() const;
+
 protected:
-       void calcOneTick(Planet* friendly, Fleet* Hostile, std::map<std::string, std::map<std::string, int> >& stealfriendly, std::map<std::string, std::map<std::string, int> >&  stealhostile );
+       /** This function is used to start the calculations of a single tick of the
+        * battle on the current planet. It's protected because it's not really meant
+        * to be used outside runBattle(), but I might reconsider it.
+        * \param friendly a pointer to the friendly fleet. 
+        * \param hostile a pointer to the hostile fleet
+        * \param stealfriendly a container used to store all the stolen units the
+        * friendly side took this tick.
+        * \param stealhostile a cointainer used to store all the stole units the 
+        * hostile side took this tick.
+        */
+       void calcOneTick(Planet* friendly, Fleet* hostile, std::map<std::string, std::map<std::string, int> >& stealfriendly, std::map<std::string, std::map<std::string, int> >&  stealhostile, int tick = 1);
 
-       unsigned m_iScore;
+       std::vector <unsigned> m_Score;
+       std::vector <float> m_Capping;
        RoidList m_Roids;
+       ReportList m_Report;
        
 };