Advanced Strategic Command
|
#include <recycleunitcommand.h>
Public Member Functions | |
RecycleUnitCommand (ContainerBase *carrier) | |
ActionResult | go (const Context &context) |
ASCString | getCommandString () const |
void | setUnit (Vehicle *unit) |
![]() | |
State | getState () const |
ActionResult | redo (const Context &context) |
virtual vector< MapCoordinate > | getCoordinates () const |
this is for informational purposes, so the player can see where a Command has taken place when reviewing it More... | |
![]() | |
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 | avail (const ContainerBase *carrier, const Vehicle *unit) |
static Resources | getOutput (const ContainerBase *carrier, const Vehicle *unit) |
![]() | |
static GameAction * | readFromStream (tnstream &stream, GameMap *map) |
Protected Member Functions | |
void | readData (tnstream &stream) |
void | writeData (tnstream &stream) const |
GameActionID | getID () const |
ASCString | getDescription () const |
![]() | |
ContainerBase * | getContainer (bool dontThrow=false) |
const ContainerBase * | getContainer (bool dontThrow=false) const |
int | getContainerID () const |
ContainerCommand (ContainerBase *container) | |
ContainerCommand (GameMap *map) | |
ActionResult | checkExecutionPrecondition () const |
![]() | |
Command (GameMap *gamemap) | |
void | setState (State state) |
virtual ActionResult | runAction (const Context &context) |
virtual ActionResult | undoAction (const Context &context) |
![]() | |
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... | |
GameMap * | getMap () |
const GameMap * | getMap () const |
Friends | |
template<class Child > | |
GameAction * | GameActionCreator (GameMap *map) |
Additional Inherited Members | |
![]() | |
enum | State { Planned, Evaluated, SetUp, Run, Finished, Failed } |
Definition at line 32 of file recycleunitcommand.h.
RecycleUnitCommand::RecycleUnitCommand | ( | ContainerBase * | carrier | ) |
Definition at line 75 of file recycleunitcommand.cpp.
|
static |
Definition at line 37 of file recycleunitcommand.cpp.
References ContainerBase::findUnit(), ContainerBase::isBuilding(), and Vehicle::networkid.
Referenced by CargoGuiFunctions::RecycleUnitCommandButton::available(), getOutput(), go(), and recycleUnit().
|
virtual |
Implements Command.
Definition at line 156 of file recycleunitcommand.cpp.
References ASCString::format(), and ContainerCommand::getContainerID().
|
protectedvirtual |
Implements GameAction.
Definition at line 169 of file recycleunitcommand.cpp.
References ContainerCommand::getContainer(), GameAction::getMap(), Vehicle::getName(), ContainerBase::getName(), and GameMap::getUnit().
|
protectedvirtual |
Implements GameAction.
Definition at line 164 of file recycleunitcommand.cpp.
References ActionRegistry::RecycleUnitCommand.
|
static |
Definition at line 52 of file recycleunitcommand.cpp.
References avail(), ContainerBase::baseType, ContainerBase::damage, destructoutput, ContainerBase::getCargo(), ContainerBaseType::hasFunction(), Resources::material, ContainerBaseType::productionCost, ContainerBaseType::RecycleUnits, recyclingoutput, and Vehicle::typ.
Referenced by CargoGuiFunctions::RecycleUnitCommandButton::getName(), and go().
|
virtual |
Implements Command.
Definition at line 85 of file recycleunitcommand.cpp.
References Context::actingPlayer, avail(), ActionRegistry::ConsumeResource, ActionRegistry::DestructContainer, GameAction::execute(), Command::Failed, Command::Finished, ContainerCommand::getContainer(), GameAction::getMap(), getOutput(), Player::getPosition(), Command::getState(), GameMap::getUnit(), ContainerBase::putResource(), ActionRegistry::ServiceCommand, Command::setState(), Command::SetUp, and ActionResult::successful().
|
protectedvirtual |
Reimplemented from ContainerCommand.
Definition at line 133 of file recycleunitcommand.cpp.
References ContainerCommand::readData(), tnstream::readInt(), and RecycleUnitCommandVersion.
void RecycleUnitCommand::setUnit | ( | Vehicle * | unit | ) |
Definition at line 149 of file recycleunitcommand.cpp.
References Vehicle::networkid, Command::setState(), and Command::SetUp.
Referenced by testRecycling().
|
protectedvirtual |
Reimplemented from ContainerCommand.
Definition at line 142 of file recycleunitcommand.cpp.
References RecycleUnitCommandVersion, ContainerCommand::writeData(), and tnstream::writeInt().
|
friend |