1 /***************************************************************************
2 unittype.cpp - description
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 //////////////////////////////////////////////////////////////////////////
28 //////////////////////////////////////////////////////////////////////////
30 UnitType::~UnitType(){
34 //////////////////////////////////////////////////////////////////////////
36 void UnitType::setName(string sName)
41 //////////////////////////////////////////////////////////////////////////
43 string UnitType::Name()
48 //////////////////////////////////////////////////////////////////////////
50 void UnitType::setRace(int iRace)
55 //////////////////////////////////////////////////////////////////////////
62 //////////////////////////////////////////////////////////////////////////
64 void UnitType::setClass(int iClass)
69 //////////////////////////////////////////////////////////////////////////
71 int UnitType::iClass()
76 //////////////////////////////////////////////////////////////////////////
78 void UnitType::setTarget(vector<int> Target)
83 //////////////////////////////////////////////////////////////////////////
85 void UnitType::addTarget(int iTarget)
87 m_vTarget.push_back(iTarget);
90 //////////////////////////////////////////////////////////////////////////
92 /** This function iterates through the list until it finds the right positition.
93 * If it finds the position it inserts the target there, if it reaches the end
94 * before it finds the correct possition it adds the target to the end.
96 void UnitType::insTarget(int iTarget, int index = 0)
99 vector<int>::iterator i = m_vTarget.begin();
101 for (int j = 0; j < index; j++, i++)
103 if (i == m_vTarget.end())
105 m_vTarget.push_back(iTarget);
110 m_vTarget.insert(i, iTarget);
113 //////////////////////////////////////////////////////////////////////////
115 vector<int> UnitType::Target()
120 //////////////////////////////////////////////////////////////////////////
122 int UnitType::Target(int index)
124 return m_vTarget[index];
127 //////////////////////////////////////////////////////////////////////////
129 void UnitType::setInitiative(int iInit)
131 m_iInitiative = iInit;
134 //////////////////////////////////////////////////////////////////////////
136 int UnitType::Initiative()
138 return m_iInitiative;
141 //////////////////////////////////////////////////////////////////////////
143 void UnitType::setAgility (int iAgil)
148 //////////////////////////////////////////////////////////////////////////
150 int UnitType::Agility()
155 //////////////////////////////////////////////////////////////////////////
157 void UnitType::setWeaponSpeed(int iWPSP)
159 m_iWeaponSpeed = iWPSP;
162 //////////////////////////////////////////////////////////////////////////
164 int UnitType::WeaponSpeed()
166 return m_iWeaponSpeed;
169 //////////////////////////////////////////////////////////////////////////
171 void UnitType::setGuns(int iGuns)
176 //////////////////////////////////////////////////////////////////////////
183 //////////////////////////////////////////////////////////////////////////
185 void UnitType::setPower(int iPower)
190 //////////////////////////////////////////////////////////////////////////
192 int UnitType::Power()
197 //////////////////////////////////////////////////////////////////////////
199 void UnitType::setArmor(int iArmor)
204 //////////////////////////////////////////////////////////////////////////
206 int UnitType::Armor()
211 //////////////////////////////////////////////////////////////////////////
213 void UnitType::setEMP(int iEMP)
218 //////////////////////////////////////////////////////////////////////////
225 //////////////////////////////////////////////////////////////////////////
227 void UnitType::setTotalResources(int iTR)
229 m_iTotalResources = iTR;
232 //////////////////////////////////////////////////////////////////////////
234 int UnitType::TotRes()
236 return m_iTotalResources;
239 //////////////////////////////////////////////////////////////////////////
241 void UnitType::setFuel(int iFuel)
246 //////////////////////////////////////////////////////////////////////////
253 //////////////////////////////////////////////////////////////////////////
255 void UnitType::setETA(int iETA)
260 //////////////////////////////////////////////////////////////////////////
267 //////////////////////////////////////////////////////////////////////////
269 void UnitType::setType(int iType)
274 //////////////////////////////////////////////////////////////////////////