src/newgrf_townname.h
author rubidium
Wed, 09 Jul 2008 19:30:44 +0000
branch0.6
changeset 11131 d8136dad6b1c
parent 8760 ce0891c412ce
child 10429 1b99254f9607
permissions -rw-r--r--
(svn r13689) [0.6] -Backport from trunk:
- Fix: Server crashing when banning the rconning client (r13661)
- Fix: Incorrect usage of strtoul (r13508)
- Fix: Crash when one tries to raise the nothern corner of MP_VOID tiles (i.e. the southern corner of the tiles on the southern map edge) in the scenario editor [FS#2106] (r13624)
- Fix: Division by zero when one would press 'd' (skip order) when there's no order (r13409)
/* $Id$ */
#ifndef NEWGRF_TOWNNAME_H
#define NEWGRF_TOWNNAME_H

#include "strings_type.h"

/** @file newgrf_townname.h
 * Header of Action 0F "universal holder" structure and functions
 */

struct NamePart {
	byte prob;     ///< The relative probablity of the following name to appear in the bottom 7 bits.
	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();
StringID *GetGRFTownNameList();
char *GRFTownNameGenerate(char *buf, uint32 grfid, uint16 gen, uint32 seed, const char *last);
uint32 GetGRFTownNameId(int gen);
uint16 GetGRFTownNameType(int gen);

#endif /* NEWGRF_TOWNNAME_H */