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

#include <constructunitcommand.h>

Inheritance diagram for ConstructUnitCommand:
Inheritance graph


class  Lack
class  ProductionEntry

Public Types

enum  Mode { undefined, internal, external }
typedef vector
< ConstructUnitCommand::ProductionEntry
- Public Types inherited from Command
enum  State {
  Planned, Evaluated, SetUp, Run,
  Finished, Failed

Public Member Functions

 ConstructUnitCommand (ContainerBase *unit)
void setMode (Mode mode)
ActionResult go (const Context &context)
ASCString getCommandString () const
Lack unitProductionPrerequisites (const VehicleType *type) const
void setVehicleType (const VehicleType *type)
Producables getProduceableVehicles ()
vector< MapCoordinategetFields ()
bool isFieldUsable (const MapCoordinate &pos)
VehiclegetProducedUnit ()
void setTargetPosition (const MapCoordinate &pos)
- 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 externalConstructionAvail (const ContainerBase *eht)
static bool internalConstructionAvail (const ContainerBase *eht)
static bool avail (const ContainerBase *eht)
- 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
void readData (tnstream &stream)
void writeData (tnstream &stream) const
 ContainerCommand (ContainerBase *container)
 ContainerCommand (GameMap *map)
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


template<class Child >
GameActionGameActionCreator (GameMap *map)

Detailed Description

Definition at line 32 of file constructunitcommand.h.

Member Typedef Documentation

Definition at line 90 of file constructunitcommand.h.

Member Enumeration Documentation


Definition at line 38 of file constructunitcommand.h.

Constructor & Destructor Documentation

ConstructUnitCommand::ConstructUnitCommand ( ContainerBase unit)

Definition at line 71 of file constructunitcommand.cpp.

Member Function Documentation

bool ConstructUnitCommand::avail ( const ContainerBase eht)

Definition at line 65 of file constructunitcommand.cpp.

References externalConstructionAvail(), and internalConstructionAvail().

Referenced by constructUnit().

bool ConstructUnitCommand::externalConstructionAvail ( const ContainerBase eht)
ASCString ConstructUnitCommand::getCommandString ( ) const
ASCString ConstructUnitCommand::getDescription ( ) const
vector< MapCoordinate > ConstructUnitCommand::getFields ( )
GameActionID ConstructUnitCommand::getID ( ) const

Implements GameAction.

Definition at line 367 of file constructunitcommand.cpp.

References ActionRegistry::ConstructUnitCommand.

ConstructUnitCommand::Producables ConstructUnitCommand::getProduceableVehicles ( )
internallytrue for internal production (inside cargo bay), false for outside production(neighbouring field)
a collection of potentially producable units. Maybe some prerequisites are lacking, which is indicated by the Lack attribute

Definition at line 114 of file constructunitcommand.cpp.

References cgp_forbid_unitunit_construction, GameMap::UnitProduction::check(), external, ContainerCommand::getContainer(), Vehicle::getExternalVehicleConstructionCost(), GameMap::getgameparameter(), ContainerBase::getMap(), ContainerBase::getProduction(), GameMap::getvehicletype_byid(), Vehicle::typ, GameMap::unitProduction, unitProductionPrerequisites(), and VehicleType::vehiclesBuildable.

Referenced by go().

Vehicle * ConstructUnitCommand::getProducedUnit ( )
ActionResult ConstructUnitCommand::go ( const Context context)
bool ConstructUnitCommand::internalConstructionAvail ( const ContainerBase eht)
bool ConstructUnitCommand::isFieldUsable ( const MapCoordinate pos)

Definition at line 170 of file constructunitcommand.cpp.

References getFields().

Referenced by GuiFunctions::BuildVehicleCommand::available(), and go().

void ConstructUnitCommand::readData ( tnstream stream)

Reimplemented from Command.

Definition at line 324 of file constructunitcommand.cpp.

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

void ConstructUnitCommand::setMode ( Mode  mode)
void ConstructUnitCommand::setTargetPosition ( const MapCoordinate pos)
void ConstructUnitCommand::setVehicleType ( const VehicleType type)
ConstructUnitCommand::Lack ConstructUnitCommand::unitProductionPrerequisites ( const VehicleType type) const
void ConstructUnitCommand::writeData ( tnstream stream) const

Reimplemented from Command.

Definition at line 336 of file constructunitcommand.cpp.

References MapCoordinate::write(), ContainerCommand::writeData(), and tnstream::writeInt().

Friends And Related Function Documentation

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

Definition at line 114 of file action.h.

The documentation for this class was generated from the following files: