]> ruin.nu Git - hbs.git/blobdiff - bs/fleet.cpp
The work on the combat algorithm is going forward, nothing worth compiling yet though.
[hbs.git] / bs / fleet.cpp
index 00fb66b7e7005e1d590644d139f6624d4804c63d..97be5aaf867286b7e24d8d178dac634eb9667396 100644 (file)
@@ -170,7 +170,9 @@ unsigned Fleet::score(int tick = 0) const
 
        for (FleetList::const_iterator i = m_Fleet.begin(); i != m_Fleet.end(); ++i)
        {
-               tot_score += i->second[tick] * s_Units[i->first].totRes() / 10;
+                 if (i->second.size() >= tick)
+                               break;
+                       tot_score += i->second[tick] * s_Units[i->first].totRes() / 10;
        }
 
        return tot_score;
@@ -198,4 +200,25 @@ int         Fleet::fleet(string unittype, int tick = 0)
        return m_Fleet[unittype][tick];
 }
 
-       
+//////////////////////////////////////////////////////////////////////////
+//
+void Fleet::addToThis(std::vector<Fleet*> fleets, int tick = 0)
+{
+       for (UnitList::iterator i = s_Units.begin();  i != s_Units.end(); ++i)
+       {
+               if (m_Fleet[i->first].size() == 0)
+                               m_Fleet[i->first].push_back(0);
+
+               for (vector<Fleet*>::iterator j = fleets.begin(); j != fleets.end(); ++j)
+               {
+               // FIXTHIS!!    m_Fleet[i->first][0] += j->fleet(i->first, tick);
+               }
+       }
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+void distributeLossesGains(std::vector<Fleet*> fleets, int tick = 0)
+{
+}
+