]> ruin.nu Git - hbs.git/blobdiff - bs/planet.cpp
fixed a bug with non shooting pds...
[hbs.git] / bs / planet.cpp
index 443b3b13695a31c2ba7d71854750acfcc2bd3241..0da7d97a30ddc30b733ec8069470021f1472c0c1 100644 (file)
@@ -171,7 +171,7 @@ void Planet::calcOneTick(Planet* friendly, Fleet* hostile, std::map<std::string,
                
                string unittype = i->second;
 
-               //cerr << "Initiative: " << s_Units[unittype].initiative() << " with unit: " << unittype << endl;
+               cerr << "Initiative: " << s_Units[unittype].initiative() << " with unit: " << unittype << endl;
 
                if (s_Units[unittype].type() == "EMP")  
                {
@@ -192,38 +192,41 @@ void Planet::calcOneTick(Planet* friendly, Fleet* hostile, std::map<std::string,
 
                if (s_Units[unittype].type() == "Pod")
                {
-                       if (m_iScore <= 0) break;
-                       float capping = float(m_iScore) / hostile->score() /  10;
-                       
-                       cerr << "Capping is: " << capping << endl;
-
-                       if (capping > 0.15)
-                               capping = 0.15;
-                       if (capping <= 0)
-                               break;
-
-                       for (RoidList::iterator roid = m_Roids.begin(); roid != m_Roids.end(); ++roid)
+                       if (m_iScore > 0)
                        {
-                               int caproids = capping * roids(roid->first, tick - 1);
-                               int freepods = hostiletemp->freeFleet(unittype, 1);
-
-                               cerr << "Possible to steal " << caproids << " " << roid->first << " roids\n";
-                               cerr << freepods << " free pods available\n";
-                               
-                               if (freepods <= 0)
-                                       break;
-                               if (freepods < caproids)
-                                       caproids = freepods;
-
-                               cerr << caproids << " roids stolen\n";
-                                       
-                               takeRoids(roid->first, caproids, tick);
-
-                               hostiletemp->killFleet(unittype, caproids, 1);
-                               int totroids = caproids + hostiletemp->resource(roid->first, 0);
-                               hostiletemp->setResource(roid->first, totroids, 1);
-                               
-                               cerr << totroids << " stolen " << roid->first << " roids\n";
+                               float capping = float(m_iScore) / hostile->score() /  10;
+                       
+                               cerr << "Capping is: " << capping << endl;
+       
+                               if (capping > 0.15)
+                                       capping = 0.15;
+                               if (capping > 0)
+                               {
+                                       for (RoidList::iterator roid = m_Roids.begin(); roid != m_Roids.end(); ++roid)
+                                       {
+                                               int caproids = capping * roids(roid->first, tick - 1);
+                                               int freepods = hostiletemp->freeFleet(unittype, 1);
+               
+                                               cerr << "Possible to steal " << caproids << " " << roid->first << " roids\n";
+                                               cerr << freepods << " free pods available\n";
+                                               
+                                               if (freepods <= 0)
+                                                       break;
+                                               if (freepods < caproids)
+                                                       caproids = freepods;
+               
+                                               cerr << caproids << " roids stolen\n";
+                                                       
+                                               takeRoids(roid->first, caproids, tick);
+               
+                                               //FIXME: Going to move this to the distribute roids section instead..
+                                               hostiletemp->killFleet(unittype, caproids, 1);
+                                               int totroids = caproids + hostiletemp->resource(roid->first, 0);
+                                               hostiletemp->setResource(roid->first, totroids, 1);
+                                               
+                                               cerr << totroids << " stolen " << roid->first << " roids\n";
+                                       }
+                               }
                        }
                }