#include <moveunitcommand.h>
Inheritance diagram for MoveUnitCommand:

Public Types | |
| enum | SeachCapabilities { NoInterrupt = 1, DisableHeightChange = 2, LimitVerticalDirection = 4, ShortestHeightChange = 8 } |
| typedef map< MapCoordinate, AttackWeap > | FieldList |
Public Member Functions | |
| MoveUnitCommand (Vehicle *unit) | |
| void | setFlags (int flags) |
| ActionResult | searchFields (int height=-1, int capabilities=0) |
| void | setVerticalDirection (int dir) |
| defines whether we want to end up either at the same level of height (0), lower(<0), or heigher(>0) | |
| int | getVerticalDirection () const |
| void | calcPath () |
| const AStar3D::Path & | getPath () |
| void | setDestination (const MapCoordinate &destination) |
| void | setDestination (const MapCoordinate3D &destination) |
| ASCString | getCommandString () const |
| bool | isFieldReachable (const MapCoordinate &pos, bool direct) |
| checks if the field can be reached by the unit this turn Precondition: searchFields(int,int) was called | |
| bool | isFieldReachable3D (const MapCoordinate3D &pos, bool direct) |
| const set< MapCoordinate3D > & | getReachableFields () |
| this will return a 2D representation of the reachable fields. | |
| const set< MapCoordinate3D > & | getReachableFieldsIndirect () |
| const Vehicle * | getUnit () const |
| Vehicle * | getUnit () |
| bool | longDistAvailable (const MapCoordinate &pos) |
| virtual vector< MapCoordinate > | getCoordinates () const |
| this is for informational purposes, so the player can see where a Command has taken place when reviewing it | |
| int | getCompletion () |
| bool | operatable () |
| checks if the task can still be operated. | |
| void | rearm () |
Static Public Member Functions | |
| static bool | avail (Vehicle *eht) |
| static bool | ascendAvail (Vehicle *eht) |
| static bool | descendAvail (Vehicle *eht) |
Protected Member Functions | |
| void | readData (tnstream &stream) |
| void | writeData (tnstream &stream) const |
| GameActionID | getID () const |
| ASCString | getDescription () const |
| ActionResult | go (const Context &context) |
Friends | |
| template<class Child> | |
| GameAction * | GameActionCreator (GameMap *map) |
Definition at line 36 of file moveunitcommand.h.
| typedef map<MapCoordinate,AttackWeap > MoveUnitCommand::FieldList |
Definition at line 42 of file moveunitcommand.h.
Definition at line 75 of file moveunitcommand.h.
| MoveUnitCommand::MoveUnitCommand | ( | Vehicle * | unit | ) |
Definition at line 97 of file moveunitcommand.cpp.
References ContainerBase::getMap(), and GameMap::sigCoordinateShift.
| bool MoveUnitCommand::avail | ( | Vehicle * | eht | ) | [static] |
Definition at line 36 of file moveunitcommand.cpp.
References Vehicle::canMove().
Referenced by GuiFunctions::MovementBase::available(), SearchReconquerBuilding::testfield(), and unitMovement().
| bool MoveUnitCommand::ascendAvail | ( | Vehicle * | eht | ) | [static] |
Definition at line 46 of file moveunitcommand.cpp.
References Vehicle::getHeightChange().
Referenced by GuiFunctions::Ascend::available().
| bool MoveUnitCommand::descendAvail | ( | Vehicle * | eht | ) | [static] |
Definition at line 54 of file moveunitcommand.cpp.
References Vehicle::getHeightChange().
Referenced by GuiFunctions::Descend::available().
| void MoveUnitCommand::readData | ( | tnstream & | stream | ) | [protected, virtual] |
Reimplemented from UnitCommand.
Definition at line 424 of file moveunitcommand.cpp.
References MapCoordinate3D::read(), UnitCommand::readData(), and tnstream::readInt().
| void MoveUnitCommand::writeData | ( | tnstream & | stream | ) | const [protected, virtual] |
Reimplemented from UnitCommand.
Definition at line 440 of file moveunitcommand.cpp.
References MapCoordinate3D::write(), UnitCommand::writeData(), and tnstream::writeInt().
| GameActionID MoveUnitCommand::getID | ( | ) | const [protected, virtual] |
Implements GameAction.
Definition at line 456 of file moveunitcommand.cpp.
References ActionRegistry::MoveUnitCommand.
| ASCString MoveUnitCommand::getDescription | ( | ) | const [protected, virtual] |
Implements GameAction.
Definition at line 461 of file moveunitcommand.cpp.
References Vehicle::getName(), getUnit(), and MapCoordinate::toString().
| ActionResult MoveUnitCommand::go | ( | const Context & | context | ) | [protected, virtual] |
Implements Command.
Definition at line 358 of file moveunitcommand.cpp.
References calcPath(), ContainerBase::damage, Context::display, GameAction::execute(), Command::Failed, Command::Finished, GameAction::getMap(), MapCoordinate3D::getNumericalHeight(), Command::getState(), getUnit(), TaskID::MoveUnit, Vehicle::networkid, NoInterrupt, Command::Run, Command::setState(), Command::SetUp, MapDisplayInterface::startAction(), MapDisplayInterface::stopAction(), ActionResult::successful(), MapCoordinate::x, and MapCoordinate::y.
| void MoveUnitCommand::setFlags | ( | int | flags | ) | [inline] |
Definition at line 81 of file moveunitcommand.h.
| ActionResult MoveUnitCommand::searchFields | ( | int | height = -1, |
|
| int | capabilities = 0 | |||
| ) |
Definition at line 191 of file moveunitcommand.cpp.
References DisableHeightChange, Command::Evaluated, fatalError(), getFirstBit(), Vehicle::getHeightChange(), GameAction::getMap(), Vehicle::getMovement(), MapCoordinate3D::getNumericalHeight(), Vehicle::getPosition(), getUnit(), getVerticalDirection(), Vehicle::height, VehicleType::HeightChangeMethod::heightDelta, LimitVerticalDirection, Command::setState(), and ShortestHeightChange.
Referenced by setDestination(), and SearchReconquerBuilding::testfield().
| void MoveUnitCommand::setVerticalDirection | ( | int | dir | ) |
defines whether we want to end up either at the same level of height (0), lower(<0), or heigher(>0)
Definition at line 415 of file moveunitcommand.cpp.
References LimitVerticalDirection.
| int MoveUnitCommand::getVerticalDirection | ( | ) | const [inline] |
Definition at line 88 of file moveunitcommand.h.
Referenced by GuiFunctions::Movement::available(), GuiFunctions::MovementBase::available(), and searchFields().
| void MoveUnitCommand::calcPath | ( | ) |
Definition at line 300 of file moveunitcommand.cpp.
References AStar3D::findPath(), GameMap::getField(), GameAction::getMap(), getUnit(), isFieldReachable3D(), and pi.
Referenced by go().
| const AStar3D::Path & MoveUnitCommand::getPath | ( | ) |
Definition at line 352 of file moveunitcommand.cpp.
Referenced by GuiFunctions::MovementBase::available().
| void MoveUnitCommand::setDestination | ( | const MapCoordinate & | destination | ) |
Definition at line 245 of file moveunitcommand.cpp.
References Command::Evaluated, MapField::getContainer(), GameMap::getField(), GameAction::getMap(), Command::getState(), getUnit(), searchFields(), Command::setState(), Command::SetUp, MapCoordinate::x, and MapCoordinate::y.
| void MoveUnitCommand::setDestination | ( | const MapCoordinate3D & | destination | ) |
Definition at line 239 of file moveunitcommand.cpp.
References Command::setState(), and Command::SetUp.
| ASCString MoveUnitCommand::getCommandString | ( | ) | const [virtual] |
Implements Command.
Definition at line 450 of file moveunitcommand.cpp.
References ASCString::format(), MapCoordinate3D::getNumericalHeight(), UnitCommand::getUnitID(), MapCoordinate::x, and MapCoordinate::y.
| bool MoveUnitCommand::isFieldReachable | ( | const MapCoordinate & | pos, | |
| bool | direct | |||
| ) |
checks if the field can be reached by the unit this turn Precondition: searchFields(int,int) was called
| pos | the destination field to check | |
| direct | if true then only return true of the unit can stop on the destination field if false, then fields over which the unit can pass, but cannot stop (for example because another unit is standing there) will also return true |
Definition at line 277 of file moveunitcommand.cpp.
References MapCoordinate::x, and MapCoordinate::y.
Referenced by GuiFunctions::MovementBase::available(), and SearchReconquerBuilding::testfield().
| bool MoveUnitCommand::isFieldReachable3D | ( | const MapCoordinate3D & | pos, | |
| bool | direct | |||
| ) |
Definition at line 291 of file moveunitcommand.cpp.
References AStar3D::findPath(), GameAction::getMap(), and getUnit().
Referenced by calcPath().
| const set<MapCoordinate3D>& MoveUnitCommand::getReachableFields | ( | ) | [inline] |
this will return a 2D representation of the reachable fields.
That means, if the unit can go to different levels of height on the same field, this set will only contain the level of height which can be reached with the least movement.
These functions are geared towards the 2D user interface and are not well suited to AI usage
Definition at line 118 of file moveunitcommand.h.
| const set<MapCoordinate3D>& MoveUnitCommand::getReachableFieldsIndirect | ( | ) | [inline] |
Definition at line 119 of file moveunitcommand.h.
| const Vehicle* MoveUnitCommand::getUnit | ( | ) | const [inline] |
Reimplemented from UnitCommand.
Definition at line 121 of file moveunitcommand.h.
References UnitCommand::getUnit().
Referenced by calcPath(), getDescription(), go(), isFieldReachable3D(), longDistAvailable(), operatable(), searchFields(), and setDestination().
| Vehicle* MoveUnitCommand::getUnit | ( | ) | [inline] |
Reimplemented from UnitCommand.
Definition at line 122 of file moveunitcommand.h.
References UnitCommand::getUnit().
| bool MoveUnitCommand::longDistAvailable | ( | const MapCoordinate & | pos | ) |
Definition at line 64 of file moveunitcommand.cpp.
References fieldAccessible(), GameMap::getField(), GameAction::getMap(), getUnit(), and Vehicle::height.
Referenced by GuiFunctions::Movement::available().
| vector< MapCoordinate > MoveUnitCommand::getCoordinates | ( | ) | const [virtual] |
this is for informational purposes, so the player can see where a Command has taken place when reviewing it
Reimplemented from UnitCommand.
Definition at line 490 of file moveunitcommand.cpp.
| int MoveUnitCommand::getCompletion | ( | ) | [virtual] |
| bool MoveUnitCommand::operatable | ( | ) | [virtual] |
checks if the task can still be operated.
If the task's unit was shot down for example, this would be the method to detect it and return false
Implements TaskInterface.
Definition at line 477 of file moveunitcommand.cpp.
References getUnit().
| void MoveUnitCommand::rearm | ( | ) | [virtual] |
Implements TaskInterface.
Definition at line 482 of file moveunitcommand.cpp.
References GameAction::deleteChildren(), Command::Finished, Command::getState(), Command::Run, Command::setState(), and Command::SetUp.
| GameAction* GameActionCreator | ( | GameMap * | map | ) | [friend] |
1.5.1