X-Git-Url: https://ruin.nu/git/?p=hbs.git;a=blobdiff_plain;f=bs%2Fplanet.cpp;h=fdeb78989e47e37cf2f7f09a34af04b139f57c31;hp=935c65d33fc228c3ab8c271e0a01708a435bcda9;hb=5b3a1459c35efe60c4255a5c50a1d74fdbe8e8eb;hpb=6d1c9d157f48157d2d4038121f9f1b6991c96f20 diff --git a/bs/planet.cpp b/bs/planet.cpp index 935c65d..fdeb789 100644 --- a/bs/planet.cpp +++ b/bs/planet.cpp @@ -228,10 +228,11 @@ void Planet::calcOneTick(Planet* friendly, Fleet* hostile, std::map pods; + //FIXME: remove this line later.. map pods; - //FIXME: Need to change this and allow multiple shiptypes with the same initiative. + //FIXME: Need to change this and allow multiple shiptypes with the same initiative. + //FIXME: Looks like I don't have to.. map unitsinit; // order units after their ininitiative for (UnitList::iterator i = s_Units.begin(); i != s_Units.end(); ++i) unitsinit[i->second.initiative()] = i->first; @@ -275,29 +276,39 @@ void Planet::calcOneTick(Planet* friendly, Fleet* hostile, std::mapfirst, tick - 1); - int freepods = hostiletemp->freeFleet(unittype, 1); + //int freepods = hostiletemp->freeFleet(unittype, 1); cerr << "Possible to steal " << caproids << " " << roid->first << " roids\n"; - cerr << freepods << " free pods available\n"; + cerr << hostiletemp->freePodGuns(1) << " free pod guns available\n"; - if (freepods <= 0) + if (hostiletemp->freePodGuns(1) <= 0) break; - if (freepods < caproids) - caproids = freepods; + if (hostiletemp->freePodGuns(1) < caproids) + caproids = hostiletemp->freePodGuns(1); cerr << caproids << " roids stolen\n"; takeRoids(roid->first, caproids, tick); + /*FIXME: REMOVE THIS BLOCK LATER //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); + */ hostiletemp->addResource(roid->first, caproids, 1); - + hostiletemp->usePodGuns(1, caproids); cerr << caproids << " stolen " << roid->first << " roids\n"; } } + + //FIXME: This is ugly and I want to change this, but as long as pods shoot last it works.. + *friendly = *friendlytemp; + delete friendlytemp; + *hostile = *hostiletemp; + delete hostiletemp; + + return; } //set the the objects so they point at the modified objects @@ -306,7 +317,7 @@ void Planet::calcOneTick(Planet* friendly, Fleet* hostile, std::mapaddFleet(pods, 1); + //hostile->addFleet(pods, 1); }