newgrf_text.h
author belugas
Fri, 21 Apr 2006 03:00:20 +0000
changeset 3601 138bf309cf27
child 3605 2caa3194832f
permissions -rw-r--r--
(svn r4493) Newgrf : Action 04. Beginning of implementation.
Some TODOs left, but the core is there.
Thanks to Peter1138 for code, advice and patience
And to Patchman for letting us define a lot of langids :)
3601
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
     1
/* $Id$ */
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
     2
#ifndef NEWGRF_TEXT_H
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
     3
#define NEWGRF_TEXT_H
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
     4
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
     5
/** @file
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
     6
 * Header of Action 04 "universal holder" structure and functions
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
     7
 */
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
     8
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
     9
#define MAX_LANG 28
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    10
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    11
/**
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    12
 * Element of the linked list.
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    13
 * Each of those elements represent the string,
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    14
 * but according to a different lang.
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    15
 */
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    16
typedef struct GRFText {
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    17
	byte langid;
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    18
	char *text;
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    19
	struct GRFText *next;
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    20
} GRFText;
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    21
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    22
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    23
/**
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    24
 * Holder of the above structure.
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    25
 * Putting both grfid and stringid togueter allow us to avoid duplicates,
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    26
 * since it is NOT SUPPOSED to happen.
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    27
 */
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    28
typedef struct GRFTextEntry {
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    29
	uint32 grfid;
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    30
	uint16 stringid;
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    31
	GRFText *textholder;
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    32
} GRFTextEntry;
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    33
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    34
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    35
StringID AddGRFString(uint32 grfid, uint16 stringid, byte langid, const char *text_to_add);
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    36
StringID GetGRFStringID(uint32 grfid, uint16 stringid);
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    37
char *GetGRFString(char *buff, uint16 stringid);
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    38
void CleanUpStrings(void);
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    39
void SetCurrentGrfLangID(const char *iso_name);
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    40
138bf309cf27 (svn r4493) Newgrf : Action 04. Beginning of implementation.
belugas
parents:
diff changeset
    41
#endif /* NEWGRF_TEXT_H */