]> ruin.nu Git - hbs.git/commitdiff
fixed a bug with non shooting pds...
authorMichael Andreen <harv@ruin.nu>
Fri, 12 Apr 2002 14:12:14 +0000 (14:12 +0000)
committerMichael Andreen <harv@ruin.nu>
Fri, 12 Apr 2002 14:12:14 +0000 (14:12 +0000)
bs/fleet.cpp
bs/planet.cpp
bs/ui/roidseditview.ui

index ed5efb9fd16881f48f127302f9a92f1437c68f95..b4e4335a4c71486f7db35b461765b8ba31566f16 100644 (file)
@@ -309,12 +309,11 @@ void Fleet::takeShoot(std::string unittype, int number, std::map<std::string, in
 
        float guns = s_Units[unittype].guns() * number;
 
-       cerr << number << " " << unittype << ": with " << guns << " guns\n";
        
        if (guns == 0)
                return;
 
-       cerr << unittype << ": with " << guns << " guns\n";
+       cerr << number << " " << unittype << ": with " << guns << " guns\n";
 
        float gunsleft = guns;
        for (int count = 0; count < 3; ++count)//vector<string>::iterator i = s_Units[unittype].target().begin(); i != s_Units[unittype].target().end(); ++i)
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";
+                                       }
+                               }
                        }
                }
 
index caa54900128e32731ad6e8f795e7bff180bbe531..4060ec417dd7d446d21806d2c578dfd1d7e16e8a 100644 (file)
@@ -22,6 +22,9 @@
     <property name="caption">
         <string>Roids</string>
     </property>
+    <property name="focusPolicy">
+        <enum>StrongFocus</enum>
+    </property>
     <property name="title">
         <string>Roids and Score</string>
     </property>