X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=bs%2Funittype.cpp;h=27b3cd4affdeb107355804dc97afb551f283db02;hb=dc90594097a886eee49e9bfe45da6d4f9765179a;hp=3b57cc1544cf8ad517ab891fda6caa5875ed6fdd;hpb=cef0ac6862df9a33909e0aa56f89f4c4257cca69;p=hbs.git diff --git a/bs/unittype.cpp b/bs/unittype.cpp index 3b57cc1..27b3cd4 100644 --- a/bs/unittype.cpp +++ b/bs/unittype.cpp @@ -16,8 +16,265 @@ ***************************************************************************/ #include "unittype.h" +#include +using namespace std; -UnitType::UnitType(){ +////////////////////////////////////////////////////////////////////////// +// + +UnitType::UnitType() +{ } +////////////////////////////////////////////////////////////////////////// +// UnitType::~UnitType(){ } + + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setName(string sName) +{ + m_sName = sName; +} + +////////////////////////////////////////////////////////////////////////// +// +string UnitType::Name() +{ + return m_sName; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setRace(int iRace) +{ + m_iRace = iRace; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::Race() +{ + return m_iRace; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setClass(string sClass) +{ + m_sClass = sClass; +} + +////////////////////////////////////////////////////////////////////////// +// +string UnitType::Class() +{ + return m_sClass; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setTarget(vector Target) +{ + m_vTarget = Target; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::addTarget(string target) +{ + m_vTarget.push_back(target); +} + +////////////////////////////////////////////////////////////////////////// +// +/** 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. + */ +void UnitType::insTarget(string target, int index = 0) +{ + + vector::iterator i = m_vTarget.begin(); + + for (int j = 0; j < index; j++, i++) + { + if (i == m_vTarget.end()) + { + m_vTarget.push_back(target); + return; + } + } + + m_vTarget.insert(i, target); +} + +////////////////////////////////////////////////////////////////////////// +// +vector UnitType::Target() +{ + return m_vTarget; +} + +////////////////////////////////////////////////////////////////////////// +// +string UnitType::Target(int index) +{ + return m_vTarget[index]; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setInitiative(int iInit) +{ + m_iInitiative = iInit; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::Initiative() +{ + return m_iInitiative; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setAgility (int iAgil) +{ + m_iAgility = iAgil; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::Agility() +{ + return m_iAgility; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setWeaponSpeed(int iWPSP) +{ + m_iWeaponSpeed = iWPSP; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::WeaponSpeed() +{ + return m_iWeaponSpeed; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setGuns(int iGuns) +{ + m_iGuns = iGuns; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::Guns() +{ + return m_iGuns; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setPower(int iPower) +{ + m_iPower = iPower; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::Power() +{ + return m_iPower; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setArmor(int iArmor) +{ + m_iArmor = iArmor; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::Armor() +{ + return m_iArmor; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setEMP(int iEMP) +{ + m_iEMP = iEMP; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::EMP() +{ + return m_iEMP; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setTotalResources(int iTR) +{ + m_iTotalResources = iTR; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::TotRes() +{ + return m_iTotalResources; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setFuel(int iFuel) +{ + m_iFuel = iFuel; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::Fuel() +{ + return m_iFuel; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setETA(int iETA) +{ + m_iETA = iETA; +} + +////////////////////////////////////////////////////////////////////////// +// +int UnitType::ETA() +{ + return m_iETA; +} + +////////////////////////////////////////////////////////////////////////// +// +void UnitType::setType(string type) +{ + m_sType = type; +} + +////////////////////////////////////////////////////////////////////////// +// +string UnitType::Type() +{ + return m_sType; +} +