OpenXcom  1.0
Open-source clone of the original X-Com
Target.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <string>
21 #include <vector>
22 #include <yaml-cpp/yaml.h>
23 
24 namespace OpenXcom
25 {
26 
27 class Language;
28 class MovingTarget;
29 class Craft;
30 
35 class Target
36 {
37 protected:
38  double _lon, _lat;
39  int _id;
40  std::string _name;
41  std::vector<MovingTarget*> _followers;
43  Target();
44 public:
46  virtual ~Target();
48  virtual void load(const YAML::Node& node);
50  virtual YAML::Node save() const;
52  YAML::Node saveId() const;
54  virtual std::string getType() const = 0;
56  double getLongitude() const;
58  void setLongitude(double lon);
60  double getLatitude() const;
62  void setLatitude(double lat);
64  int getId() const;
66  void setId(int id);
68  virtual std::string getName(Language *lang) const;
70  void setName(const std::string &newName);
72  virtual std::string getDefaultName(Language *lang) const;
74  virtual std::string getMarkerName() const;
76  virtual int getMarker() const = 0;
78  std::vector<MovingTarget*> *getFollowers();
80  std::vector<Craft*> getCraftFollowers() const;
82  double getDistance(const Target *target) const;
83 };
84 
85 }
virtual YAML::Node save() const
Saves the target to YAML.
Definition: Target.cpp:66
std::vector< Craft * > getCraftFollowers() const
Gets the target&#39;s craft followers.
Definition: Target.cpp:219
void setName(const std::string &newName)
Sets the target&#39;s name.
Definition: Target.cpp:180
virtual std::string getType() const =0
Gets the target&#39;s type.
double getDistance(const Target *target) const
Gets the distance to another target.
Definition: Target.cpp:239
std::vector< MovingTarget * > * getFollowers()
Gets the target&#39;s followers.
Definition: Target.cpp:209
Contains strings used throughout the game for localization.
Definition: Language.h:39
void setLatitude(double lat)
Sets the target&#39;s latitude.
Definition: Target.cpp:129
double getLatitude() const
Gets the target&#39;s latitude.
Definition: Target.cpp:120
YAML::Node saveId() const
Saves the target&#39;s ID to YAML.
Definition: Target.cpp:82
int getId() const
Gets the target&#39;s ID.
Definition: Target.cpp:149
double getLongitude() const
Gets the target&#39;s longitude.
Definition: Target.cpp:96
virtual std::string getDefaultName(Language *lang) const
Gets the target&#39;s default name.
Definition: Target.cpp:190
virtual std::string getMarkerName() const
Gets the target&#39;s marker name.
Definition: Target.cpp:199
virtual std::string getName(Language *lang) const
Gets the target&#39;s name.
Definition: Target.cpp:169
void setId(int id)
Sets the target&#39;s ID.
Definition: Target.cpp:158
void setLongitude(double lon)
Sets the target&#39;s longitude.
Definition: Target.cpp:105
virtual void load(const YAML::Node &node)
Loads the target from YAML.
Definition: Target.cpp:51
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
Definition: BaseInfoState.cpp:40
virtual ~Target()
Cleans up the target.
Definition: Target.cpp:38
virtual int getMarker() const =0
Gets the target&#39;s marker sprite.