]> ruin.nu Git - hbs.git/blobdiff - bs/fleet.cpp
now distributes and shows captured roids..
[hbs.git] / bs / fleet.cpp
index 8ca9c7e2c4c366d91a73b507f89bdfb1c1d3fd16..545ffa2e43d094fe09a3490d85d13dacebc29e49 100644 (file)
@@ -529,8 +529,13 @@ void Fleet::addResource(std::string type, int number, int tick = 0)
 {
 
        int ticks = m_Resources[type].size();
+       int latest = 0;
+
+       if (ticks > 0)
+               latest = m_Resources[type][ticks - 1];
+
        for (int i = ticks; i <= tick; ++i)
-               m_Resources[type].push_back(number);
+               m_Resources[type].push_back(latest);
        m_Resources[type][tick] += number;
 }
 
@@ -630,7 +635,7 @@ void Fleet::distributeCappedRoids(std::vector<Fleet*> fleets, int tick = 0)
                        int lost =  totcapped * part;
 
                        cerr << (*j)->name() << " gaining " << lost << " " << res  << " since it's " << part * 100 << "% of the whole score, and it had : " << fl1 << " score last tick.. compared to fleet total of: " << score(0) <<  endl;
-                       (*j)->setResource(res, (*j)->resource(res, tick - 1) + lost, tick);
+                       (*j)->addResource(res, lost, tick);
                }
        }
 }