OpenXcom  1.0
Open-source clone of the original X-Com
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, const 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, Mod *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, Mod *rule, std::string &article_id)
 get index of the given article id in the visible list. More...
 
static ArticleDefinitionList getAvailableArticles (SavedGame *save, Mod *rule)
 get list of researched articles More...
 
static ArticleStatecreateArticleState (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.

Main purpose is to open Ufopaedia from Geoscape, navigate between articles and release new articles after successful research.

Member Function Documentation

◆ createArticleState()

ArticleState * OpenXcom::Ufopaedia::createArticleState ( 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.

◆ getArticleIndex()

size_t OpenXcom::Ufopaedia::getArticleIndex ( SavedGame save,
Mod mod,
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.
modPointer to mod.
article_idArticle id to find.
Returns
Index of the given article id in the internal list, -1 if not found.

◆ getAvailableArticles()

ArticleDefinitionList OpenXcom::Ufopaedia::getAvailableArticles ( SavedGame save,
Mod mod 
)
staticprotected

get list of researched articles

Return an ArticleList with all the currently visible ArticleIds.

Parameters
savePointer to saved game.
modPointer to mod.
Returns
List of visible ArticleDefinitions.

◆ isArticleAvailable()

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.

◆ list()

void OpenXcom::Ufopaedia::list ( SavedGame save,
Mod mod,
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.
modPointer to mod.
sectionArticle section to find, e.g. "XCOM Crafts & Armaments", "Alien Lifeforms", etc.
dataArticle definition list object to fill data in.

◆ next()

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.

◆ open()

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.

◆ openArticle() [1/2]

void OpenXcom::Ufopaedia::openArticle ( Game game,
const std::string &  article_id 
)
static

open Ufopaedia on a certain entry.

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

Parameters
gamePointer to actual game.
article_idArticle id to find.

◆ openArticle() [2/2]

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.

◆ prev()

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: