]> ruin.nu Git - hbs.git/blob - bs/unittype.h
cbb73bac9ebdd4dfd2f21791bd1c1554d4b4ec1b
[hbs.git] / bs / unittype.h
1 /***************************************************************************
2                           unittype.h  -  description
3                              -------------------
4     begin                : Tue Jan 22 2002
5     copyright            : (C) 2002 by Michael Andreen
6     email                : whale@linux.nu
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
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.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 #ifndef UNITTYPE_H
19 #define UNITTYPE_H
20
21 #include <map>
22 #include <vector>
23 #include <string>
24
25 //!This class contains a unittype, with all it's attributes + the number you got.
26 //
27 /**This class contains a unittype, with all it's attributes + the number you got.
28  * Maybe this actually should be a struct, since this class doen't have much to do, since i want it to be as generic as possible.  
29  * It got some data need need to be taken care of which makes me put it as a class. 
30  * \todo need to add some more constructors.. 
31   *@author Michael Andreen <whale@linux.nu>
32   *@see Fleet
33   */
34
35 class UnitType 
36 {
37 public: 
38         UnitType();
39         ~UnitType();
40         
41         /*! This function sets the name for this unittype (ie. interceptor) */
42         void setName(std::string sName);
43         /** Returns the name of this unittype */
44         std::string Name() const;
45
46         /** This functions sets which race this unittype is, the race is represented with a integer. */
47         void setRace(int iRace);
48         /** Returns the race this unittype belongs to*/
49         int race() const;
50
51         /** Sets the class for the unittype, it's represented as a integer */
52         void setUnitClass(std::string sClass);
53         std::string unitClass() const;
54
55         /** Sets the classes that this unittype targets. a vector is used. */
56         void setTarget(std::vector<std::string> Target);
57         /** This function adds a target class to the end of the target list. */
58         void addTarget(std::string target);
59         /** This function inserts a target class into the target list. The default is in the beginning.
60          * \param iTarget an integer that represents the target's class. 
61          * \param index where to place the target. 0 being the default and first place. */
62         void insTarget(std::string iTarget, int index = 0);
63         /** Returns all targets from the target list */
64         std::vector<std::string> target() const;
65         /** Returns a specific target 
66          * \param index An index value that represents the target. 0 being the first*/
67         std::string     target(int index) const;
68
69         /** Sets the initiatve, the lower it is the earlier the unit shots */
70         void setInitiative(int iInit);
71         int      initiative() const;
72
73         /** Sets the agility, the higher it is the harder it is to hit the unit */
74         void setAgility (int iAgil);
75         int  agility() const;
76
77         /** Sets the weaponspeed.. just a simple integer that shows how good it is at hitting things */
78         void setWeaponSpeed(int iWPSP);
79         int  weaponSpeed() const;
80
81         /** Sets the number of guns. */
82         void setGuns(int iGuns);
83         int guns() const;
84
85         /** Sets the how much power the guns have.. or in other words: the damage they do. */
86         void setPower(int iPower);
87         int  power() const;
88
89         /** Sets the armor, this is how much damage the unittype can take before it's destroyed */
90         void setArmor(int iArmor);
91         int  armor() const;
92
93         /** Sets the emp resistance, the lower value the easier it is to block it */
94         void setEMP(int iEMP);
95         int  EMP() const;
96
97         /** Sets the resource cost for this unittype. Used for example for score calculation and so on. */
98         void setTotalResources(int iTR);
99         /** Returns the number of total resources this unittype cost. */
100         int totRes() const;
101
102         /** Sets the fuelcost for this unittype */
103         void setFuel(int iFuel);
104         /** Returns the fuelcost */
105         int  fuel() const;
106
107         /** Sets the ETA, the speed in a sort of inverted form.. the lower ETA, the faster is the unit */
108         void setETA(int iETA);
109         int  ETA() const; 
110
111         /** Sets the type of the unit. What the types do must be specified in the real battle engine (Fleet) though.
112          * \param iType An integer to symbolise the type. */
113         void setType(std::string type);
114         /** What type of ship this is. */
115         std::string  type() const;      
116
117 protected:
118         std::string             m_sName;
119         int                     m_iRace;            //!< Not really the race, but an indiaction on what race can use it.. 
120         std::string     m_sClass;
121         std::vector<std::string>        m_vTarget;
122         int                     m_iInitiative;
123         int                     m_iAgility;
124         int                     m_iWeaponSpeed;
125         int                     m_iGuns;
126         int                     m_iPower;
127         int                     m_iArmor;
128         int                     m_iEMP;
129         int                     m_iTotalResources;
130         std::string     m_sType;            //!< normal,emp,cloak,steal,pod
131         int                     m_iETA;
132         int                     m_iFuel;
133 };
134
135 #endif