OpenTTD Source 20241224-master-gf74b0cf984
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
20typedef std::set<std::string> TownNames;
21
22static constexpr uint BUILTIN_TOWNNAME_GENERATOR_COUNT = SPECSTR_TOWNNAME_LAST - SPECSTR_TOWNNAME_START + 1;
23
29 uint32_t grfid;
30 uint16_t type;
31
36 TownNameParams(uint8_t town_name)
37 {
38 bool grf = town_name >= BUILTIN_TOWNNAME_GENERATOR_COUNT;
39 this->grfid = grf ? GetGRFTownNameId(town_name - BUILTIN_TOWNNAME_GENERATOR_COUNT) : 0;
40 this->type = grf ? GetGRFTownNameType(town_name - BUILTIN_TOWNNAME_GENERATOR_COUNT) : SPECSTR_TOWNNAME_START + town_name;
41 }
42
43 TownNameParams(const Town *t);
44};
45
46#endif /* TOWNNAME_TYPE_H */
Header of Action 0F "universal holder" structure and functions.
Types for strings.
Struct holding parameters used to generate town name.
TownNameParams(uint8_t town_name)
Initializes this struct from language ID.
uint16_t type
town name style
uint32_t grfid
newgrf ID (0 if not used)
Town data structure.
Definition town.h:54
Types related to towns.
static constexpr uint BUILTIN_TOWNNAME_GENERATOR_COUNT
Number of built-in town name generators.