Advanced Strategic Command
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
ServiceCommand Class Reference

#include <servicecommand.h>

Inheritance diagram for ServiceCommand:
Inheritance graph
[legend]

Public Member Functions

 ServiceCommand (ContainerBase *unit)
 
TransferHandlergetTransferHandler ()
 each call to getTransferHandler will deallocate the previous handler and create a new one Make sure to not have any pointers to the old one around when calling this another time More...
 
const
ServiceTargetSearcher::Targets
getDestinations ()
 
void setDestination (ContainerBase *destination)
 
void saveTransfers ()
 
ActionResult go (const Context &context)
 
ASCString getCommandString () const
 
ContainerBasegetRefueller ()
 
ActionResult checkExecutionPrecondition () const
 
 ~ServiceCommand ()
 
- Public Member Functions inherited from Command
State getState () const
 
ActionResult redo (const Context &context)
 
virtual vector< MapCoordinategetCoordinates () const
 this is for informational purposes, so the player can see where a Command has taken place when reviewing it More...
 
- 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 availExternally (ContainerBase *source)
 
static bool avail (ContainerBase *source, ContainerBase *target)
 
- 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 ContainerCommand
ContainerBasegetContainer (bool dontThrow=false)
 
const ContainerBasegetContainer (bool dontThrow=false) const
 
int getContainerID () const
 
 ContainerCommand (ContainerBase *container)
 
 ContainerCommand (GameMap *map)
 
- 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)
 

Additional Inherited Members

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

Detailed Description

Definition at line 32 of file servicecommand.h.

Constructor & Destructor Documentation

ServiceCommand::ServiceCommand ( ContainerBase unit)

Definition at line 63 of file servicecommand.cpp.

ServiceCommand::~ServiceCommand ( )

Definition at line 254 of file servicecommand.cpp.

Member Function Documentation

bool ServiceCommand::avail ( ContainerBase source,
ContainerBase target 
)
static
bool ServiceCommand::availExternally ( ContainerBase source)
static
ActionResult ServiceCommand::checkExecutionPrecondition ( ) const
virtual

Reimplemented from ContainerCommand.

Definition at line 245 of file servicecommand.cpp.

References ContainerCommand::getContainer(), and GameAction::getMap().

ASCString ServiceCommand::getCommandString ( ) const
virtual

Implements Command.

Definition at line 213 of file servicecommand.cpp.

References ASCString::format(), and ContainerCommand::getContainerID().

ASCString ServiceCommand::getDescription ( ) const
protectedvirtual

Implements GameAction.

Definition at line 235 of file servicecommand.cpp.

References ContainerCommand::getContainer(), and ContainerBase::getName().

const ServiceTargetSearcher::Targets & ServiceCommand::getDestinations ( )
GameActionID ServiceCommand::getID ( ) const
protectedvirtual

Implements GameAction.

Definition at line 230 of file servicecommand.cpp.

References ActionRegistry::ServiceCommand.

ContainerBase* ServiceCommand::getRefueller ( )
inline
TransferHandler & ServiceCommand::getTransferHandler ( )

each call to getTransferHandler will deallocate the previous handler and create a new one Make sure to not have any pointers to the old one around when calling this another time

Definition at line 93 of file servicecommand.cpp.

References ContainerCommand::getContainer(), and TransferHandler::getTransfers().

Referenced by AmmoTransferWindow::AmmoTransferWindow(), GuiFunctions::RefuelUnitCommand::execute(), and go().

ActionResult ServiceCommand::go ( const Context context)
virtual
void ServiceCommand::readData ( tnstream stream)
protectedvirtual

Reimplemented from ContainerCommand.

Definition at line 162 of file servicecommand.cpp.

References ContainerCommand::readData(), and tnstream::readInt().

void ServiceCommand::saveTransfers ( )
void ServiceCommand::setDestination ( ContainerBase destination)
void ServiceCommand::writeData ( tnstream stream) const
protectedvirtual

Reimplemented from ContainerCommand.

Definition at line 190 of file servicecommand.cpp.

References ContainerCommand::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: