forked from OpenXcom/OpenXcom
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTarget.h
More file actions
89 lines (85 loc) · 2.63 KB
/
Copy pathTarget.h
File metadata and controls
89 lines (85 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#pragma once
/*
* Copyright 2010-2016 OpenXcom Developers.
*
* This file is part of OpenXcom.
*
* OpenXcom is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenXcom is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string>
#include <vector>
#include <yaml-cpp/yaml.h>
namespace OpenXcom
{
class Language;
class MovingTarget;
class Craft;
/**
* Base class for targets on the globe
* with a set of radian coordinates.
*/
class Target
{
protected:
double _lon, _lat;
int _id;
std::string _name;
std::vector<MovingTarget*> _followers;
/// Creates a target.
Target();
public:
/// Cleans up the target.
virtual ~Target();
/// Loads the target from YAML.
virtual void load(const YAML::Node& node);
/// Saves the target to YAML.
virtual YAML::Node save() const;
/// Saves the target's ID to YAML.
YAML::Node saveId() const;
/// Gets the target's type.
virtual std::string getType() const = 0;
/// Gets the target's longitude.
double getLongitude() const;
/// Sets the target's longitude.
void setLongitude(double lon);
/// Gets the target's latitude.
double getLatitude() const;
/// Sets the target's latitude.
void setLatitude(double lat);
/// Gets the target's ID.
int getId() const;
/// Sets the target's ID.
void setId(int id);
/// Gets the target's name.
virtual std::string getName(Language *lang) const;
/// Sets the target's name.
void setName(const std::string &newName);
/// Gets the target's default name.
virtual std::string getDefaultName(Language *lang) const;
/// Gets the target's marker name.
virtual std::string getMarkerName() const;
/// Gets the target's marker ID.
virtual int getMarkerId() const;
/// Gets the target's marker sprite.
virtual int getMarker() const = 0;
/// Gets the target's followers.
std::vector<MovingTarget*> *getFollowers();
/// Gets the target's craft followers.
std::vector<Craft*> getCraftFollowers() const;
/// Gets the distance to another target.
double getDistance(const Target *target) const { return getDistance(target->getLongitude(), target->getLatitude()); }
/// Gets the distance to another position.
double getDistance(double lon, double lat) const;
};
}