![]() |
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... | |
| virtual 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... | |
| double | getSpeedRadian () const |
| Gets the moving target's radial 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... | |
| void | calculateMeetPoint () |
| Calculate meeting point with the target. | |
| double | getMeetLatitude () const |
| Returns the latitude of the meeting point. More... | |
| double | getMeetLongitude () const |
| Returns the longitude of the meeting point. More... | |
| void | resetMeetPoint () |
| Reset meeting point calculation. More... | |
| bool | isMeetCalculated () const |
| Returns if the meeting point was calculated. | |
Public Member Functions inherited from OpenXcom::Target | |
| virtual | ~Target () |
| Cleans up the target. More... | |
| YAML::Node | saveId () const |
| Saves the target's ID to YAML. More... | |
| virtual std::string | getType () const =0 |
| Gets the target's type. | |
| 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... | |
| int | getId () const |
| Gets the target's ID. More... | |
| void | setId (int id) |
| Sets the target's ID. More... | |
| virtual std::string | getName (Language *lang) const |
| Gets the target's name. More... | |
| void | setName (const std::string &newName) |
| Sets the target's name. More... | |
| virtual std::string | getDefaultName (Language *lang) const |
| Gets the target's default name. More... | |
| virtual std::string | getMarkerName () const |
| Gets the target's marker name. More... | |
| virtual int | getMarker () const =0 |
| Gets the target's marker sprite. | |
| std::vector< MovingTarget * > * | getFollowers () |
| Gets the target's followers. More... | |
| std::vector< Craft * > | getCraftFollowers () const |
| Gets the target's craft 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... | |
Static Protected Member Functions | |
| static double | calculateRadianSpeed (int speed) |
| Converts a speed to radians. 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.
|
staticprotected |
Converts a speed to radians.
Converts a speed in degrees to a speed in radians.
Each nautical mile is 1/60th of a degree. Each hour contains 720 5-seconds.
| speed | Speed in degrees. |
|
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.
| double OpenXcom::MovingTarget::getMeetLatitude | ( | ) | const |
Returns the latitude of the meeting point.
| double OpenXcom::MovingTarget::getMeetLongitude | ( | ) | const |
Returns the longitude of the meeting point.
| int OpenXcom::MovingTarget::getSpeed | ( | ) | const |
Gets the moving target's speed.
Returns the speed of the moving target.
| double OpenXcom::MovingTarget::getSpeedRadian | ( | ) | const |
Gets the moving target's radial speed.
Returns the radial speed of the moving target.
|
virtual |
Loads the moving target from YAML.
Loads the moving target from a YAML file.
| node | YAML node. |
Reimplemented from OpenXcom::Target.
| 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.
| void OpenXcom::MovingTarget::resetMeetPoint | ( | ) |
Reset meeting point calculation.
Forces the meeting point to be recalculated in the event that the target has changed direction.
|
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. |
1.8.14