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

Pool of soldier names to generate random names. More...

#include <SoldierNamePool.h>

Public Member Functions

 SoldierNamePool ()
 Creates a blank pool. More...
 
 ~SoldierNamePool ()
 Cleans up the pool.
 
void load (const std::string &filename)
 Loads the pool from YAML. More...
 
std::wstring genName (SoldierGender *gender) const
 Generates a new name from the pool. More...
 
size_t genLook (size_t numLooks)
 Generates an int representing the index of the soldier's look, when passed the maximum index value. More...
 

Detailed Description

Pool of soldier names to generate random names.

Each pool contains a set of first names (male or female) and last names. The first names define the soldier's gender, and are randomly associated with a last name.

Constructor & Destructor Documentation

OpenXcom::SoldierNamePool::SoldierNamePool ( )

Creates a blank pool.

Initializes a new pool with blank lists of names.

Member Function Documentation

size_t OpenXcom::SoldierNamePool::genLook ( size_t  numLooks)

Generates an int representing the index of the soldier's look, when passed the maximum index value.

Parameters
numLooksThe maximum index.
Returns
The index of the soldier's look.
std::wstring OpenXcom::SoldierNamePool::genName ( SoldierGender *  gender) const

Generates a new name from the pool.

Returns a new random name (first + last) from the lists of names contained within.

Parameters
genderReturned gender of the name.
Returns
The soldier's name.
void OpenXcom::SoldierNamePool::load ( const std::string &  filename)

Loads the pool from YAML.

Loads the pool from a YAML file.

Parameters
filenameYAML file.

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