s_Units = units;
- /*
+
for (UnitList::iterator i = s_Units.begin(); i != s_Units.end(); i++)
{
- cerr << s_Units[(*i).first].Name() << "\t\t"
- << s_Units[(*i).first].race() <<"\t"
- << s_Units[(*i).first].unitClass() << "\t"
- << s_Units[(*i).first].target(0) << "\t"
- << s_Units[(*i).first].target(1) << "\t"
- << s_Units[(*i).first].target(2) << "\t"
- << s_Units[(*i).first].initiative() << "\t"
- << s_Units[(*i).first].agility() << "\t"
- << s_Units[(*i).first].weaponSpeed() << "\t"
- << s_Units[(*i).first].guns() << "\t"
- << s_Units[(*i).first].power() << "\t"
- << s_Units[(*i).first].armor() << "\t"
- << s_Units[(*i).first].EMP() << "\t"
- << s_Units[(*i).first].totRes() << "\t"
- << s_Units[(*i).first].fuel() << "\t"
- << s_Units[(*i).first].ETA() << "\t"
- << s_Units[(*i).first].type() << endl;
+ cerr << s_Units[(*i).first].Name() << "\t\t"
+/* << s_Units[(*i).first].race() <<"\t"
+ << s_Units[(*i).first].unitClass() << "\t"
+ << s_Units[(*i).first].target(0) << "\t"
+ << s_Units[(*i).first].target(1) << "\t"
+ << s_Units[(*i).first].target(2) << "\t"
+ << s_Units[(*i).first].initiative() << "\t"
+ << s_Units[(*i).first].agility() << "\t"
+ << s_Units[(*i).first].weaponSpeed() << "\t"
+ << s_Units[(*i).first].guns() << "\t"
+ << s_Units[(*i).first].power() << "\t"
+ << s_Units[(*i).first].armor() << "\t"
+ << s_Units[(*i).first].EMP() << "\t"
+ << s_Units[(*i).first].totRes() << "\t"
+ << s_Units[(*i).first].fuel() << "\t"
+ << s_Units[(*i).first].ETA() << "\t"*/
+ << s_Units[(*i).first].type() << endl;
}
- */
}
//////////////////////////////////////////////////////////////////////////
}
resetResources();
}
+
+//////////////////////////////////////////////////////////////////////////
+//
+int Fleet::freePodGuns(int tick)
+{
+ int guns = 0;
+ for (FleetList::const_iterator i = m_Fleet.begin(); i != m_Fleet.end(); ++i)
+ {
+ if (s_Units[i->first].type() == "Pod")
+ {
+ guns += freeFleet(i->first, tick) * s_Units[i->first].guns();
+ }
+ }
+ guns -= usedPodGuns(tick);
+ return guns;
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+int Fleet::usedPodGuns(int tick) const
+{
+ int ticks = m_UsedPodGuns.size();
+
+ if (ticks == 0)
+ return 0;
+
+ if (tick < 0)
+ return m_UsedPodGuns[0];
+
+ --ticks;
+
+ if (ticks < tick)
+ return m_UsedPodGuns[ticks];
+
+ return m_UsedPodGuns[tick];
+
+}
+
+//////////////////////////////////////////////////////////////////////////
+//
+void Fleet::usePodGuns(int tick, int guns)
+{
+ int ticks = m_UsedPodGuns.size();
+
+ for (int i = ticks; i <= tick; ++i)
+ {
+ m_UsedPodGuns.push_back(0);
+ }
+ m_UsedPodGuns[tick] += guns;
+}
void printFleet();
void resetTicks();
+
+ int freePodGuns(int tick = 0);
+
+ int usedPodGuns(int tick = 0) const;
+
+ void usePodGuns(int tick = 0, int guns = 1);
+
//static functions
//
/** This function is used to set the different races used.
protected:
- std::string m_sName;
- std::string m_sRace;
- int m_iETA;
- FleetList m_Fleet;
- FleetList m_BlockedFleet;
- ResourceList m_Resources;
- ArmorList m_Armor;
- int m_iStays;
+ std::string m_sName;
+ std::string m_sRace;
+ int m_iETA;
+ FleetList m_Fleet;
+ FleetList m_BlockedFleet;
+ ResourceList m_Resources;
+ ArmorList m_Armor;
+ int m_iStays;
+ std::vector<int> m_UsedPodGuns;
else
setCapping(0, tick);
- map<string, int> pods;
+ //FIXME: remove this line later.. map<string, int> 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<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 (RoidList::iterator roid = m_Roids.begin(); roid != m_Roids.end(); ++roid)
{
int caproids = capping(tick) * roids(roid->first, 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
*hostile = *hostiletemp;
delete hostiletemp;
}
- hostile->addFleet(pods, 1);
+ //hostile->addFleet(pods, 1);
}
Mesonic Cutter
5 Co Fi Co -- 45 25 40 1 3 50 100 400 400 800 0 0 PDS
Tachyon Beamer
-5 Fr Fr Co -- 46 20 35 1 10 75 100 750 750 1500 0 0PDS
+5 Fr Fr Co -- 46 20 35 1 10 75 100 750 750 1500 0 0 PDS
Pulse Cannon
5 De De Fr All 47 15 30 1 20 150 100 2250 2250 4000 0 0 PDS
Hadron Turret