ConsumeAmmo Class Reference

#include <consumeammo.h>

Inheritance diagram for ConsumeAmmo:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ConsumeAmmo (ContainerBase *veh, int ammoType, int slot, int count)
ASCString getDescription () const
void setAmmoProduction (bool prod)
 specifies if ammo shall be produced if there is not enough ammo available and the container has ammo production capabilities

Protected Member Functions

virtual GameActionID getID () const
virtual ActionResult runAction (const Context &context)
virtual ActionResult undoAction (const Context &context)
virtual ActionResult postCheck ()
 postCheck is called after an action has been redone and should check that the state of the map is exactly the same as it was after the action has been executed the first time.
virtual void readData (tnstream &stream)
virtual void writeData (tnstream &stream) const

Friends

template<class Child>
GameActionGameActionCreator (GameMap *map)

Detailed Description

Definition at line 29 of file consumeammo.h.


Constructor & Destructor Documentation

ConsumeAmmo::ConsumeAmmo ( ContainerBase veh,
int  ammoType,
int  slot,
int  count 
)

Definition at line 32 of file consumeammo.cpp.


Member Function Documentation

ASCString ConsumeAmmo::getDescription (  )  const [virtual]

Implements GameAction.

Definition at line 43 of file consumeammo.cpp.

References ContainerAction::getContainer(), ContainerBase::getName(), and ASCString::toString().

void ConsumeAmmo::setAmmoProduction ( bool  prod  ) 

specifies if ammo shall be produced if there is not enough ammo available and the container has ammo production capabilities

Definition at line 94 of file consumeammo.cpp.

GameActionID ConsumeAmmo::getID (  )  const [protected, virtual]

Implements GameAction.

Definition at line 100 of file consumeammo.cpp.

References ActionRegistry::ConsumeAmmo.

ActionResult ConsumeAmmo::runAction ( const Context context  )  [protected, virtual]

Implements GameAction.

Definition at line 132 of file consumeammo.cpp.

References Vehicle::ammo, SingleWeapon::count, ContainerBase::getAmmo(), ContainerAction::getContainer(), maxint, ContainerBase::putAmmo(), Vehicle::typ, UnitWeapon::weapon, and VehicleType::weapons.

ActionResult ConsumeAmmo::undoAction ( const Context context  )  [protected, virtual]

Implements GameAction.

Definition at line 189 of file consumeammo.cpp.

References Vehicle::ammo, SingleWeapon::count, ContainerBase::getAmmo(), ContainerAction::getContainer(), ContainerBase::putAmmo(), Vehicle::typ, UnitWeapon::weapon, and VehicleType::weapons.

ActionResult ConsumeAmmo::postCheck (  )  [protected, virtual]

postCheck is called after an action has been redone and should check that the state of the map is exactly the same as it was after the action has been executed the first time.

The cheat detection of Replays heavily relies on this mechanism.

Reimplemented from GameAction.

Definition at line 208 of file consumeammo.cpp.

References Vehicle::ammo, and ContainerAction::getContainer().

void ConsumeAmmo::readData ( tnstream stream  )  [protected, virtual]

Reimplemented from ContainerAction.

Definition at line 56 of file consumeammo.cpp.

References consumeAmmoStreamVersion, ContainerAction::readData(), tnstream::readInt(), and ContainerAction::setID().

void ConsumeAmmo::writeData ( tnstream stream  )  const [protected, virtual]

Reimplemented from ContainerAction.

Definition at line 82 of file consumeammo.cpp.

References consumeAmmoStreamVersion, ContainerAction::writeData(), and tnstream::writeInt().


Friends And Related Function Documentation

template<class Child>
GameAction* GameActionCreator ( GameMap map  )  [friend]

Definition at line 114 of file action.h.


The documentation for this class was generated from the following files:
Generated on Mon May 21 01:46:35 2012 for Advanced Strategic Command by  doxygen 1.5.1