OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
RuleAlienMission.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_RULEALIENMISSION_H
20 #define OPENXCOM_RULEALIENMISSION_H
21 
22 #include <vector>
23 #include <string>
24 #include <yaml-cpp/yaml.h>
25 
26 namespace OpenXcom
27 {
28 
29 class WeightedOptions;
30 
36 {
38  std::string ufoType;
40 
43  size_t ufoCount;
45 
48  std::string trajectory;
50 
53  size_t spawnTimer;
54 };
55 
62 {
63 public:
64  RuleAlienMission(const std::string &type);
68  const std::string &getType() const { return _type; }
70  const std::string generateRace(const size_t monthsPassed) const;
72  const std::string getTopRace(const size_t monthsPassed) const;
74  void load(const YAML::Node &node);
76  size_t getWaveCount() const { return _waves.size(); }
78  const MissionWave &getWave(size_t index) const { return _waves[index]; }
80  int getPoints() const;
81 private:
83  std::string _type;
85  std::vector<std::pair<size_t, WeightedOptions*> > _raceDistribution;
87  std::vector<MissionWave> _waves;
89  int _points;
90 
91 };
92 
93 }
94 #endif
size_t getWaveCount() const
Gets the number of waves.
Definition: RuleAlienMission.h:76
std::string ufoType
The type of the spawned UFOs.
Definition: RuleAlienMission.h:38
int getPoints() const
Gets the score for this mission.
Definition: RuleAlienMission.cpp:154
~RuleAlienMission()
Releases all resources held by the mission.
Definition: RuleAlienMission.cpp:142
size_t ufoCount
The number of UFOs that will be generated.
Definition: RuleAlienMission.h:43
const std::string generateRace(const size_t monthsPassed) const
Gets a race based on the game time and the racial distribution.
Definition: RuleAlienMission.cpp:124
size_t spawnTimer
Number of minutes between UFOs in the wave.
Definition: RuleAlienMission.h:53
std::string trajectory
The trajectory ID for this wave's UFOs.
Definition: RuleAlienMission.h:48
Information about a mission wave.
Definition: RuleAlienMission.h:35
Stores fixed information about a mission type.
Definition: RuleAlienMission.h:61
const MissionWave & getWave(size_t index) const
Gets the full wave information.
Definition: RuleAlienMission.h:78
const std::string getTopRace(const size_t monthsPassed) const
Gets the most likely race based on the game time and the racial distribution.
Definition: RuleAlienMission.cpp:133
void load(const YAML::Node &node)
Loads alien mission data from YAML.
Definition: RuleAlienMission.cpp:62
const std::string & getType() const
Gets the mission's type.
Definition: RuleAlienMission.h:68