OpenXcom  1.0
Open-source clone of the original X-Com
SoldierNamePool.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include <string>
21 #include <vector>
22 #include "../Savegame/Soldier.h"
23 
24 namespace OpenXcom
25 {
26 
34 {
35 private:
36  std::vector<std::string> _maleFirst, _femaleFirst, _maleLast, _femaleLast;
37  std::vector<int> _lookWeights;
38  int _totalWeight, _femaleFrequency;
39 public:
45  void load(const std::string &filename);
47  std::string genName(SoldierGender *gender, int femaleFrequency) const;
49  size_t genLook(size_t numLooks);
50 };
51 
52 }
std::string genName(SoldierGender *gender, int femaleFrequency) const
Generates a new name from the pool.
Definition: SoldierNamePool.cpp:93
~SoldierNamePool()
Cleans up the pool.
Definition: SoldierNamePool.cpp:38
size_t genLook(size_t numLooks)
Generates an int representing the index of the soldier&#39;s look, when passed the maximum index value...
Definition: SoldierNamePool.cpp:136
Pool of soldier names to generate random names.
Definition: SoldierNamePool.h:33
SoldierNamePool()
Creates a blank pool.
Definition: SoldierNamePool.cpp:31
void load(const std::string &filename)
Loads the pool from YAML.
Definition: SoldierNamePool.cpp:46
Definition: BaseInfoState.cpp:40