2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2010-08-01 19:22:34 +00:00
|
|
|
/**
|
|
|
|
* @file newgrf_townname.h
|
2007-06-18 23:00:55 +00:00
|
|
|
* Header of Action 0F "universal holder" structure and functions
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
#ifndef NEWGRF_TOWNNAME_H
|
|
|
|
#define NEWGRF_TOWNNAME_H
|
|
|
|
|
2021-01-12 21:39:31 +00:00
|
|
|
#include <vector>
|
2008-05-06 15:11:33 +00:00
|
|
|
#include "strings_type.h"
|
|
|
|
|
2007-06-18 23:00:55 +00:00
|
|
|
struct NamePart {
|
2013-01-08 22:46:42 +00:00
|
|
|
byte prob; ///< The relative probability of the following name to appear in the bottom 7 bits.
|
2007-06-18 23:00:55 +00:00
|
|
|
union {
|
|
|
|
char *text; ///< If probability bit 7 is clear
|
|
|
|
byte id; ///< If probability bit 7 is set
|
|
|
|
} data;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NamePartList {
|
|
|
|
byte partcount;
|
|
|
|
byte bitstart;
|
|
|
|
byte bitcount;
|
|
|
|
uint16 maxprob;
|
|
|
|
NamePart *parts;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct GRFTownName {
|
|
|
|
uint32 grfid;
|
|
|
|
byte nb_gen;
|
|
|
|
byte id[128];
|
|
|
|
StringID name[128];
|
|
|
|
byte nbparts[128];
|
|
|
|
NamePartList *partlist[128];
|
|
|
|
GRFTownName *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
GRFTownName *AddGRFTownName(uint32 grfid);
|
|
|
|
GRFTownName *GetGRFTownName(uint32 grfid);
|
|
|
|
void DelGRFTownName(uint32 grfid);
|
|
|
|
void CleanUpGRFTownNames();
|
|
|
|
char *GRFTownNameGenerate(char *buf, uint32 grfid, uint16 gen, uint32 seed, const char *last);
|
|
|
|
uint32 GetGRFTownNameId(int gen);
|
|
|
|
uint16 GetGRFTownNameType(int gen);
|
2021-01-12 21:39:31 +00:00
|
|
|
StringID GetGRFTownNameName(uint gen);
|
|
|
|
|
|
|
|
const std::vector<StringID>& GetGRFTownNameList();
|
2007-06-18 23:00:55 +00:00
|
|
|
|
|
|
|
#endif /* NEWGRF_TOWNNAME_H */
|