//allFriends.printFleet();
allFriends.distributeLossesGains(friends, tick);
//allFriends.printFleet();
allFriends.distributeLossesGains(friends, tick);
allHostiles.distributeLossesGains(hostiles, tick);
allHostiles.distributeCappedRoids(hostiles, tick);
allHostiles.distributeLossesGains(hostiles, tick);
allHostiles.distributeCappedRoids(hostiles, tick);
setRoids(i->first, roids(i->first, 1), tick);*/
}
setRoids(i->first, roids(i->first, 1), tick);*/
}
for (RoidList::iterator i = m_Roids.begin(); i != m_Roids.end(); ++i)
{
for (vector<int>::iterator j = i->second.begin(); j != i->second.end(); ++j)
for (RoidList::iterator i = m_Roids.begin(); i != m_Roids.end(); ++i)
{
for (vector<int>::iterator j = i->second.begin(); j != i->second.end(); ++j)
-void Planet::calcOneTick(Planet* friendly, Fleet* hostile, std::map<std::string, std::map<std::string, int> >& stealfriendly, std::map<std::string, std::map<std::string, int> >& stealhostile, int tick = 1)
+void Planet::calcOneTick(Planet* friendly, Fleet* hostile, std::map<std::string, std::map<std::string, int> >& stealfriendly, std::map<std::string, std::map<std::string, int> >& stealhostile, int tick)
{
if (planetScore(tick - 1) > 0)
setCapping(float(planetScore(tick - 1)) / hostile->score() / 10, tick);
else
setCapping(0, tick);
{
if (planetScore(tick - 1) > 0)
setCapping(float(planetScore(tick - 1)) / hostile->score() / 10, tick);
else
setCapping(0, tick);
map<int, string> unitsinit; // order units after their ininitiative
for (UnitList::iterator i = s_Units.begin(); i != s_Units.end(); ++i)
unitsinit[i->second.initiative()] = i->first;
map<int, string> unitsinit; // order units after their ininitiative
for (UnitList::iterator i = s_Units.begin(); i != s_Units.end(); ++i)
unitsinit[i->second.initiative()] = i->first;
for (map<int, string>::iterator i = unitsinit.begin(); i != unitsinit.end(); ++i)
{
Fleet* hostiletemp = new Fleet(*hostile);
Planet* friendlytemp = new Planet(*friendly);
string unittype = i->second;
for (map<int, string>::iterator i = unitsinit.begin(); i != unitsinit.end(); ++i)
{
Fleet* hostiletemp = new Fleet(*hostile);
Planet* friendlytemp = new Planet(*friendly);
string unittype = i->second;
- hostiletemp->takeEMP(unittype, friendly->freeFleet(unittype, 1));
- friendlytemp->takeEMP(unittype, hostile->freeFleet(unittype, 1));
+ hostiletemp->takeEMP(unittype, freefriendly, friendlyhits);
+ friendlytemp->takeEMP(unittype, freehostile, hostilehits);
- hostiletemp->takeShoot(unittype, friendly->freeFleet(unittype, 1), stealfriendly[unittype]);
- friendlytemp->takeShoot(unittype, hostile->freeFleet(unittype, 1), stealhostile[unittype]);
+ hostiletemp->takeShoot(unittype, freefriendly, stealfriendly[unittype]);
+ friendlytemp->takeShoot(unittype, freehostile, stealhostile[unittype]);
+
+ friendlyhits = stealfriendly[unittype];
+ hostilehits = stealhostile[unittype];
friendlytemp->calculateLostStealships(unittype, stealfriendly[unittype], 1);
hostiletemp->calculateLostStealships(unittype, stealhostile[unittype], 1);
}
else
{
friendlytemp->calculateLostStealships(unittype, stealfriendly[unittype], 1);
hostiletemp->calculateLostStealships(unittype, stealhostile[unittype], 1);
}
else
{
- map<string, int> temp;
- hostiletemp->takeShoot(unittype, friendly->freeFleet(unittype, 1), temp);
- friendlytemp->takeShoot(unittype, hostile->freeFleet(unittype, 1), temp);
+ hostiletemp->takeShoot(unittype, freefriendly, friendlyhits);
+ friendlytemp->takeShoot(unittype, freehostile, hostilehits);
if (s_Units[unittype].type() == "Pod")
{
//FIXME: Prolly need to recode the whole capping section for r7, due to multiple pods thingy
if (s_Units[unittype].type() == "Pod")
{
//FIXME: Prolly need to recode the whole capping section for r7, due to multiple pods thingy
- int caproids = capping(tick) * roids(roid->first, tick - 1);
- int freepods = hostiletemp->freeFleet(unittype, 1);
+ int caproids = int(capping(tick) * roids(roid->first, tick - 1));
+ //int freepods = hostiletemp->freeFleet(unittype, 1);
cerr << caproids << " roids stolen\n";
takeRoids(roid->first, caproids, tick);
cerr << caproids << " roids stolen\n";
takeRoids(roid->first, caproids, tick);
//FIXME: Going to move this to the distribute roids section instead.. Not really move, I'll keep this, but "regenerate" the pods in the distribute ships function.
hostiletemp->killFleet(unittype, caproids, 1);
pods[unittype] += caproids;
//int totroids = caproids + hostiletemp->resource(roid->first, 0);
//FIXME: Going to move this to the distribute roids section instead.. Not really move, I'll keep this, but "regenerate" the pods in the distribute ships function.
hostiletemp->killFleet(unittype, caproids, 1);
pods[unittype] += caproids;
//int totroids = caproids + hostiletemp->resource(roid->first, 0);
+ m_Report[tick][init]["Friendly"][unittype] = friendlyhits;
+ m_Report[tick][init]["Friendly"][unittype]["000"] = freefriendly;
+ m_Report[tick][init]["Hostile"][unittype] = hostilehits;
+ m_Report[tick][init]["Hostile"][unittype]["000"] = freehostile;