]> ruin.nu Git - hbs.git/commitdiff
Started the work to split up the pods better..
authorMichael Andreen <harv@ruin.nu>
Wed, 24 Apr 2002 21:31:11 +0000 (21:31 +0000)
committerMichael Andreen <harv@ruin.nu>
Wed, 24 Apr 2002 21:31:11 +0000 (21:31 +0000)
bs/bsdoc.cpp
bs/fleet.cpp
bs/fleet.h
bs/planet.cpp
bs/planet.h

index aa093e896cf625eda216db6308e6602f70362bd5..11042b73cccf8eca3f063286fc74db110935b539 100644 (file)
@@ -70,6 +70,7 @@ int BSDoc::newBattle(QString name)
        m_Battles[name]["Friendly"]["Home Fleet"]->setName("Home Fleet");
        m_Battles[name]["Friendly"]["Home Fleet"]->setRace("Terran");
        m_Battles[name]["Hostile"]["Evil guy"]->setName("Evil guy");
        m_Battles[name]["Friendly"]["Home Fleet"]->setName("Home Fleet");
        m_Battles[name]["Friendly"]["Home Fleet"]->setRace("Terran");
        m_Battles[name]["Hostile"]["Evil guy"]->setName("Evil guy");
+       m_Battles[name]["Hostile"]["Evil guy"]->setETA(1);
 
        modified = true;
        emit documentChanged();
 
        modified = true;
        emit documentChanged();
index a15fba36788628798d041ce50c4745585d590737..13bafb7aa071ace95640bb0e84dca2840aeb3cef 100644 (file)
@@ -683,4 +683,12 @@ void Fleet::distributeCappedRoids(std::vector<Fleet*> fleets, int tick = 0)
        }
 }
 
        }
 }
 
-
+//////////////////////////////////////////////////////////////////////////
+//
+void Fleet::addPodsForLostRoids(int tick = 1)
+{
+       for (ResourceList::iterator i = m_Resources.begin(); i != m_Resources.end(); ++i)
+       {
+               setFleet("Astro Pod", fleet("Astro Pod", tick) + (resource(i->first, tick) - resource(i->first, tick - 1)), tick);
+       }
+}
index 770bf0652f4b46c060f57802116d222089d7e293..448d4de66bbfdadbb2634f0e3c96e3c4a9fd7b3b 100644 (file)
@@ -164,6 +164,8 @@ public:
         */
        void distributeCappedRoids(std::vector<Fleet*> fleets, int tick = 0);
 
         */
        void distributeCappedRoids(std::vector<Fleet*> fleets, int tick = 0);
 
+       void addPodsForLostRoids(int tick = 1);
+
        /** Checks through the vector with fleets to see who's in time for the
         * specified tick and staying long enough so they're not too early.
         * \param fleets a vector with Fleet pointers to use for the calculations
        /** Checks through the vector with fleets to see who's in time for the
         * specified tick and staying long enough so they're not too early.
         * \param fleets a vector with Fleet pointers to use for the calculations
index 75387030ab2809822f3e135e58f224d20ea41ff7..3c4404f800d4dee61ae9a968b6015f8eb27dde4a 100644 (file)
@@ -187,6 +187,8 @@ void Planet::runBattle(std::vector<Fleet*> friendly, std::vector<Fleet*> hostile
                //allFriends.printFleet();
 
                allFriends.distributeLossesGains(friends, tick);
                //allFriends.printFleet();
 
                allFriends.distributeLossesGains(friends, tick);
+
+               allHostiles.addPodsForLostRoids();
                allHostiles.distributeLossesGains(hostiles, tick);
                allHostiles.distributeCappedRoids(hostiles, tick);
 
                allHostiles.distributeLossesGains(hostiles, tick);
                allHostiles.distributeCappedRoids(hostiles, tick);
 
@@ -205,7 +207,7 @@ void Planet::runBattle(std::vector<Fleet*> friendly, std::vector<Fleet*> hostile
 
 //////////////////////////////////////////////////////////////////////////
 //
 
 //////////////////////////////////////////////////////////////////////////
 //
-void Planet::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 = 0)
+void Planet::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)
 {
        map<int, string> unitsinit; // order units after their ininitiative
        for (UnitList::iterator i = s_Units.begin(); i != s_Units.end(); ++i)
 {
        map<int, string> unitsinit; // order units after their ininitiative
        for (UnitList::iterator i = s_Units.begin(); i != s_Units.end(); ++i)
index 093c7f106affe4b52f40f352d5c44bf809e507ef..95b38936f0ad09da634ecf38c778bbccc188b541 100644 (file)
@@ -101,7 +101,7 @@ protected:
         * \param stealhostile a cointainer used to store all the stole units the 
         * hostile 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 = 0);
+       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);
 
        std::vector <unsigned> m_Score;
        std::vector <float> m_Capping;
 
        std::vector <unsigned> m_Score;
        std::vector <float> m_Capping;