OpenXcom  1.0
Open-source clone of the original X-Com
RuleResearch.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 <string>
21 #include <vector>
22 #include <yaml-cpp/yaml.h>
23 
24 namespace OpenXcom
25 {
39 {
40  private:
41  std::string _name, _lookup, _cutscene;
42  int _cost, _points;
43  std::vector<std::string> _dependencies, _unlocks, _getOneFree, _requires;
44  bool _needItem, _destroyItem;
45  int _listOrder;
46 public:
47  RuleResearch(const std::string & name);
49  void load(const YAML::Node& node, int listOrder);
51  int getCost() const;
53  const std::string & getName() const;
55  const std::vector<std::string> & getDependencies() const;
57  bool needItem() const;
59  bool destroyItem() const;
61  const std::vector<std::string> & getUnlocked() const;
63  int getPoints() const;
65  const std::vector<std::string> & getGetOneFree() const;
67  std::string getLookup() const;
69  const std::vector<std::string> & getRequirements() const;
71  int getListOrder() const;
73  const std::string & getCutscene() const;
74 };
75 
80 {
81 public:
82  bool operator()(const RuleResearch *a, const RuleResearch *b) const
83  {
84  return a->getName() < b->getName();
85  }
86 };
87 
88 }
bool destroyItem() const
Checks if this ResearchProject consumes the corresponding Item when research completes.
Definition: RuleResearch.cpp:99
std::string getLookup() const
Gets what to look up in the ufopedia.
Definition: RuleResearch.cpp:134
void load(const YAML::Node &node, int listOrder)
Loads the research from YAML.
Definition: RuleResearch.cpp:34
Compares RuleResearch pointers based on the research name.
Definition: RuleResearch.h:79
const std::vector< std::string > & getRequirements() const
Gets the requirements for this ResearchProject.
Definition: RuleResearch.cpp:143
const std::string & getCutscene() const
Gets the cutscene to play when this item is researched.
Definition: RuleResearch.cpp:161
int getListOrder() const
Gets the list weight for this research item.
Definition: RuleResearch.cpp:152
int getPoints() const
Gets the points earned for discovering this ResearchProject.
Definition: RuleResearch.cpp:116
const std::vector< std::string > & getDependencies() const
Gets the research dependencies.
Definition: RuleResearch.cpp:81
int getCost() const
Gets time needed to discover this ResearchProject.
Definition: RuleResearch.cpp:63
const std::vector< std::string > & getUnlocked() const
Gets the list of ResearchProjects unlocked by this research.
Definition: RuleResearch.cpp:107
const std::vector< std::string > & getGetOneFree() const
Gets the list of ResearchProjects granted at random for free by this research.
Definition: RuleResearch.cpp:125
bool needItem() const
Checks if this ResearchProject needs a corresponding Item to be researched.
Definition: RuleResearch.cpp:90
Represents one research project.
Definition: RuleResearch.h:38
const std::string & getName() const
Gets the research name.
Definition: RuleResearch.cpp:72
Definition: BaseInfoState.cpp:40