OpenTTD
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 "strings_type.h"
17 
18 struct NamePart {
19  byte prob;
20  union {
21  char *text;
22  byte id;
23  } data;
24 };
25 
26 struct NamePartList {
27  byte partcount;
28  byte bitstart;
29  byte bitcount;
30  uint16 maxprob;
31  NamePart *parts;
32 };
33 
34 struct GRFTownName {
35  uint32 grfid;
36  byte nb_gen;
37  byte id[128];
38  StringID name[128];
39  byte nbparts[128];
40  NamePartList *partlist[128];
41  GRFTownName *next;
42 };
43 
44 GRFTownName *AddGRFTownName(uint32 grfid);
45 GRFTownName *GetGRFTownName(uint32 grfid);
46 void DelGRFTownName(uint32 grfid);
47 void CleanUpGRFTownNames();
48 StringID *GetGRFTownNameList();
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 
53 #endif /* NEWGRF_TOWNNAME_H */
char * text
If probability bit 7 is clear.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
byte prob
The relative probability of the following name to appear in the bottom 7 bits.
Types related to strings.
byte id
If probability bit 7 is set.