for (map<string, int*>::iterator j = targets.begin(); j != targets.end(); ++j)
{
- int maxguns = (*j->second)/total * guns;
+ float maxguns = float((*j->second))/total * guns;
cerr << "Now shooting at target: " << j->first << endl;
double k = maxguns;
{
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;
}
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);
}
}
}