#include <item.h>
Inheritance diagram for TItem:
Public Types | |
typedef int2 | tWeaponType |
enum | tItemType { STL_ENGINE = 0x00000001, FTL_ENGINE = 0x00000002, FUELTANK = 0x00000004, FUELSCOOP = 0x00000008, CARGOBAY = 0x00000010, COLONIZER = 0x00000020, REPAIRBOT = 0x00000040, ARMOR = 0x00000080, SHIELD = 0x00000100, KWEAPON = 0x00000200, EWEAPON = 0x00000400, TARGETINGCOMPUTER = 0x00000800, SCANNER = 0x00001000, JAMMER = 0x00002000, MINELAYER = 0x00004000, MININGBOT = 0x00008000, FIGHTERLAUNCHER = 0x00010000, SPWEAPONLAUNCHER = 0x00020000 } |
Public Methods | |
TItem () | |
TItem (const TItem &OldItem) | |
virtual | ~TItem () |
virtual int2 | getType () const |
virtual const string & | getTypeName () const |
virtual bool | load (TDataPackageList *in) |
virtual bool | save (TDataPackageList *out) const |
virtual TItem::tItemType | getItemType () const=0 |
virtual void | setItemName (const string &Name) |
virtual const string & | getItemName () const |
virtual void | setTechLevel (const int2 TechLevel) |
virtual int2 | getTechLevel () const |
virtual void | setMass (const int2 Mass) |
virtual int2 | getMass () const |
virtual void | setVolume (const int2 Volume) |
virtual int2 | getVolume () const |
virtual void | setSurface (const int2 Surface) |
virtual int2 | getSurface () const |
virtual void | setCost (const TSubstanceSet &Cost) |
virtual void | getCost (TSubstanceSet *Cost) const |
virtual bool | operator== (const TItem &Item) const |
Protected Methods | |
virtual TItem & | operator= (const TItem &Item) |
Protected Attributes | |
string | fItemName |
int2 | fTechLevel |
int2 | fItemMass |
int2 | fItemVolume |
int2 | fItemSurface |
TSubstanceSet | fItemCost |
Note that TItem is a pure virtual class, so making instances of this class is not possible. TItem just provides the general interface for all items. Derived from this class are the interfaces for the different item types, for example a TSTLEngine. These classes also provide only the interface for this item type, the real implementation is done in different classes which have an additional suffix, e.g. TSTLEngineBasic, TSTLEngineStars etc.
|
This is the variable type for the weapon type. In future it could be necessary to change it into a class of its own or even two classes, one for kinetic weapons and one for energy weapons. It is defined here because this is the only place in the hierarchy above the classes were it is needed. As long as it is only an integer, the rule set/game start up class is responsible that there is no energy weapon with the same number a kinetic weapon already has. |
|
Each from TItem derived class (i.e. TSTLEngine) will return one of these constants, if it shall indentify itself. This is especially important in connection with TShipDesign |
|
This constructor doesn't work, because TItem is a pure virtual class. It's only implemented to be used by the sub classes of TItems. |
|
This constructor doesn't work either and is implemented to provide a copy constructor for the sub classes.
|
|
Destructs the object. Has nothing else to do, because no memory has to be freed or similar stuff. Doesn't work, because TItem is a pure virtual class and you wont be able to construct an object. |
|
With the method getCost you can get the cost (from type TSubstanceSet) for the item.
|
|
With the method getItemName you can read out the name of the item.
|
|
With the method getItemType you can get the type of the item, that means whether it is armor, engine or something else. This method has to be reimplemented in all the derived classes.
Reimplemented in TSTLEngine, TFTLEngine, TFuelTank, TFuelScoop, TCargoBay, TColonizer, TRepairBot, TArmor, TShield, TWeapon, TKWeapon, TEWeapon, TTargetingComputer, TScanner, TJammer, TMineLayer, TMiningBot, TFighterLauncher, and TSPWeaponLauncher. |
|
With the method getMass you can get the mass of the item.
|
|
With the method getSurface you can get the surface area the item needs.
|
|
With the method getTechLevel you can get the tech level the item has. This will be important i.e. if you want to sort items after tech level.
|
|
This method is inherited from TType and reimplemented here. I returns TType::ITEM.
Reimplemented from TLinkable. |
|
This method is inherited from TType and reimplemented here. I returns "TItem".
Reimplemented from TLinkable. |
|
With the method getVolume you can get the volume the item needs.
|
|
The method Load loads a TItem object from the data packages in the list. All sub classes of TItem have to reimplement the Load method and they must call TItem::Load explicitly in their Load method to load the data correctly. For more information look in the documentation of the ancestors of TItem from where this method is inherited.
Reimplemented from TLinkable. Reimplemented in TSTLEngine, TFTLEngine, TFuelTank, TFuelScoop, TCargoBay, TColonizer, TRepairBot, TArmor, TShield, TWeapon, TKWeapon, TEWeapon, TTargetingComputer, TScanner, TScannerNormalActive, TScannerNormalPassive, TScannerAntiDisguiseActive, TScannerAntiDisguisePassive, TScannerAntiCloakActive, TScannerAntiCloakPassive, TScannerPenetrateActive, TScannerPenetratePassive, TJammer, TJammerNormal, TJammerDisguise, TJammerCloak, TJammerAntiPenetrate, TMineLayer, TMiningBot, TFighterLauncher, and TSPWeaponLauncher. |
|
This is the assignment operator for TItem. |
|
This is the compare operator for TItem. It is only used in the sub classes of TItem to compare the fields of TItem, because TItem is abstract.
|
|
The method Save saves a TItem by adding the data packages to the list. All sub classes of TItem have to reimplement the Save method and they must call TItem::Save explicitly in their Save method to save the data correctly. For more information look in the documentation of the ancestors of TItem, because the method Save is inherited from there.
Reimplemented from TLinkable. Reimplemented in TSTLEngine, TFTLEngine, TFuelTank, TFuelScoop, TCargoBay, TColonizer, TRepairBot, TArmor, TShield, TWeapon, TKWeapon, TEWeapon, TTargetingComputer, TScanner, TScannerNormalActive, TScannerNormalPassive, TScannerAntiDisguiseActive, TScannerAntiDisguisePassive, TScannerAntiCloakActive, TScannerAntiCloakPassive, TScannerPenetrateActive, TScannerPenetratePassive, TJammer, TJammerNormal, TJammerDisguise, TJammerCloak, TJammerAntiPenetrate, TMineLayer, TMiningBot, TFighterLauncher, and TSPWeaponLauncher. |
|
With the method setCost you can set the cost (from type TSubstanceSet) for the item.
|
|
With the method setItemName you can give the item its name.
|
|
With the method setMass you can set the mass of the item.
|
|
With the method setSurface you can set the surface area the item needs.
|
|
With the method setTechLevel you can set the tech level the item has.
|
|
With the method setVolume you can set the volume the item needs.
|
|
the cost (from type TSubstanceSet) for this item |
|
the mass if the item |
|
the name of the item. |
|
the surface area the item needs on the outside of the hull |
|
the volume the item needs |
|
the tech level of the item |