OpenTTD Source: src/newgrf_townname.h Source File

OpenTTD Source 13.1

newgrf_townname.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 NEWGRF_TOWNNAME_H
14 #define NEWGRF_TOWNNAME_H
15
16 #include <vector>
17 #include "strings_type.h"
18
19 struct NamePart {
20 byte prob;
21 union {
22 char *text;
23 byte id;
24 } data;
25 };
26
27 struct NamePartList {
28 byte partcount;
29 byte bitstart;
30 byte bitcount;
31 uint16 maxprob;
32 NamePart *parts;
33 };
34
35 struct GRFTownName {
36 uint32 grfid;
37 byte nb_gen;
38 byte id[128];
39 StringID name[128];
40 byte nbparts[128];
41 NamePartList *partlist[128];
42 GRFTownName *next;
43 };
44
45 GRFTownName *AddGRFTownName(uint32 grfid);
46 GRFTownName *GetGRFTownName(uint32 grfid);
47 void DelGRFTownName(uint32 grfid);
48 void CleanUpGRFTownNames();
49 char *GRFTownNameGenerate(char *buf, uint32 grfid, uint16 gen, uint32 seed, const char *last);
50 uint32 GetGRFTownNameId(int gen);
51 uint16 GetGRFTownNameType(int gen);
52 StringID GetGRFTownNameName(uint gen);
53
54 const std::vector<StringID>& GetGRFTownNameList();
55
56 #endif /* NEWGRF_TOWNNAME_H */
NamePart::prob
byte prob
The relative probability of the following name to appear in the bottom 7 bits.
Definition: newgrf_townname.h:20
strings_type.h
NamePart::text
char * text
If probability bit 7 is clear.
Definition: newgrf_townname.h:22
GRFTownName
Definition: newgrf_townname.h:35
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
NamePartList
Definition: newgrf_townname.h:27
NamePart
Definition: newgrf_townname.h:19
NamePart::id
byte id
If probability bit 7 is set.
Definition: newgrf_townname.h:23