]> ruin.nu Git - hbs.git/blob - bs/unittype.h
895b03de4595fbaaaf559f516cd095a59392be6e
[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.., maybe not.. 
31   *@author Michael Andreen <whale@linux.nu>
32   *\sa Fleet Planet
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
47          * \param iRace the race is represented with a integer.
48          */
49         void setRace(int iRace);
50         /** Used to get what type of race this is
51          * \returns returns the race as an integer
52          */
53         int race() const;
54
55         /** Sets the class for the unittype
56          * \param sClass the class represented as a string
57          */
58         void setUnitClass(std::string sClass);
59         /**  used to get what type of class this unit is
60          * \returns the class as a string
61          */
62         std::string unitClass() const;
63
64         /** Sets the classes that this unittype targets 
65          * \param Target the target list, as a vector of strings
66          */
67         void setTarget(std::vector<std::string> Target);
68
69         /** This function adds a target class to the end of the target list.
70          * \param target the target you want to add, as a string.
71          */
72         void addTarget(std::string target);
73
74         /** This function inserts a target class into the target list. The default is in the beginning.
75          * \param iTarget an integer that represents the target's class. 
76          * \param index where to place the target. 0 being the default and first place. 
77          */
78         void insTarget(std::string iTarget, int index = 0);
79         /** Used to get the full target list.
80          * \returns all targets as a vector of strings.
81          * */
82         std::vector<std::string> target() const;
83         /** Returns a specific target 
84          * \param index An index value that represents the target. 0 being the first
85          */
86         std::string     target(int index) const;
87
88         /** Used to set the initiatve, the lower it is the earlier the unit shots
89          * \param iInit the initiative as an int
90          */
91         void setInitiative(int iInit);
92         /** Used to get the initiative this unittype got, lower shots first.
93          * \returns the initiative as an int
94          */
95         int      initiative() const;
96
97         /** Sets the agility, the higher it is the harder it is to hit the unit */
98         void setAgility (int iAgil);
99         int  agility() const;
100
101         /** Sets the weaponspeed.. just a simple integer that shows how good it is at hitting things */
102         void setWeaponSpeed(int iWPSP);
103         int  weaponSpeed() const;
104
105         /** Sets the number of guns. */
106         void setGuns(int iGuns);
107         int guns() const;
108
109         /** Sets the how much power the guns have.. or in other words: the damage they do. */
110         void setPower(int iPower);
111         int  power() const;
112
113         /** Sets the armor, this is how much damage the unittype can take before it's destroyed */
114         void setArmor(int iArmor);
115         int  armor() const;
116
117         /** Sets the emp resistance, the lower value the easier it is to block it */
118         void setEMP(int iEMP);
119         int  EMP() const;
120
121         /** Sets the resource cost for this unittype. Used for example for score calculation and so on. */
122         void setTotalResources(int iTR);
123         /** Returns the number of total resources this unittype cost. */
124         int totRes() const;
125
126         /** Sets the fuelcost for this unittype */
127         void setFuel(int iFuel);
128         /** Returns the fuelcost */
129         int  fuel() const;
130
131         /** Sets the ETA, the speed in a sort of inverted form.. the lower ETA, the faster is the unit */
132         void setETA(int iETA);
133         int  ETA() const; 
134
135         /** Sets the type of the unit. What the types do must be specified in the real battle engine (Fleet) though.
136          * \param iType An integer to symbolise the type. */
137         void setType(std::string type);
138         /** What type of ship this is. */
139         std::string  type() const;      
140
141 protected:
142         std::string             m_sName;
143         int                     m_iRace;            //!< Not really the race, but an indiaction on what race can use it.. 
144         std::string     m_sClass;
145         std::vector<std::string>        m_vTarget;
146         int                     m_iInitiative;
147         int                     m_iAgility;
148         int                     m_iWeaponSpeed;
149         int                     m_iGuns;
150         int                     m_iPower;
151         int                     m_iArmor;
152         int                     m_iEMP;
153         int                     m_iTotalResources;
154         std::string     m_sType;            //!< normal,emp,cloak,steal,pod
155         int                     m_iETA;
156         int                     m_iFuel;
157 };
158
159 #endif