]> ruin.nu Git - hbs.git/blobdiff - bs/fleet.h
Fixed a bug in the shipstealing code..
[hbs.git] / bs / fleet.h
index 0a0db411d35e263ed773e1a90f9e80aac65f0155..f632093bd51c8e766c2cd00ecc40f3b85a4e0424 100644 (file)
@@ -106,6 +106,11 @@ public:
         * other is hardly used other than inside the engine.
         */
        void setFleet(std::string unittype, int number, int tick = 0);
+
+       void addFleet(std::string unittype, int number, int tick = 0);
+
+       void addFleet(std::map<std::string, int> units, int tick = 0);
+
        /**Returns the numbers of units fo a specific type at a specific tick.
         * \param unittype The shipname, as a std string
         * \param tick The tick you want to look at, tick 0 (before battle) is default
@@ -120,7 +125,17 @@ public:
         * \return returns the number of units that params specifies.
         */
        int freeFleet(std:: string unittype, int tick = 0);
+
+       /** This function is used to see how many ships of a specific type got
+        * blocked at a specific tick.
+        * \param unittype the name of the unittype
+        * \param tick what tick you want to look at
+        * \return the number of ships that got blocked at the specified tick.
+        */
+       int blockedFleet(std::string unittype, int tick = 0);
        
+       void setBlockedFleet(std::string unittype, int number, int tick = 0);
+
        /** This function takes the vector with fleets and adds all their units of the
         * specific tick to the current fleet's first tick. Main usage is for battle
         * calculations.
@@ -211,6 +226,14 @@ public:
         */
        int resource(std::string type, int tick = 0)const;
        
+       void resetResources();
+
+       /** This function tells how many ticks the fleet stays at it's target.
+        * \returns the number of ticks as an int.
+        */
+       int stays() const;
+       void setStays(int ticks);
+
        /** This is a little more advanced function. It makes a a number of units
         * of a specific unittype shoot at the current fleet and calculates the 
         * losses.
@@ -241,12 +264,19 @@ public:
         */
        void takeEMP(std::string unittype, int number);
 
+       void calculateLostStealships(std::string unittype, std::map<std::string, int> stolen, int tick = 1);
+
+       void distributeStolenShips(std::map<std::string, std::map<std::string, int> > stolen, std::vector<Fleet*> fleets, int tick = 0);
+
+       void calculateSalvage();
        /** This function prints out all the ships in the fleet to stderr,
         * mainly used for debugging.
         */
        void printFleet();
 
+       void resetTicks();
        //static functions
+       //
        /** This function is used to set the different races used.
         * \param races a Simple RaceList which holds all the info
         */
@@ -271,13 +301,14 @@ public:
 protected:
 
 
-       std::string     m_sName;
-       std::string     m_sRace;
-       int         m_iETA;
-       FleetList       m_Fleet;
-       FleetList       m_BlockedFleet;
+       std::string  m_sName;
+       std::string      m_sRace;
+       int          m_iETA;
+       FleetList    m_Fleet;
+       FleetList    m_BlockedFleet;
        ResourceList m_Resources;
-       ArmorList       m_Armor;
+       ArmorList        m_Armor;
+       int          m_iStays;