From: Michael Andreen Date: Wed, 24 Apr 2002 21:31:11 +0000 (+0000) Subject: Started the work to split up the pods better.. X-Git-Url: https://ruin.nu/git/?p=hbs.git;a=commitdiff_plain;h=45577c33bdaab669fd787a0411996d506307708b Started the work to split up the pods better.. --- diff --git a/bs/bsdoc.cpp b/bs/bsdoc.cpp index aa093e8..11042b7 100644 --- a/bs/bsdoc.cpp +++ b/bs/bsdoc.cpp @@ -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]["Hostile"]["Evil guy"]->setETA(1); modified = true; emit documentChanged(); diff --git a/bs/fleet.cpp b/bs/fleet.cpp index a15fba3..13bafb7 100644 --- a/bs/fleet.cpp +++ b/bs/fleet.cpp @@ -683,4 +683,12 @@ void Fleet::distributeCappedRoids(std::vector 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); + } +} diff --git a/bs/fleet.h b/bs/fleet.h index 770bf06..448d4de 100644 --- a/bs/fleet.h +++ b/bs/fleet.h @@ -164,6 +164,8 @@ public: */ void distributeCappedRoids(std::vector 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 diff --git a/bs/planet.cpp b/bs/planet.cpp index 7538703..3c4404f 100644 --- a/bs/planet.cpp +++ b/bs/planet.cpp @@ -187,6 +187,8 @@ void Planet::runBattle(std::vector friendly, std::vector hostile //allFriends.printFleet(); allFriends.distributeLossesGains(friends, tick); + + allHostiles.addPodsForLostRoids(); allHostiles.distributeLossesGains(hostiles, tick); allHostiles.distributeCappedRoids(hostiles, tick); @@ -205,7 +207,7 @@ void Planet::runBattle(std::vector friendly, std::vector hostile ////////////////////////////////////////////////////////////////////////// // -void Planet::calcOneTick(Planet* friendly, Fleet* hostile, std::map >& stealfriendly, std::map >& stealhostile, int tick = 0) +void Planet::calcOneTick(Planet* friendly, Fleet* hostile, std::map >& stealfriendly, std::map >& stealhostile, int tick = 1) { map unitsinit; // order units after their ininitiative for (UnitList::iterator i = s_Units.begin(); i != s_Units.end(); ++i) diff --git a/bs/planet.h b/bs/planet.h index 093c7f1..95b3893 100644 --- a/bs/planet.h +++ b/bs/planet.h @@ -101,7 +101,7 @@ protected: * \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 >& stealfriendly, std::map >& stealhostile, int tick = 0); + void calcOneTick(Planet* friendly, Fleet* hostile, std::map >& stealfriendly, std::map >& stealhostile, int tick = 1); std::vector m_Score; std::vector m_Capping;