OpenTTD Source: src/townname_type.h Source File

OpenTTD Source 1.11.0-RC1

townname_type.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
13 #ifndef TOWNNAME_TYPE_H
14 #define TOWNNAME_TYPE_H
15
16 #include "newgrf_townname.h"
17 #include "town_type.h"
18 #include "string_type.h"
19 #include <set>
20 #include <string>
21
22 typedef std::set<std::string> TownNames;
23
24 static constexpr uint BUILTIN_TOWNNAME_GENERATOR_COUNT = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1;
25
30 struct TownNameParams {
31 uint32 grfid;
32 uint16 type;
33
38 TownNameParams(byte town_name)
39 {
40 bool grf = town_name >= BUILTIN_TOWNNAME_GENERATOR_COUNT;
41 this->grfid = grf ? GetGRFTownNameId(town_name - BUILTIN_TOWNNAME_GENERATOR_COUNT) : 0;
42 this->type = grf ? GetGRFTownNameType(town_name - BUILTIN_TOWNNAME_GENERATOR_COUNT) : SPECSTR_TOWNNAME_START + town_name;
43 }
44
45 TownNameParams(const Town *t);
46 };
47
48 #endif /* TOWNNAME_TYPE_H */
TownNameParams::type
uint16 type
town name style
Definition: townname_type.h:32
TownNameParams::grfid
uint32 grfid
newgrf ID (0 if not used)
Definition: townname_type.h:31
newgrf_townname.h
TownNameParams::TownNameParams
TownNameParams(byte town_name)
Initializes this struct from language ID.
Definition: townname_type.h:38
string_type.h
BUILTIN_TOWNNAME_GENERATOR_COUNT
static constexpr uint BUILTIN_TOWNNAME_GENERATOR_COUNT
Number of built-in town name generators.
Definition: townname_type.h:24
TownNameParams
Struct holding parameters used to generate town name.
Definition: townname_type.h:30
Town
Town data structure.
Definition: town.h:50
town_type.h