OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
UfoTrajectory.h
1 /*
2  * Copyright 2012 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_UFOTRAJECTORY_H
20 #define OPENXCOM_UFOTRAJECTORY_H
21 
22 #include <vector>
23 #include <string>
24 #include <yaml-cpp/yaml.h>
25 
26 namespace OpenXcom
27 {
28 
33 {
35  size_t zone;
37  size_t altitude;
39  size_t speed;
40 };
41 
42 YAML::Emitter &operator<<(YAML::Emitter &emitter, const TrajectoryWaypoint &wp);
43 bool operator>>(const YAML::Node &node, TrajectoryWaypoint &wp);
44 
50 {
51 public:
52  UfoTrajectory(const std::string &id);
57  const std::string &getID() const { return _id; }
58 
60  void load(const YAML::Node &node);
61 
66  size_t getWaypointCount() const { return _waypoints.size(); }
67 
73  size_t getZone(size_t wp) const { return _waypoints[wp].zone; }
74 
76  std::string getAltitude(size_t wp) const;
77 
83  float getSpeedPercentage(size_t wp) const { return _waypoints[wp].speed / 100.0f; }
84 
89  size_t groundTimer() const { return _groundTimer; }
90 private:
91  std::string _id;
92  size_t _groundTimer;
93  std::vector<TrajectoryWaypoint> _waypoints;
94 };
95 
96 }
97 #endif
size_t zone
The mission zone.
Definition: UfoTrajectory.h:35
size_t getWaypointCount() const
Gets the number of waypoints in this trajectory.
Definition: UfoTrajectory.h:66
float getSpeedPercentage(size_t wp) const
Gets the speed percentage at a waypoint.
Definition: UfoTrajectory.h:83
size_t speed
The speed percentage ([0..100])
Definition: UfoTrajectory.h:39
size_t altitude
The altitude to reach.
Definition: UfoTrajectory.h:37
Information for points on a UFO trajectory.
Definition: UfoTrajectory.h:32
size_t getZone(size_t wp) const
Gets the zone index at a waypoint.
Definition: UfoTrajectory.h:73
Holds information about a specific trajectory.
Definition: UfoTrajectory.h:49
const std::string & getID() const
Gets the trajectory's ID.
Definition: UfoTrajectory.h:57
size_t groundTimer() const
Gets the number of seconds UFOs should spend on the ground.
Definition: UfoTrajectory.h:89
std::string getAltitude(size_t wp) const
Gets the altitude at a waypoint.
Definition: UfoTrajectory.cpp:82
void load(const YAML::Node &node)
Loads trajectory data from YAML.
Definition: UfoTrajectory.cpp:70