Advanced Strategic Command
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
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]

Public Types

enum  Mode { undefined, moveInwards, moveOutwards }
 
- Public Types inherited from Command
enum  State {
  Planned, Evaluated, SetUp, Run,
  Finished, Failed
}
 

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 ()
 
- Public Member Functions inherited from UnitCommand
virtual vector< MapCoordinategetCoordinates () const
 this is for informational purposes, so the player can see where a Command has taken place when reviewing it More...
 
int getUnitTypeID () const
 
- Public Member Functions inherited from Command
State getState () const
 
ActionResult redo (const Context &context)
 
- Public Member Functions inherited from GameAction
ActionResult execute (const Context &context)
 
ActionResult undo (const Context &context)
 
void read (tnstream &stream)
 
void write (tnstream &stream) const
 
void write (tnstream &stream, bool persistChildren) const
 
virtual ~GameAction ()
 

Static Public Member Functions

static bool moveOutAvail (const Vehicle *movingUnit)
 
static bool moveInAvail (const Vehicle *movingUnit, Vehicle *newCarrier)
 
- Static Public Member Functions inherited from GameAction
static GameActionreadFromStream (tnstream &stream, GameMap *map)
 

Protected Member Functions

void readData (tnstream &stream)
 
void writeData (tnstream &stream) const
 
GameActionID getID () const
 
ASCString getDescription () const
 
- Protected Member Functions inherited from UnitCommand
const VehiclegetUnit () const
 
VehiclegetUnit ()
 
int getUnitID () const
 
 UnitCommand (GameMap *map)
 
 UnitCommand (Vehicle *vehicle)
 
void readData (tnstream &stream)
 
void writeData (tnstream &stream) const
 
ActionResult checkExecutionPrecondition () const
 
- Protected Member Functions inherited from Command
 Command (GameMap *gamemap)
 
void setState (State state)
 
virtual ActionResult runAction (const Context &context)
 
virtual ActionResult undoAction (const Context &context)
 
- Protected Member Functions inherited from GameAction
void deleteChildren ()
 
 GameAction (GameMap *map)
 
void addChild (GameAction *action)
 adds a child action. Ownership of the child action is passed to THIS More...
 
virtual ActionResult preCheck ()
 preCheck is called before an action is redone and should check the preconditions for the action. More...
 
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. More...
 
virtual bool undoOrderChildFirst () const
 determines the order in which the child actions are undone. More...
 
GameMapgetMap ()
 
const GameMapgetMap () 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

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

ASCString CargoMoveCommand::getCommandString ( ) const
virtual

Implements Command.

Definition at line 168 of file cargomovecommand.cpp.

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

ASCString CargoMoveCommand::getDescription ( ) const
protectedvirtual
GameActionID CargoMoveCommand::getID ( ) const
protectedvirtual

Implements GameAction.

Definition at line 183 of file cargomovecommand.cpp.

References ActionRegistry::CargoMoveCommand.

vector< Vehicle * > CargoMoveCommand::getTargetCarriers ( )
ActionResult CargoMoveCommand::go ( const Context context)
virtual
bool CargoMoveCommand::moveInAvail ( const Vehicle movingUnit,
Vehicle newCarrier 
)
static

Definition at line 47 of file cargomovecommand.cpp.

References ContainerBase::doesVehicleFit().

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

bool CargoMoveCommand::moveOutAvail ( const Vehicle movingUnit)
static
void CargoMoveCommand::readData ( tnstream stream)
protectedvirtual

Reimplemented from Command.

Definition at line 138 of file cargomovecommand.cpp.

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

void CargoMoveCommand::setMode ( Mode  mode)

Definition at line 128 of file cargomovecommand.cpp.

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

Referenced by trunreplay::execnextreplaymove().

void CargoMoveCommand::setTargetCarrier ( Vehicle targetCarrier)
void CargoMoveCommand::writeData ( tnstream stream) const
protectedvirtual

Reimplemented from Command.

Definition at line 148 of file cargomovecommand.cpp.

References CargoMoveCommandVersion, UnitCommand::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: