OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Static Public Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
OpenXcom::Ufopaedia Class Reference

This static class encapsulates all functions related to Ufopaedia for the game. More...

#include <Ufopaedia.h>

Static Public Member Functions

static bool isArticleAvailable (SavedGame *save, ArticleDefinition *article)
 check, if a specific article is currently available. More...
 
static void openArticle (Game *game, std::string &article_id)
 open Ufopaedia on a certain entry. More...
 
static void openArticle (Game *game, ArticleDefinition *article)
 open Ufopaedia article from a given article definition. More...
 
static void open (Game *game)
 open Ufopaedia with selection dialog. More...
 
static void next (Game *game)
 article navigation to next article. More...
 
static void prev (Game *game)
 article navigation to previous article. More...
 
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. More...
 

Static Protected Member Functions

static size_t getArticleIndex (SavedGame *save, Ruleset *rule, std::string &article_id)
 get index of the given article id in the visible list. More...
 
static ArticleDefinitionList getAvailableArticles (SavedGame *save, Ruleset *rule)
 get list of researched articles More...
 
static ArticleStatecreateArticleState (Game *game, ArticleDefinition *article)
 create a new state object from article definition. More...
 

Static Protected Attributes

static size_t _current_index = 0
 current selected article index (for prev/next navigation).
 

Detailed Description

This static class encapsulates all functions related to Ufopaedia for the game.

It manages the relationship between the UfopaediaSaved instance in SavedGame and the UfopaediaFactory in Ruleset. Main purpose is to open Ufopaedia from Geoscape, navigate between articles and release new articles after successful research.

Member Function Documentation

ArticleState * OpenXcom::Ufopaedia::createArticleState ( Game game,
ArticleDefinition article 
)
staticprotected

create a new state object from article definition.

Creates a new article state dependent on the given article definition.

Parameters
gamePointer to actual game.
articleArticle definition to create from.
Returns
Article state object if created, 0 otherwise.
size_t OpenXcom::Ufopaedia::getArticleIndex ( SavedGame save,
Ruleset rule,
std::string &  article_id 
)
staticprotected

get index of the given article id in the visible list.

Gets the index of the selected article_id in the visible list.

If the id is not found, returns -1.

Parameters
savePointer to saved game.
rulePointer to ruleset.
article_idArticle id to find.
Returns
Index of the given article id in the internal list, -1 if not found.
ArticleDefinitionList OpenXcom::Ufopaedia::getAvailableArticles ( SavedGame save,
Ruleset rule 
)
staticprotected

get list of researched articles

Return an ArticleList with all the currently visible ArticleIds.

Parameters
savePointer to saved game.
rulePointer to ruleset.
Returns
List of visible ArticleDefinitions.
bool OpenXcom::Ufopaedia::isArticleAvailable ( SavedGame save,
ArticleDefinition article 
)
static

check, if a specific article is currently available.

Checks, if an article has already been released.

Parameters
savePointer to saved game.
articleArticle definition to release.
Returns
true, if the article is available.
void OpenXcom::Ufopaedia::list ( SavedGame save,
Ruleset rule,
const std::string &  section,
ArticleDefinitionList data 
)
static

load a vector with article ids that are currently visible of a given section.

Fill an ArticleList with the currently visible ArticleIds of the given section.

Parameters
savePointer to saved game.
rulePointer to ruleset.
sectionArticle section to find, e.g. "XCOM Crafts & Armaments", "Alien Lifeforms", etc.
dataArticle definition list object to fill data in.
void OpenXcom::Ufopaedia::next ( Game game)
static

article navigation to next article.

Open the next article in the list.

Loops to the first.

Parameters
gamePointer to actual game.
void OpenXcom::Ufopaedia::open ( Game game)
static

open Ufopaedia with selection dialog.

Open Ufopaedia start state, presenting the section selection buttons.

Parameters
gamePointer to actual game.
void OpenXcom::Ufopaedia::openArticle ( Game game,
std::string &  article_id 
)
static

open Ufopaedia on a certain entry.

Checks if selected article_id is available -> if yes, open it.

Otherwise, open start state!

Parameters
gamePointer to actual game.
article_idArticle id to find.
void OpenXcom::Ufopaedia::openArticle ( Game game,
ArticleDefinition article 
)
static

open Ufopaedia article from a given article definition.

Set UPSaved index and open the new state.

Parameters
gamePointer to actual game.
articleArticle definition of the article to open.
void OpenXcom::Ufopaedia::prev ( Game game)
static

article navigation to previous article.

Open the previous article in the list.

Loops to the last.

Parameters
gamePointer to actual game.

The documentation for this class was generated from the following files: