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 ***************************************************************************/
25 UnitType::~UnitType(){
29 void UnitType::setName(string sName)
34 string UnitType::Name()
39 void UnitType::setRace(int iRace)
49 void UnitType::setClass(int iClass)
54 int UnitType::iClass()
59 void UnitType::setTarget(vector<int> Target)
64 void UnitType::addTarget(int iTarget)
66 m_vTarget.push_back(iTarget);
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.
71 void UnitType::insTarget(int iTarget, int index = 0)
74 vector<int>::iterator i = m_vTarget.begin();
76 for (int j = 0; j < index; j++, i++)
78 if (i == m_vTarget.end())
80 m_vTarget.push_back(iTarget);
85 m_vTarget.insert(i, iTarget);
88 vector<int> UnitType::Target()
93 int UnitType::Target(int index)
95 return m_vTarget[index];
98 void UnitType::setInitiative(int iInit)
100 m_iInitiative = iInit;
103 int UnitType::Initiative()
105 return m_iInitiative;
108 void UnitType::setAgility (int iAgil)
113 int UnitType::Agility()
118 void UnitType::setWeaponSpeed(int iWPSP)
120 m_iWeaponSpeed = iWPSP;
123 int UnitType::WeaponSpeed()
125 return m_iWeaponSpeed;
128 void UnitType::setGuns(int iGuns)
138 void UnitType::setPower(int iPower)
143 int UnitType::Power()
148 void UnitType::setArmor(int iArmor)
153 int UnitType::Armor()
158 void UnitType::setEMP(int iEMP)
168 void UnitType::setTotalResources(int iTR)
170 m_iTotalResources = iTR;
173 int UnitType::TotRes()
175 return m_iTotalResources;
178 void UnitType::setFuel(int iFuel)
188 void UnitType::setETA(int iETA)
198 void UnitType::setType(int iType)