![]() |
VR-Forces 4.0.4 Class Documentation
|
Contains the DtIntegerResource class declaration. More...

Public Member Functions | |
| DtIntegerResource () | |
| Default constructor; used by resource factory. | |
| DtIntegerResource (const DtString &resourceName, DtReaderWriterRegistry *parentRegistry=NULL) | |
| constructor | |
| DtIntegerResource (const DtIntegerResource &orig, DtReaderWriterRegistry *parentRegistry=0) | |
| copy constructor | |
| virtual | ~DtIntegerResource () |
| destructor | |
| virtual void | updateAmountFromChildren () |
| This is called when a child's value changes (or a new child is added). | |
| virtual void | updateFullAmountFromChildren () |
| When the deriving class's setFullAmount is called, this should be called on the resources parent. | |
| virtual DtSimResource * | clone (DtReaderWriterRegistry *parentRegistry=0) const |
| Make a copy of myself. | |
| virtual DtString | type () const |
| The data type of the resource. These types are defined in rsrcTypes.h. | |
| virtual void | distributeAmountToChildren () |
| This is called when my amount changes (via setAmount()). | |
| virtual void | distributeFullAmountToChildren () |
| When the deriving class's setFullAmount is called, this should be called if the resource has any children. | |
| virtual void | setAmount (int amount) |
| Amount is set to the amount specified, but will not go over full amount or less than 0. | |
| virtual int | amount () const |
| virtual void | deplete (int amount=1) |
| Amount is reduced by the amount specified, but will not go below 0. | |
| virtual void | replenish (int amount=1) |
| Amount is increased by the amount specified, but will not go above full amount. | |
| virtual void | setFullAmount (int fullAmount) |
| virtual int | fullAmount () const |
| virtual DtReal | percentageFull () const |
| The deriving class will also provide a function to specify the quantity (of the appropriate type) that indicates a full/complete load of the resource. | |
| virtual void | setPercentageFull (DtReal percent) |
| Percent will be truncated to be between 0. and 1. | |
| virtual int | constrainAmount (int amount) const |
| If amount < 0, returns 0. | |
| virtual bool | isEqual (const DtSimResource &res) const |
| Returns true if myAmount and myFullAmount are the same as the resource coming in. | |
Static Public Member Functions | |
| static DtSimResource * | creator () |
Protected Member Functions | |
| DtIntegerResource & | operator= (const DtIntegerResource &orig) |
| assignment operator; not implemented | |
Protected Attributes | |
| DtRwInt | myAmount |
| DtRwInt | myFullAmount |
Contains the DtIntegerResource class declaration.
DtIntegerResource implements the required functions for a resource that can be measured by an integer value (such as main gun rounds, bandages, fan belts, and so on).
Default constructor; used by resource factory.
| DtIntegerResource::DtIntegerResource | ( | const DtString & | resourceName, |
| DtReaderWriterRegistry * | parentRegistry = NULL |
||
| ) |
constructor
The resource name is the name that will be used to look up the resource in the resource manager.
| DtIntegerResource::DtIntegerResource | ( | const DtIntegerResource & | orig, |
| DtReaderWriterRegistry * | parentRegistry = 0 |
||
| ) |
copy constructor
| virtual DtIntegerResource::~DtIntegerResource | ( | ) | [virtual] |
destructor
| DtIntegerResource& DtIntegerResource::operator= | ( | const DtIntegerResource & | orig | ) | [protected] |
assignment operator; not implemented
| virtual void DtIntegerResource::updateAmountFromChildren | ( | ) | [virtual] |
This is called when a child's value changes (or a new child is added).
Implements DtSimResource.
| virtual void DtIntegerResource::updateFullAmountFromChildren | ( | ) | [virtual] |
When the deriving class's setFullAmount is called, this should be called on the resources parent.
Implements DtSimResource.
| virtual DtSimResource* DtIntegerResource::clone | ( | DtReaderWriterRegistry * | parentRegistry = 0 | ) | const [virtual] |
| virtual DtString DtIntegerResource::type | ( | ) | const [virtual] |
The data type of the resource. These types are defined in rsrcTypes.h.
Implements DtSimResource.
Reimplemented in DtMunitionResource.
| virtual void DtIntegerResource::distributeAmountToChildren | ( | ) | [virtual] |
This is called when my amount changes (via setAmount()).
Implements DtSimResource.
| virtual void DtIntegerResource::distributeFullAmountToChildren | ( | ) | [virtual] |
When the deriving class's setFullAmount is called, this should be called if the resource has any children.
Implements DtSimResource.
| virtual void DtIntegerResource::setAmount | ( | int | amount | ) | [virtual] |
Amount is set to the amount specified, but will not go over full amount or less than 0.
| virtual int DtIntegerResource::amount | ( | ) | const [virtual] |
| virtual void DtIntegerResource::deplete | ( | int | amount = 1 | ) | [virtual] |
Amount is reduced by the amount specified, but will not go below 0.
| virtual void DtIntegerResource::replenish | ( | int | amount = 1 | ) | [virtual] |
Amount is increased by the amount specified, but will not go above full amount.
| virtual void DtIntegerResource::setFullAmount | ( | int | fullAmount | ) | [virtual] |
| virtual int DtIntegerResource::fullAmount | ( | ) | const [virtual] |
| virtual DtReal DtIntegerResource::percentageFull | ( | ) | const [virtual] |
The deriving class will also provide a function to specify the quantity (of the appropriate type) that indicates a full/complete load of the resource.
PercentageFull will return 0. to 1., amount / fullAmount Note: 1. is returned if full amount is <= 0.
Implements DtSimResource.
| virtual void DtIntegerResource::setPercentageFull | ( | DtReal | percent | ) | [virtual] |
Percent will be truncated to be between 0. and 1.
Implements DtSimResource.
| virtual int DtIntegerResource::constrainAmount | ( | int | amount | ) | const [virtual] |
If amount < 0, returns 0.
Else if amount > fullAmount, returns fullAmount. Else, returns amount.
| static DtSimResource* DtIntegerResource::creator | ( | ) | [static] |
Reimplemented in DtMunitionResource.
| virtual bool DtIntegerResource::isEqual | ( | const DtSimResource & | res | ) | const [virtual] |
Returns true if myAmount and myFullAmount are the same as the resource coming in.
Reimplemented from DtSimResource.
DtRwInt DtIntegerResource::myAmount [protected] |
DtRwInt DtIntegerResource::myFullAmount [protected] |