X-Git-Url: https://ruin.nu/git/?p=hbs.git;a=blobdiff_plain;f=bs%2Ffleet.cpp;h=545ffa2e43d094fe09a3490d85d13dacebc29e49;hp=8ca9c7e2c4c366d91a73b507f89bdfb1c1d3fd16;hb=0ffaa1b7fc0af8df728154f0b6e8bf1b77555514;hpb=a61c6ecdc3dd55f06e06cc1a295b1b4fc2830314 diff --git a/bs/fleet.cpp b/bs/fleet.cpp index 8ca9c7e..545ffa2 100644 --- a/bs/fleet.cpp +++ b/bs/fleet.cpp @@ -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 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); } } }