1 /***************************************************************************
4 begin : Tue Jan 22 2002
5 copyright : (C) 2002 by Michael Andreen
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
22 #include <ext/hash_map>
27 template<typename T> class MyComp { public: bool operator()(T,T) { return false; } };
28 typedef std::map<std::string, std::vector<int> > FleetList;
29 typedef std::map<std::string, UnitType> UnitList;
30 typedef std::map<std::string, std::vector<int> > RaceList;
31 //!This is the engine for the whole battlesystem.
32 /**This is the engine for the whole battlesystem.
33 * One of the few parts that I plan make fully portable.
34 *\todo LOTS (I think ;)
35 *@author Michael Andreen
43 /**Sets the name that represents this fleet. Might be different a name
44 * like foobar or some coordinates like 1:1:1. The name doesn't have to be unique,
45 * since it's up to the rest of the program to handle that part.
48 void setName(std::string sName);
49 /**Returns the name of this fleet.
52 std::string name() const;
54 /**The race string decides what type of ships this fleet can have.
55 * The values must be feeded into this class.
56 * \param sRace This is just the name of the race. It's case-sensitive.
57 * \return If the race is available this function returns true, if not false is returned. The race is set in both cases though.
60 bool setRace(std::string sRace);
61 /**Just returns what race this fleet belongs to..
62 * \return The race, represented as a string.
65 std::string race() const;
67 std::vector<int> RacesAllowed() const;
69 /**Returns the total number of ships in this fleet
71 int numberOfShips() const;
73 /**Sets the estimated time of arrival. The time as a single integer,
74 * in relation to the current time. For example if the current time is
75 * 10, and the arrival is at 12, then the eta is 2.
78 /**Return the estimated time of arrival. It's counted from the current time (tick).
83 /**Returns the score. This value is the total resources spent on this fleet
85 * \param tick tells the function what tick you want the score from. 0 is
86 * initial score before the fleet has landed.
88 unsigned score(int tick = 0) const;
90 void setFleet(std::string unittype, int number);
91 int fleet(std::string unittype, int tick = 0);
93 static void setRaces(RaceList& races);
94 static void setUnits(UnitList& units);
96 static const RaceList& Races();
97 static const UnitList& Units();
105 static UnitList s_Units;
106 static RaceList s_Races;