]> ruin.nu Git - hbs.git/blobdiff - bs/fleet.cpp
Started the work to split up the pods better..
[hbs.git] / bs / fleet.cpp
index 1cdc04fb9d1a3e49e022d2a8ca4fc68175f81090..13bafb7aa071ace95640bb0e84dca2840aeb3cef 100644 (file)
@@ -374,7 +374,8 @@ void Fleet::takeShoot(std::string unittype, int number, std::map<std::string, in
                                if (m_Fleet[j->first].size() == 0)
                                        continue;
 
-                               if (m_Fleet[j->first].size() == 1)
+
+                               if (m_Fleet[j->first].size() == 1 )
                                        m_Fleet[j->first].push_back(m_Fleet[j->first][0]);
 
                                //cerr << "Target is class: " << j->second.type() << endl;
@@ -478,6 +479,9 @@ void Fleet::takeEMP(std::string unittype, int number)
                                if (j->second.type() == "PDS")
                                        continue;
 
+                               if (freeFleet(j->first, 1) <= 0)
+                                       continue;
+
                                if (m_Fleet[j->first].size() == 0)
                                        continue;
 
@@ -514,7 +518,7 @@ void Fleet::takeEMP(std::string unittype, int number)
                                while (k > 0)   
                                {
 
-                                       if (*(j->second) <= 0)
+                                       if (*(j->second) <= blockedFleet(j->first, 1))
                                                break;
 
                                        int eres = s_Units[j->first].EMP();
@@ -679,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);
+       }
+}