OpenXcom  1.0
Open-source clone of the original X-Com
UfoTrajectory.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 <vector>
21 #include <string>
22 #include <yaml-cpp/yaml.h>
23 
24 namespace OpenXcom
25 {
26 
31 {
33  size_t zone;
35  size_t altitude;
37  size_t speed;
38 };
39 
40 YAML::Emitter &operator<<(YAML::Emitter &emitter, const TrajectoryWaypoint &wp);
41 bool operator>>(const YAML::Node &node, TrajectoryWaypoint &wp);
42 
48 {
49 public:
50  static const std::string RETALIATION_ASSAULT_RUN;
51 
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 }
size_t zone
The mission zone.
Definition: UfoTrajectory.h:33
std::string getAltitude(size_t wp) const
Gets the altitude at a waypoint.
Definition: UfoTrajectory.cpp:75
size_t getWaypointCount() const
Gets the number of waypoints in this trajectory.
Definition: UfoTrajectory.h:66
size_t speed
The speed percentage ([0..100])
Definition: UfoTrajectory.h:37
size_t altitude
The altitude to reach.
Definition: UfoTrajectory.h:35
Information for points on a UFO trajectory.
Definition: UfoTrajectory.h:30
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:47
const std::string & getID() const
Gets the trajectory&#39;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
void load(const YAML::Node &node)
Loads trajectory data from YAML.
Definition: UfoTrajectory.cpp:63
float getSpeedPercentage(size_t wp) const
Gets the speed percentage at a waypoint.
Definition: UfoTrajectory.h:83
Definition: BaseInfoState.cpp:40