OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Target.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_TARGET_H
20 #define OPENXCOM_TARGET_H
21 
22 #include <string>
23 #include <vector>
24 #include <yaml-cpp/yaml.h>
25 
26 namespace OpenXcom
27 {
28 
29 class Language;
30 
35 class Target
36 {
37 protected:
38  double _lon, _lat;
39  std::vector<Target*> _followers;
41  Target();
42 public:
44  virtual ~Target();
46  void load(const YAML::Node& node);
48  virtual YAML::Node save() const;
50  virtual YAML::Node saveId() const;
52  double getLongitude() const;
54  void setLongitude(double lon);
56  double getLatitude() const;
58  void setLatitude(double lat);
60  virtual std::wstring getName(Language *lang) const = 0;
62  std::vector<Target*> *getFollowers();
64  double getDistance(const Target *target) const;
65 };
66 
67 }
68 
69 #endif
virtual std::wstring getName(Language *lang) const =0
Gets the target's name.
virtual YAML::Node saveId() const
Saves the target's ID to YAML.
Definition: Target.cpp:76
double getLatitude() const
Gets the target's latitude.
Definition: Target.cpp:112
virtual YAML::Node save() const
Saves the target to YAML.
Definition: Target.cpp:64
double getDistance(const Target *target) const
Gets the distance to another target.
Definition: Target.cpp:153
Contains strings used throughout the game for localization.
Definition: Language.h:42
void setLatitude(double lat)
Sets the target's latitude.
Definition: Target.cpp:121
std::vector< Target * > * getFollowers()
Gets the target's followers.
Definition: Target.cpp:142
void setLongitude(double lon)
Sets the target's longitude.
Definition: Target.cpp:97
void load(const YAML::Node &node)
Loads the moving target from YAML.
Definition: Target.cpp:54
Base class for targets on the globe with a set of radian coordinates.
Definition: Target.h:35
Target()
Creates a target.
Definition: Target.cpp:31
virtual ~Target()
Cleans up the target.
Definition: Target.cpp:38
double getLongitude() const
Gets the target's longitude.
Definition: Target.cpp:88