OpenXcom
1.0
Open-source clone of the original X-Com
|
Base class for moving targets on the globe with a certain speed and destination. More...
#include <MovingTarget.h>
Public Member Functions | |
virtual | ~MovingTarget () |
Cleans up the moving target. More... | |
void | load (const YAML::Node &node) |
Loads the moving target from YAML. More... | |
virtual YAML::Node | save () const |
Saves the moving target to YAML. More... | |
Target * | getDestination () const |
Gets the moving target's destination. More... | |
virtual void | setDestination (Target *dest) |
Sets the moving target's destination. More... | |
int | getSpeed () const |
Gets the moving target's speed. More... | |
void | setSpeed (int speed) |
Sets the moving target's speed. More... | |
bool | reachedDestination () const |
Has the moving target reached its destination? More... | |
void | move () |
Move towards the destination. More... | |
Public Member Functions inherited from OpenXcom::Target | |
virtual | ~Target () |
Cleans up the target. More... | |
void | load (const YAML::Node &node) |
Loads the moving target from YAML. More... | |
virtual YAML::Node | saveId () const |
Saves the target's ID to YAML. More... | |
double | getLongitude () const |
Gets the target's longitude. More... | |
void | setLongitude (double lon) |
Sets the target's longitude. More... | |
double | getLatitude () const |
Gets the target's latitude. More... | |
void | setLatitude (double lat) |
Sets the target's latitude. More... | |
virtual std::wstring | getName (Language *lang) const =0 |
Gets the target's name. | |
std::vector< Target * > * | getFollowers () |
Gets the target's followers. More... | |
double | getDistance (const Target *target) const |
Gets the distance to another target. More... | |
Protected Member Functions | |
virtual void | calculateSpeed () |
Calculates a new speed vector to the destination. More... | |
MovingTarget () | |
Creates a moving target. More... | |
Protected Member Functions inherited from OpenXcom::Target | |
Target () | |
Creates a target. More... | |
Base class for moving targets on the globe with a certain speed and destination.
|
protected |
Creates a moving target.
Initializes a moving target with blank coordinates.
|
virtual |
Cleans up the moving target.
Make sure to cleanup the target's destination followers.
|
protectedvirtual |
Calculates a new speed vector to the destination.
Calculates the speed vector based on the great circle distance to destination and current raw speed.
Target * OpenXcom::MovingTarget::getDestination | ( | ) | const |
Gets the moving target's destination.
Returns the destination the moving target is heading to.
int OpenXcom::MovingTarget::getSpeed | ( | ) | const |
Gets the moving target's speed.
Returns the speed of the moving target.
void OpenXcom::MovingTarget::load | ( | const YAML::Node & | node | ) |
Loads the moving target from YAML.
Loads the moving target from a YAML file.
node | YAML node. |
void OpenXcom::MovingTarget::move | ( | ) |
Move towards the destination.
Executes a movement cycle for the moving target.
bool OpenXcom::MovingTarget::reachedDestination | ( | ) | const |
Has the moving target reached its destination?
Checks if the moving target has reached its destination.
|
virtual |
Saves the moving target to YAML.
Saves the moving target to a YAML file.
Reimplemented from OpenXcom::Target.
Reimplemented in OpenXcom::Craft.
|
virtual |
Sets the moving target's destination.
Changes the destination the moving target is heading to.
dest | Pointer to destination. |
Reimplemented in OpenXcom::Ufo, and OpenXcom::Craft.
void OpenXcom::MovingTarget::setSpeed | ( | int | speed | ) |
Sets the moving target's speed.
Changes the speed of the moving target and converts it from standard knots (nautical miles per hour) into radians per 5 in-game seconds.
speed | Speed in knots. |