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/>.
9 * @file newgrf_townname.h
10 * Header of Action 0F "universal holder" structure and functions
13 #ifndef NEWGRF_TOWNNAME_H
14 #define NEWGRF_TOWNNAME_H
16 #include "strings_type.h"
19 std::string text
; ///< If probability bit 7 is clear
20 byte id
; ///< If probability bit 7 is set
21 byte prob
; ///< The relative probability of the following name to appear in the bottom 7 bits.
25 byte bitstart
; ///< Start of random seed bits to use.
26 byte bitcount
; ///< Number of bits of random seed to use.
27 uint16_t maxprob
; ///< Total probability of all parts.
28 std::vector
<NamePart
> parts
; ///< List of parts to choose from.
31 struct TownNameStyle
{
32 StringID name
; ///< String ID of this town name style.
33 byte id
; ///< Index within partlist for this town name style.
35 TownNameStyle(StringID name
, byte id
) : name(name
), id(id
) { }
39 static const uint MAX_LISTS
= 128; ///< Maximum number of town name lists that can be defined per GRF.
41 uint32_t grfid
; ///< GRF ID of NewGRF.
42 std::vector
<TownNameStyle
> styles
; ///< Style names defined by the Town Name NewGRF.
43 std::vector
<NamePartList
> partlists
[MAX_LISTS
]; ///< Lists of town name parts.
46 GRFTownName
*AddGRFTownName(uint32_t grfid
);
47 GRFTownName
*GetGRFTownName(uint32_t grfid
);
48 void DelGRFTownName(uint32_t grfid
);
49 void CleanUpGRFTownNames();
50 uint32_t GetGRFTownNameId(uint16_t gen
);
51 uint16_t GetGRFTownNameType(uint16_t gen
);
52 StringID
GetGRFTownNameName(uint16_t gen
);
54 const std::vector
<StringID
> &GetGRFTownNameList();
56 #endif /* NEWGRF_TOWNNAME_H */