Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
Public Member Functions | Private Attributes | List of all members
cqsp::common::systems::names::NameGenerator Class Reference

Name generator is pretty straightforward Format: More...

#include <namegenerator.h>

Public Member Functions

std::string Generate (const std::string &rule_name)
 
void LoadNameGenerator (const Hjson::Value &value)
 
void SetRandom (util::IRandom *rand)
 
const std::string & GetName ()
 

Private Attributes

std::map< std::string, std::vector< std::string > > syllables_list
 
std::map< std::string, std::string > rule_list
 
std::string name
 
util::IRandomrandom
 

Detailed Description

Name generator is pretty straightforward Format:

{
name: [generator name]
rules: {
[rule name]: [format]
}
[syllable name]: [
[Array of syllables]
]
[syllable name]: [
]
// more syllables
}
std::string name
Definition: namegenerator.h:66

The format string is processed in fmt, so it would look like this: {[syllable 1 name]}{[syllable 2 name]}.

For each syllable, a random syllable will be selected from the array, according to the random generator that you provide, and formatted into the string.

In the future, I would like to have a more adaptable naming scheme capable of naming cities and other things after people and the events, but for now a simple name generator would do.

Member Function Documentation

◆ Generate()

std::string NameGenerator::Generate ( const std::string &  rule_name)

◆ GetName()

const std::string & cqsp::common::systems::names::NameGenerator::GetName ( )
inline

◆ LoadNameGenerator()

void NameGenerator::LoadNameGenerator ( const Hjson::Value &  value)

◆ SetRandom()

void cqsp::common::systems::names::NameGenerator::SetRandom ( util::IRandom rand)
inline

Member Data Documentation

◆ name

std::string cqsp::common::systems::names::NameGenerator::name
private

◆ random

util::IRandom* cqsp::common::systems::names::NameGenerator::random
private

◆ rule_list

std::map<std::string, std::string> cqsp::common::systems::names::NameGenerator::rule_list
private

◆ syllables_list

std::map<std::string, std::vector<std::string> > cqsp::common::systems::names::NameGenerator::syllables_list
private

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