OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Ufopaedia.h
1 /*
2  * Copyright 2010-2014 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_UFOPAEDIA_H
20 #define OPENXCOM_UFOPAEDIA_H
21 
22 #include <vector>
23 #include <string>
24 
25 namespace OpenXcom
26 {
27  class Game;
28  class SavedGame;
29  class Ruleset;
30  class ArticleDefinition;
31  class ArticleState;
32 
34  typedef std::vector<ArticleDefinition *> ArticleDefinitionList;
35 
37  static const std::string UFOPAEDIA_XCOM_CRAFT_ARMAMENT = "STR_XCOM_CRAFT_ARMAMENT";
38  static const std::string UFOPAEDIA_HEAVY_WEAPONS_PLATFORMS = "STR_HEAVY_WEAPONS_PLATFORMS";
39  static const std::string UFOPAEDIA_WEAPONS_AND_EQUIPMENT = "STR_WEAPONS_AND_EQUIPMENT";
40  static const std::string UFOPAEDIA_ALIEN_ARTIFACTS = "STR_ALIEN_ARTIFACTS";
41  static const std::string UFOPAEDIA_BASE_FACILITIES = "STR_BASE_FACILITIES";
42  static const std::string UFOPAEDIA_ALIEN_LIFE_FORMS = "STR_ALIEN_LIFE_FORMS";
43  static const std::string UFOPAEDIA_ALIEN_RESEARCH = "STR_ALIEN_RESEARCH_UC";
44  static const std::string UFOPAEDIA_UFO_COMPONENTS = "STR_UFO_COMPONENTS";
45  static const std::string UFOPAEDIA_UFOS = "STR_UFOS";
46  static const std::string UFOPAEDIA_NOT_AVAILABLE = "STR_NOT_AVAILABLE";
47  // This last section is meant for articles, that have to be activated,
48  // but have no own entry in a list. E.g. Ammunition items.
49  // Maybe others as well, that should just not be selectable.
50 
59  class Ufopaedia
60  {
61  public:
63  static bool isArticleAvailable(SavedGame *save, ArticleDefinition *article);
64 
66  static void openArticle(Game *game, std::string &article_id);
67 
69  static void openArticle(Game *game, ArticleDefinition *article);
70 
72  static void open(Game *game);
73 
75  static void next(Game *game);
76 
78  static void prev(Game *game);
79 
81  static void list(SavedGame *save, Ruleset *rule, const std::string &section, ArticleDefinitionList &data);
82 
83  protected:
84 
86  static size_t _current_index;
87 
89  static size_t getArticleIndex(SavedGame *save, Ruleset *rule, std::string &article_id);
90 
93 
95  static ArticleState *createArticleState(Game *game, ArticleDefinition *article);
96  };
97 }
98 
99 #endif
The game data that gets written to disk when the game is saved.
Definition: SavedGame.h:80
static bool isArticleAvailable(SavedGame *save, ArticleDefinition *article)
check, if a specific article is currently available.
Definition: Ufopaedia.cpp:47
static void openArticle(Game *game, std::string &article_id)
open Ufopaedia on a certain entry.
Definition: Ufopaedia.cpp:149
static void prev(Game *game)
article navigation to previous article.
Definition: Ufopaedia.cpp:192
static void open(Game *game)
open Ufopaedia with selection dialog.
Definition: Ufopaedia.cpp:163
Set of rules and stats for a game.
Definition: Ruleset.h:69
static ArticleState * createArticleState(Game *game, ArticleDefinition *article)
create a new state object from article definition.
Definition: Ufopaedia.cpp:93
ArticleDefinition is the base class for all article types.
Definition: ArticleDefinition.h:49
UfopaediaArticle is the base class for all articles of various types.
Definition: ArticleState.h:40
static ArticleDefinitionList getAvailableArticles(SavedGame *save, Ruleset *rule)
get list of researched articles
Definition: Ufopaedia.cpp:233
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:44
static size_t _current_index
current selected article index (for prev/next navigation).
Definition: Ufopaedia.h:86
std::vector< ArticleDefinition * > ArticleDefinitionList
definition of an article list
Definition: Ufopaedia.h:31
static void next(Game *game)
article navigation to next article.
Definition: Ufopaedia.cpp:172
static void list(SavedGame *save, Ruleset *rule, const std::string &section, ArticleDefinitionList &data)
load a vector with article ids that are currently visible of a given section.
Definition: Ufopaedia.cpp:215
static size_t getArticleIndex(SavedGame *save, Ruleset *rule, std::string &article_id)
get index of the given article id in the visible list.
Definition: Ufopaedia.cpp:60
This static class encapsulates all functions related to Ufopaedia for the game.
Definition: Ufopaedia.h:59