ConstructUnitCommand Class Reference

#include <constructunitcommand.h>

Inheritance diagram for ConstructUnitCommand:

Inheritance graph
[legend]
List of all members.

Public Types

enum  Mode { undefined, internal, external }
typedef vector< ConstructUnitCommand::ProductionEntryProducables

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 ()
 
Parameters:
internally,: true for internal production (inside cargo bay), false for outside production(neighbouring field)

vector< MapCoordinategetFields ()
bool isFieldUsable (const MapCoordinate &pos)
VehiclegetProducedUnit ()
void setTargetPosition (const MapCoordinate &pos)

Static Public Member Functions

static bool externalConstructionAvail (const ContainerBase *eht)
static bool internalConstructionAvail (const ContainerBase *eht)
static bool avail (const ContainerBase *eht)

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)

Classes

class  Lack
class  ProductionEntry

Detailed Description

Definition at line 32 of file constructunitcommand.h.


Member Typedef Documentation

typedef vector<ConstructUnitCommand::ProductionEntry> ConstructUnitCommand::Producables

Definition at line 90 of file constructunitcommand.h.


Member Enumeration Documentation

enum ConstructUnitCommand::Mode

Enumerator:
undefined 
internal 
external 

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::externalConstructionAvail ( const ContainerBase eht  )  [static]

Definition at line 41 of file constructunitcommand.cpp.

References GameMap::actplayer, Vehicle::attacked, GameMap::getField(), ContainerBase::getMap(), ContainerBase::getOwner(), Vehicle::getPosition(), Vehicle::typ, MapField::vehicle, and VehicleType::vehiclesBuildable.

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

bool ConstructUnitCommand::internalConstructionAvail ( const ContainerBase eht  )  [static]

Definition at line 56 of file constructunitcommand.cpp.

References GameMap::actplayer, ContainerBase::baseType, ContainerBase::getMap(), ContainerBase::getOwner(), ContainerBaseType::hasFunction(), ContainerBaseType::InternalVehicleProduction, ContainerBaseType::maxLoadableUnits, and ContainerBase::vehiclesLoaded().

Referenced by avail(), and CargoGuiFunctions::UnitProduction::available().

bool ConstructUnitCommand::avail ( const ContainerBase eht  )  [static]

Definition at line 65 of file constructunitcommand.cpp.

References externalConstructionAvail(), and internalConstructionAvail().

Referenced by constructUnit().

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

Reimplemented from ContainerCommand.

Definition at line 317 of file constructunitcommand.cpp.

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

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

Reimplemented from ContainerCommand.

Definition at line 329 of file constructunitcommand.cpp.

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

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

Implements GameAction.

Definition at line 360 of file constructunitcommand.cpp.

References ActionRegistry::ConstructUnitCommand.

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

Implements GameAction.

Definition at line 365 of file constructunitcommand.cpp.

References ContainerCommand::getContainer(), GameAction::getMap(), ContainerBase::getName(), GameMap::getvehicletype_byid(), ContainerBaseType::name, and MapCoordinate::toString().

void ConstructUnitCommand::setMode ( Mode  mode  ) 

Definition at line 307 of file constructunitcommand.cpp.

References ContainerCommand::getContainer(), ContainerBase::getPosition(), and internal.

Referenced by CargoGuiFunctions::UnitProduction::execute().

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

Implements Command.

Definition at line 192 of file constructunitcommand.cpp.

References GameMap::actplayer, Vehicle::attacked, ChangeUnitProperty::AttackedFlag, Player::buildingList, cgp_bi3_training, ActionRegistry::ChangeUnitMovement, ActionRegistry::ChangeUnitProperty, ActionRegistry::ConsumeResource, Context::display, GameAction::execute(), Vehicle::experience, external, Command::Failed, Command::Finished, ContainerCommand::getContainer(), GameMap::getgameparameter(), GameAction::getMap(), getProduceableVehicles(), Command::getState(), SpawnUnit::getUnit(), ContainerBaseType::height, isFieldUsable(), Vehicle::maxMovement(), maxunitexperience, Vehicle::networkid, GameMap::player, MapDisplayInterface::repaintDisplay(), Command::setState(), Command::SetUp, ActionRegistry::SpawnUnit, ActionResult::successful(), ContainerBaseType::TrainingCenter, Vehicle::typ, and VehicleType::unitConstructionMoveCostPercentage.

ASCString ConstructUnitCommand::getCommandString (  )  const [virtual]

Implements Command.

Definition at line 353 of file constructunitcommand.cpp.

References ASCString::format(), ContainerCommand::getContainerID(), MapCoordinate::x, and MapCoordinate::y.

ConstructUnitCommand::Lack ConstructUnitCommand::unitProductionPrerequisites ( const VehicleType type  )  const

Definition at line 79 of file constructunitcommand.cpp.

References TechAdapterDependency::available(), cgp_produceOnlyResearchedStuffExternally, cgp_produceOnlyResearchedStuffInternally, external, ContainerCommand::getContainer(), Vehicle::getExternalVehicleConstructionCost(), GameMap::getgameparameter(), GameAction::getMap(), Vehicle::getMovement(), ContainerBase::getProductionCost(), internal, Vehicle::maxMovement(), ConstructUnitCommand::Lack::Movement, ContainerBaseType::ProduceNonLeavableUnits, ConstructUnitCommand::Lack::Research, Resources::resource(), resourceTypeNum, ContainerBaseType::techDependency, Vehicle::typ, VehicleType::unitConstructionMoveCostPercentage, and ConstructUnitCommand::Lack::Unloadability.

Referenced by getProduceableVehicles().

void ConstructUnitCommand::setVehicleType ( const VehicleType type  ) 

Definition at line 339 of file constructunitcommand.cpp.

References GameAction::getMap(), GameMap::getvehicletype_byid(), ContainerBaseType::id, Command::setState(), Command::SetUp, undefined, and MapCoordinate::valid().

ConstructUnitCommand::Producables ConstructUnitCommand::getProduceableVehicles (  ) 

Parameters:
internally,: true for internal production (inside cargo bay), false for outside production(neighbouring field)

Returns:
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(), internal, Vehicle::typ, GameMap::unitProduction, unitProductionPrerequisites(), and VehicleType::vehiclesBuildable.

Referenced by go().

vector< MapCoordinate > ConstructUnitCommand::getFields (  ) 

Definition at line 157 of file constructunitcommand.cpp.

References circularFieldIterator(), ContainerCommand::getContainer(), ContainerBase::getMap(), Vehicle::getPosition(), Vehicle::typ, VehicleType::unitConstructionMaxDistance, and VehicleType::unitConstructionMinDistance.

Referenced by isFieldUsable().

bool ConstructUnitCommand::isFieldUsable ( const MapCoordinate pos  ) 

Definition at line 170 of file constructunitcommand.cpp.

References getFields().

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

Vehicle * ConstructUnitCommand::getProducedUnit (  ) 

Definition at line 299 of file constructunitcommand.cpp.

References GameAction::getMap(), and GameMap::getUnit().

Referenced by CargoGuiFunctions::UnitProduction::execute().

void ConstructUnitCommand::setTargetPosition ( const MapCoordinate pos  ) 

Definition at line 177 of file constructunitcommand.cpp.

References GameMap::getField(), GameAction::getMap(), Command::setState(), Command::SetUp, and undefined.

Referenced by GuiFunctions::BuildVehicleCommand::execute().


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