OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AlienStrategy.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_ALIENSTRATEGY_H
20 #define OPENXCOM_ALIENSTRATEGY_H
21 
22 #include <yaml-cpp/yaml.h>
23 #include "WeightedOptions.h"
24 
25 namespace OpenXcom
26 {
27 class Ruleset;
28 
33 {
34 public:
36  AlienStrategy();
40  void init(const Ruleset *rules);
42  void load(const Ruleset *rules, const YAML::Node& node);
44  YAML::Node save() const;
46  const std::string chooseRandomRegion(const Ruleset *rules);
48  const std::string chooseRandomMission(const std::string &region) const;
50  bool removeMission(const std::string &region, const std::string &mission);
51 private:
53  WeightedOptions _regionChances;
55  std::map<std::string, WeightedOptions*> _regionMissions;
56 
57  // Disable copy and assignments.
59  AlienStrategy &operator=(const AlienStrategy &);
60 };
61 
62 }
63 
64 #endif
YAML::Node save() const
Saves the data to YAML.
Definition: AlienStrategy.cpp:100
void load(const Ruleset *rules, const YAML::Node &node)
Loads the data from YAML.
Definition: AlienStrategy.cpp:75
Stores the information about alien strategy.
Definition: AlienStrategy.h:32
~AlienStrategy()
Free resources used by the AlienStrategy.
Definition: AlienStrategy.cpp:44
const std::string chooseRandomRegion(const Ruleset *rules)
Choose a random region for a regular mission.
Definition: AlienStrategy.cpp:119
Set of rules and stats for a game.
Definition: Ruleset.h:69
bool removeMission(const std::string &region, const std::string &mission)
Remove a region and mission from the list of posibilities.
Definition: AlienStrategy.cpp:149
Holds pairs of relative weights and IDs.
Definition: WeightedOptions.h:34
AlienStrategy()
Create an AlienStrategy with no data.
Definition: AlienStrategy.cpp:36
const std::string chooseRandomMission(const std::string &region) const
Choose a random mission for a region.
Definition: AlienStrategy.cpp:136
void init(const Ruleset *rules)
Initialize values according to the rules.
Definition: AlienStrategy.cpp:57