UnitFieldRegistration Class Reference

#include <unitfieldregistration.h>

Inheritance diagram for UnitFieldRegistration:

Inheritance graph
[legend]
List of all members.

Public Types

enum  Operation {
  RegisterOnField, UnregisterOnField, AddView, RemoveView,
  Position, Position3D, RegisterInCarrier, UnRegisterFromCarrier
}

Public Member Functions

 UnitFieldRegistration (Vehicle *vehicle, const MapCoordinate3D &pos, Operation operation, ContainerBase *carrier=0)
ASCString getDescription () const

Protected Member Functions

virtual GameActionID getID () const
virtual ActionResult runAction (const Context &context)
virtual ActionResult undoAction (const Context &context)
virtual ActionResult preCheck ()
 preCheck is called before an action is redone and should check the preconditions for the action.
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 unitfieldregistration.h.


Member Enumeration Documentation

enum UnitFieldRegistration::Operation

Enumerator:
RegisterOnField 
UnregisterOnField 
AddView 
RemoveView 
Position 
Position3D 
RegisterInCarrier 
UnRegisterFromCarrier 

Definition at line 31 of file unitfieldregistration.h.


Constructor & Destructor Documentation

UnitFieldRegistration::UnitFieldRegistration ( Vehicle vehicle,
const MapCoordinate3D pos,
Operation  operation,
ContainerBase carrier = 0 
)

Definition at line 29 of file unitfieldregistration.cpp.

References ContainerBase::getIdentification().

Referenced by runAction().


Member Function Documentation

ASCString UnitFieldRegistration::getDescription (  )  const [virtual]

Implements GameAction.

Definition at line 56 of file unitfieldregistration.cpp.

References Vehicle::getName(), UnitAction::getUnit(), MapCoordinate::toString(), and MapCoordinate::valid().

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

Implements GameAction.

Definition at line 103 of file unitfieldregistration.cpp.

References ActionRegistry::UnitFieldRegistration.

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

Implements GameAction.

Definition at line 108 of file unitfieldregistration.cpp.

References ContainerBase::addToCargo(), AddView, MapCoordinate3D::getBitmappedHeight(), ContainerBase::getCargo(), GameMap::getContainer(), MapField::getContainer(), GameMap::getField(), GameAction::getMap(), UnitAction::getUnit(), Position, Position3D, RegisterInCarrier, RegisterOnField, ContainerBase::removeUnitFromCargo(), RemoveView, ActionResult::successful(), UnitFieldRegistration(), UnRegisterFromCarrier, UnregisterOnField, MapField::vehicle, MapCoordinate::x, and MapCoordinate::y.

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

Implements GameAction.

Definition at line 190 of file unitfieldregistration.cpp.

References ContainerBase::addToCargo(), AddView, MapCoordinate3D::getBitmappedHeight(), GameMap::getContainer(), MapField::getContainer(), GameMap::getField(), GameAction::getMap(), UnitAction::getUnit(), Position, Position3D, RegisterInCarrier, RegisterOnField, ContainerBase::removeUnitFromCargo(), RemoveView, UnRegisterFromCarrier, UnregisterOnField, MapField::vehicle, MapCoordinate::x, and MapCoordinate::y.

ActionResult UnitFieldRegistration::preCheck (  )  [protected, virtual]

preCheck is called before an action is redone and should check the preconditions for the action.

The map should be in exactly the same state as it was when the action was first run. This method should check various key indicators to insurce the unmodifiedness of the map. The cheat detection of Replays heavily relies on this mechanism.

Reimplemented from GameAction.

Definition at line 261 of file unitfieldregistration.cpp.

References UnitAction::getUnit(), Position, Position3D, MapCoordinate::x, and MapCoordinate::y.

ActionResult UnitFieldRegistration::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 270 of file unitfieldregistration.cpp.

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

Reimplemented from UnitAction.

Definition at line 70 of file unitfieldregistration.cpp.

References MapCoordinate3D::read(), UnitAction::readData(), and tnstream::readInt().

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

Reimplemented from UnitAction.

Definition at line 90 of file unitfieldregistration.cpp.

References MapCoordinate3D::write(), UnitAction::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:48:01 2012 for Advanced Strategic Command by  doxygen 1.5.1