OpenXcom  1.0
Open-source clone of the original X-Com
Public Member Functions | Protected Member Functions | List of all members
OpenXcom::Target Class Referenceabstract

Base class for targets on the globe with a set of radian coordinates. More...

#include <Target.h>

Inheritance diagram for OpenXcom::Target:
OpenXcom::AlienBase OpenXcom::Base OpenXcom::City OpenXcom::MissionSite OpenXcom::MovingTarget OpenXcom::Waypoint OpenXcom::Craft OpenXcom::Ufo

Public Member Functions

virtual ~Target ()
 Cleans up the target. More...
 
virtual void load (const YAML::Node &node)
 Loads the target from YAML. More...
 
virtual YAML::Node save () const
 Saves the target to YAML. 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

 Target ()
 Creates a target. More...
 

Detailed Description

Base class for targets on the globe with a set of radian coordinates.

Constructor & Destructor Documentation

◆ Target()

OpenXcom::Target::Target ( )
protected

Creates a target.

Initializes a target with blank coordinates.

◆ ~Target()

OpenXcom::Target::~Target ( )
virtual

Cleans up the target.

Make sure no crafts are chasing this target.

Member Function Documentation

◆ getCraftFollowers()

std::vector< Craft * > OpenXcom::Target::getCraftFollowers ( ) const

Gets the target's craft followers.

Returns the list of crafts currently following this target.

Returns
List of crafts.

◆ getDefaultName()

std::string OpenXcom::Target::getDefaultName ( Language lang) const
virtual

Gets the target's default name.

Returns the target's unique default name.

Parameters
langLanguage to get strings from.
Returns
Full name.

Reimplemented in OpenXcom::Ufo, and OpenXcom::Craft.

◆ getDistance()

double OpenXcom::Target::getDistance ( const Target target) const

Gets the distance to another target.

Returns the great circle distance to another target on the globe.

Parameters
targetPointer to other target.
Returns
Distance in radian.

◆ getFollowers()

std::vector< MovingTarget * > * OpenXcom::Target::getFollowers ( )

Gets the target's followers.

Returns the list of targets currently following this target.

Returns
Pointer to list of targets.

◆ getId()

int OpenXcom::Target::getId ( ) const

Gets the target's ID.

Returns the target's unique ID.

Returns
Unique ID, 0 if none.

◆ getLatitude()

double OpenXcom::Target::getLatitude ( ) const

Gets the target's latitude.

Returns the latitude coordinate of the target.

Returns
Latitude in radian.

◆ getLongitude()

double OpenXcom::Target::getLongitude ( ) const

Gets the target's longitude.

Returns the longitude coordinate of the target.

Returns
Longitude in radian.

◆ getMarkerName()

std::string OpenXcom::Target::getMarkerName ( ) const
virtual

Gets the target's marker name.

Returns the name on the globe for the target.

Returns
String ID.

Reimplemented in OpenXcom::Ufo, and OpenXcom::MissionSite.

◆ getName()

std::string OpenXcom::Target::getName ( Language lang) const
virtual

Gets the target's name.

Returns the target's user-readable name.

If there's no custom name, the language default is used.

Parameters
langLanguage to get strings from.
Returns
Full name.

Reimplemented in OpenXcom::Base, and OpenXcom::City.

◆ load()

void OpenXcom::Target::load ( const YAML::Node &  node)
virtual

Loads the target from YAML.

Loads the target from a YAML file.

Parameters
nodeYAML node.

Reimplemented in OpenXcom::MovingTarget, OpenXcom::MissionSite, and OpenXcom::AlienBase.

◆ save()

YAML::Node OpenXcom::Target::save ( ) const
virtual

Saves the target to YAML.

Saves the target to a YAML file.

Returns
YAML node.

Reimplemented in OpenXcom::Base, OpenXcom::Craft, OpenXcom::MovingTarget, OpenXcom::MissionSite, and OpenXcom::AlienBase.

◆ saveId()

YAML::Node OpenXcom::Target::saveId ( ) const

Saves the target's ID to YAML.

Saves the target's unique identifiers to a YAML file.

Returns
YAML node.

◆ setId()

void OpenXcom::Target::setId ( int  id)

Sets the target's ID.

Changes the target's unique ID.

Parameters
idUnique ID.

◆ setLatitude()

void OpenXcom::Target::setLatitude ( double  lat)

Sets the target's latitude.

Changes the latitude coordinate of the target.

Parameters
latLatitude in radian.

◆ setLongitude()

void OpenXcom::Target::setLongitude ( double  lon)

Sets the target's longitude.

Changes the longitude coordinate of the target.

Parameters
lonLongitude in radian.

◆ setName()

void OpenXcom::Target::setName ( const std::string &  newName)

Sets the target's name.

Changes the target's custom name.

Parameters
newNameNew custom name. If set to blank, the language default is used.

The documentation for this class was generated from the following files: