]> ruin.nu Git - hbs.git/blob - bs/unittype.cpp
38af1dacb45d6842462a7b99cca9eaef568ceace
[hbs.git] / bs / unittype.cpp
1 /***************************************************************************
2                           unittype.cpp  -  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 #include "unittype.h"
19 #include <iostream>
20 using namespace std;
21
22 UnitType::UnitType()
23 {
24 }
25 UnitType::~UnitType(){
26 }
27
28
29 void UnitType::setName(string sName)
30 {
31         m_sName = sName;
32 }
33
34 string UnitType::Name()
35 {
36         return m_sName;
37 }
38
39 void UnitType::setRace(int iRace)
40 {
41         m_iRace = iRace;
42 }
43
44 int UnitType::Race()
45 {
46         return m_iRace;
47 }
48
49 void UnitType::setClass(int iClass)
50 {
51         m_iClass = iClass;
52 }
53
54 int UnitType::iClass()
55 {
56         return m_iClass;
57 }
58
59 void UnitType::setTarget(vector<int> Target)
60 {
61         m_vTarget = Target;
62 }
63
64 void UnitType::addTarget(int iTarget)
65 {
66         m_vTarget.push_back(iTarget);
67 }
68
69 /** This function iterates through the list until it finds the right positition. If it finds the position it inserts the target there, if it reaches the end before it finds the correct possition it adds the target to the end. 
70  */
71 void UnitType::insTarget(int iTarget, int index = 0)
72 {
73
74         vector<int>::iterator i = m_vTarget.begin();    
75
76         for (int j = 0; j < index; j++, i++)
77         {
78                 if (i == m_vTarget.end())
79                 {
80                         m_vTarget.push_back(iTarget);
81                         return;
82                 }
83         }
84
85         m_vTarget.insert(i, iTarget);
86 }
87
88 vector<int> UnitType::Target()
89 {
90         return m_vTarget;
91 }
92
93 int     UnitType::Target(int index)
94 {
95         return m_vTarget[index];
96 }
97
98 void UnitType::setInitiative(int iInit)
99 {
100         m_iInitiative = iInit;
101 }
102
103 int      UnitType::Initiative()
104 {
105         return m_iInitiative;
106 }
107
108 void UnitType::setAgility (int iAgil)
109 {
110         m_iAgility = iAgil;
111 }
112
113 int  UnitType::Agility()
114 {
115         return m_iAgility;
116 }
117
118 void UnitType::setWeaponSpeed(int iWPSP)
119 {
120         m_iWeaponSpeed = iWPSP;
121 }
122
123 int  UnitType::WeaponSpeed()
124 {
125         return m_iWeaponSpeed;
126 }
127
128 void UnitType::setGuns(int iGuns)
129 {
130         m_iGuns = iGuns;
131 }
132
133 int UnitType::Guns()
134 {
135         return m_iGuns;
136 }
137
138 void UnitType::setPower(int iPower)
139 {
140         m_iPower = iPower;
141 }
142
143 int  UnitType::Power()
144 {
145         return m_iPower;
146 }
147
148 void UnitType::setArmor(int iArmor)
149 {
150         m_iArmor = iArmor;
151 }
152
153 int  UnitType::Armor()
154 {
155         return m_iArmor;
156 }
157
158 void UnitType::setEMP(int iEMP)
159 {
160         m_iEMP = iEMP;
161 }
162
163 int  UnitType::EMP()
164 {
165         return m_iEMP;
166 }
167
168 void UnitType::setTotalResources(int iTR)
169 {
170         m_iTotalResources = iTR;
171 }
172
173 int UnitType::TotRes()
174 {
175         return m_iTotalResources;
176 }
177
178 void UnitType::setFuel(int iFuel)
179 {
180         m_iFuel = iFuel;
181 }
182
183 int  UnitType::Fuel()
184 {
185         return m_iFuel;
186 }
187
188 void UnitType::setETA(int iETA)
189 {
190         m_iETA = iETA;
191 }
192
193 int  UnitType::ETA()
194 {
195         return m_iETA;
196 }
197
198 void UnitType::setType(int iType)
199 {
200         m_iType = iType;
201 }
202
203 int  UnitType::Type()
204 {
205         return m_iType;
206 }
207