CargoMoveCommand Class Reference

Cargo Move is moving a unit between different carriers that are nested. More...

#include <cargomovecommand.h>

Inheritance diagram for CargoMoveCommand:

Inheritance graph
[legend]
List of all members.

Public Types

enum  Mode { undefined, moveInwards, moveOutwards }

Public Member Functions

 CargoMoveCommand (Vehicle *unit)
void setMode (Mode mode)
ActionResult go (const Context &context)
ASCString getCommandString () const
void setTargetCarrier (Vehicle *targetCarrier)
vector< Vehicle * > getTargetCarriers ()

Static Public Member Functions

static bool moveOutAvail (const Vehicle *movingUnit)
static bool moveInAvail (const Vehicle *movingUnit, Vehicle *newCarrier)

Protected Member Functions

void readData (tnstream &stream)
void writeData (tnstream &stream) const
GameActionID getID () const
ASCString getDescription () const

Friends

template<class Child>
GameActionGameActionCreator (GameMap *map)

Detailed Description

Cargo Move is moving a unit between different carriers that are nested.

Definition at line 28 of file cargomovecommand.h.


Member Enumeration Documentation

enum CargoMoveCommand::Mode

Enumerator:
undefined 
moveInwards 
moveOutwards 

Definition at line 33 of file cargomovecommand.h.


Constructor & Destructor Documentation

CargoMoveCommand::CargoMoveCommand ( Vehicle unit  ) 

Definition at line 73 of file cargomovecommand.cpp.


Member Function Documentation

bool CargoMoveCommand::moveOutAvail ( const Vehicle movingUnit  )  [static]

Definition at line 32 of file cargomovecommand.cpp.

References ContainerBase::getCarrier(), and ContainerBase::vehicleFit().

Referenced by CargoGuiFunctions::MoveUnitUp::available(), cargoUnitMove(), and go().

bool CargoMoveCommand::moveInAvail ( const Vehicle movingUnit,
Vehicle newCarrier 
) [static]

Definition at line 47 of file cargomovecommand.cpp.

References ContainerBase::vehicleFit().

Referenced by cargoUnitMove(), getTargetCarriers(), and go().

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

Reimplemented from UnitCommand.

Definition at line 138 of file cargomovecommand.cpp.

References CargoMoveCommandVersion, UnitCommand::readData(), and tnstream::readInt().

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

Reimplemented from UnitCommand.

Definition at line 148 of file cargomovecommand.cpp.

References CargoMoveCommandVersion, UnitCommand::writeData(), and tnstream::writeInt().

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

Implements GameAction.

Definition at line 183 of file cargomovecommand.cpp.

References ActionRegistry::CargoMoveCommand.

ASCString CargoMoveCommand::getDescription (  )  const [protected, virtual]

Implements GameAction.

Definition at line 188 of file cargomovecommand.cpp.

References Vehicle::getName(), Vehicle::getPosition(), UnitCommand::getUnit(), UnitCommand::getUnitID(), moveOutwards, MapCoordinate::toString(), and ASCString::toString().

void CargoMoveCommand::setMode ( Mode  mode  ) 

Definition at line 128 of file cargomovecommand.cpp.

References moveOutwards, Command::setState(), and Command::SetUp.

Referenced by trunreplay::execnextreplaymove().

ActionResult CargoMoveCommand::go ( const Context context  )  [virtual]

Implements Command.

Definition at line 83 of file cargomovecommand.cpp.

References GameAction::execute(), ContainerBase::getCarrier(), GameAction::getMap(), ContainerBase::getPosition(), Command::getState(), GameMap::getUnit(), UnitCommand::getUnit(), moveInAvail(), moveOutAvail(), moveOutwards, UnitFieldRegistration::RegisterInCarrier, Command::SetUp, ActionResult::successful(), undefined, ActionRegistry::UnitFieldRegistration, and UnitFieldRegistration::UnRegisterFromCarrier.

ASCString CargoMoveCommand::getCommandString (  )  const [virtual]

Implements Command.

Definition at line 168 of file cargomovecommand.cpp.

References ASCString::format(), UnitCommand::getUnitID(), moveInwards, and moveOutwards.

void CargoMoveCommand::setTargetCarrier ( Vehicle targetCarrier  ) 

Definition at line 157 of file cargomovecommand.cpp.

References moveInwards, Vehicle::networkid, Command::setState(), and Command::SetUp.

vector< Vehicle * > CargoMoveCommand::getTargetCarriers (  ) 

Definition at line 56 of file cargomovecommand.cpp.

References ContainerBase::getCargo(), ContainerBase::getCarrier(), UnitCommand::getUnit(), and moveInAvail().

Referenced by CargoGuiFunctions::MoveUnitIntoInnerContainer::available().


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:28 2012 for Advanced Strategic Command by  doxygen 1.5.1