functions.h
author celestar
Fri, 29 Dec 2006 10:13:35 +0000
branchcustombridgeheads
changeset 5592 fd60d4ecc921
parent 5108 dc67d70b5a45
permissions -rw-r--r--
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2162
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2162
diff changeset
     2
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
#ifndef FUNCTIONS_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     4
#define FUNCTIONS_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
1589
58d173b56509 (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
     6
void DoClearSquare(TileIndex tile);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
     7
void RunTileLoop(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
3636
d87b21df2944 (svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents: 3416
diff changeset
     9
uint GetPartialZ(int x, int y, Slope corners);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
uint GetSlopeZ(int x, int y);
1589
58d173b56509 (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    11
uint32 GetTileTrackStatus(TileIndex tile, TransportType mode);
58d173b56509 (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    12
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
58d173b56509 (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    13
void ChangeTileOwner(TileIndex tile, byte old_player, byte new_player);
58d173b56509 (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    14
void AnimateTile(TileIndex tile);
58d173b56509 (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    15
void ClickTile(TileIndex tile);
58d173b56509 (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    16
void GetTileDesc(TileIndex tile, TileDesc *td);
1377
2a418162176e (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1335
diff changeset
    17
void UpdateTownMaxPass(Town *t);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
1589
58d173b56509 (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    19
bool IsValidTile(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
536
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    21
static inline Point RemapCoords(int x, int y, int z)
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    22
{
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    23
#if !defined(NEW_ROTATION)
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    24
	Point pt;
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    25
	pt.x = (y - x) * 2;
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    26
	pt.y = y + x - z;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
#else
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    28
	Point pt;
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    29
	pt.x = (x + y) * 2;
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    30
	pt.y = x - y - z;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    31
#endif
536
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    32
	return pt;
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    33
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
536
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    35
static inline Point RemapCoords2(int x, int y)
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    36
{
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    37
	return RemapCoords(x, y, GetSlopeZ(x, y));
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    38
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
/* clear_land.c */
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2380
diff changeset
    42
void DrawHillyLandTile(const TileInfo *ti);
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2380
diff changeset
    43
void DrawClearLandTile(const TileInfo *ti, byte set);
2220
6c186dad8188 (svn r2738) Small bit fiddling cleanup
tron
parents: 2210
diff changeset
    44
void DrawClearLandFence(const TileInfo *ti);
1420
5308b177b5b3 (svn r1924) Use same type names in declaration and implementation
tron
parents: 1377
diff changeset
    45
void TileLoopClearHelper(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    46
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    47
/* water_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    48
void DrawShipDepotSprite(int x, int y, int image);
1977
4392ae3d8e31 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
    49
void TileLoop_Water(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
/* players.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    52
bool CheckPlayerHasMoney(int32 cost);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    53
void SubtractMoneyFromPlayer(int32 cost);
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2380
diff changeset
    54
void SubtractMoneyFromPlayerFract(PlayerID player, int32 cost);
4849
9a3c3ae7f62f (svn r6775) -Codechange: Use some more proper types, especially Owner and PlayerID as
Darkvater
parents: 4833
diff changeset
    55
bool CheckOwnership(Owner owner);
1977
4392ae3d8e31 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
    56
bool CheckTileOwnership(TileIndex tile);
2475
8443e1eefe1b (svn r3001) s/Player*/const Player*/
tron
parents: 2471
diff changeset
    57
StringID GetPlayerNameString(PlayerID player, uint index);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
/* standard */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
void ShowInfo(const char *str);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
void CDECL ShowInfoF(const char *str, ...);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
void NORETURN CDECL error(const char *str, ...);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
2075
7f0ca01392db (svn r2585) - Fix [Makefile]: some small cleanups, remove warnings, and add mersenne to makefile (Luca)
Darkvater
parents: 2073
diff changeset
    64
/* openttd.c */
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    65
4432
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4300
diff changeset
    66
/**************
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4300
diff changeset
    67
 * Warning: DO NOT enable this unless you understand what it does
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4300
diff changeset
    68
 *
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4300
diff changeset
    69
 * If enabled, in a network game all randoms will be dumped to the
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4300
diff changeset
    70
 *  stdout if the first client joins (or if you are a client). This
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4300
diff changeset
    71
 *  is to help finding desync problems.
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4300
diff changeset
    72
 *
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4300
diff changeset
    73
 * Warning: DO NOT enable this unless you understand what it does
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4300
diff changeset
    74
 **************/
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    75
1539
3d5b40209884 (svn r2043) -Fix: committed too many files in the last commit
truelight
parents: 1538
diff changeset
    76
//#define RANDOM_DEBUG
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    77
2073
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    78
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    79
// Enable this to produce higher quality random numbers.
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    80
// Doesn't work with network yet.
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    81
//#define MERSENNE_TWISTER
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    82
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    83
// Mersenne twister functions
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    84
void SeedMT(uint32 seed);
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    85
uint32 RandomMT(void);
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    86
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    87
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    88
#ifdef MERSENNE_TWISTER
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    89
	static inline uint32 Random(void) { return RandomMT(); }
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    90
	uint RandomRange(uint max);
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    91
#else
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    92
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    93
#ifdef RANDOM_DEBUG
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    94
	#define Random() DoRandom(__LINE__, __FILE__)
1120
ea3bf8bc6678 (svn r1621) -Fix: fixed some compiler warnings for the random-debug-switch
truelight
parents: 1115
diff changeset
    95
	uint32 DoRandom(int line, const char *file);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    96
	#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
1120
ea3bf8bc6678 (svn r1621) -Fix: fixed some compiler warnings for the random-debug-switch
truelight
parents: 1115
diff changeset
    97
	uint DoRandomRange(uint max, int line, const char *file);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    98
#else
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
    99
	uint32 Random(void);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   100
	uint RandomRange(uint max);
2073
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   101
#endif
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   102
#endif // MERSENNE_TWISTER
2051
44b6b091beb3 (svn r2560) Fix: various minor code changes.
ludde
parents: 1977
diff changeset
   103
2073
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   104
static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   105
static inline TileIndex RandomTile(void) { return TILE_MASK(Random()); }
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   106
899419c9b997 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   107
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   108
uint32 InteractiveRandom(void); /* Used for random sequences that are not the same on the other end of the multiplayer link */
239
23958632a582 (svn r240) -Fix: desync on subsidy generation
signde
parents: 223
diff changeset
   109
uint InteractiveRandomRange(uint max);
23958632a582 (svn r240) -Fix: desync on subsidy generation
signde
parents: 223
diff changeset
   110
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   111
/* facedraw.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   112
void DrawPlayerFace(uint32 face, int color, int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   113
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   114
/* texteff.c */
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   115
void MoveAllTextEffects(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   116
void AddTextEffect(StringID msg, int x, int y, uint16 duration);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   117
void InitTextEffects(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   118
void DrawTextEffects(DrawPixelInfo *dpi);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   119
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   120
void InitTextMessage(void);
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   121
void DrawTextMessage(void);
619
2a8675eeeb3f (svn r1045) -Fix: OpenTTD compiles again under VC6 (sign_de)
truelight
parents: 543
diff changeset
   122
void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   123
void UndrawTextMessage(void);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   124
1977
4392ae3d8e31 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
   125
bool AddAnimatedTile(TileIndex tile);
4392ae3d8e31 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
   126
void DeleteAnimatedTile(TileIndex tile);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   127
void AnimateAnimatedTiles(void);
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   128
void InitializeAnimatedTiles(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   129
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   130
/* tunnelbridge_cmd.c */
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2520
diff changeset
   131
bool CheckBridge_Stuff(byte bridge_type, uint bridge_len);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   132
uint32 GetBridgeLength(TileIndex begin, TileIndex end);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   133
int CalcBridgeLenCostFactor(int x);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   134
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   135
/* misc_cmd.c */
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   136
void PlaceTreesRandomly(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   137
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   138
void InitializeLandscapeVariables(bool only_constants);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   140
/* misc.c */
4862
b45c1e638e7f (svn r6788) - Codechange: Add and use a function to test if a string ID is a custom name.
peter1138
parents: 4849
diff changeset
   141
bool IsCustomName(StringID id);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   142
void DeleteName(StringID id);
4912
d04b3f2bca70 (svn r6884) -Codechange: Add strict bounds checking in string formatting system.
Darkvater
parents: 4862
diff changeset
   143
char *GetName(char *buff, StringID id, const char* last);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   144
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   145
// AllocateNameUnique also tests if the name used is not used anywere else
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   146
//  and if it is used, it returns an error.
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   147
#define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   148
#define AllocateName(name, skip) RealAllocateName(name, skip, false)
1328
e069d2db0e4c (svn r1832) Next byte -> char iteration: custom names
tron
parents: 1317
diff changeset
   149
StringID RealAllocateName(const char *name, byte skip, bool check_double);
5108
dc67d70b5a45 (svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents: 4912
diff changeset
   150
void ConvertNameArray(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   151
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   152
/* misc functions */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   153
void MarkTileDirty(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   154
void MarkTileDirtyByTile(TileIndex tile);
2788
db2896482939 (svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents: 2639
diff changeset
   155
void InvalidateWindow(WindowClass cls, WindowNumber number);
db2896482939 (svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents: 2639
diff changeset
   156
void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index);
db2896482939 (svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents: 2639
diff changeset
   157
void InvalidateWindowClasses(WindowClass cls);
4766
a23183d868d1 (svn r6680) -Codechange r6679: [train build window] only generate the list when the window data is invalidated or the window is generated, not on each redraw
bjarni
parents: 4548
diff changeset
   158
void InvalidateWindowClassesData(WindowClass cls);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
void DeleteWindowById(WindowClass cls, WindowNumber number);
999
8b2a34061963 (svn r1497) -Fix: [1101179] Crash if generating land while industry window is open. This also happened for towns and the land information window
darkvater
parents: 998
diff changeset
   160
void DeleteWindowByClass(WindowClass cls);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   161
1914
5ede46fd496f (svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents: 1885
diff changeset
   162
void SetObjectToPlaceWnd(CursorID icon, byte mode, Window *w);
5ede46fd496f (svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents: 1885
diff changeset
   163
void SetObjectToPlace(CursorID icon, byte mode, WindowClass window_class, WindowNumber window_num);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   165
void ResetObjectToPlace(void);
152
c3964b43943e (svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents: 131
diff changeset
   166
c3964b43943e (svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents: 131
diff changeset
   167
bool ScrollWindowTo(int x, int y, Window * w);
c3964b43943e (svn r153) -Feature: [1009710] Extra Viewport. In the minimap dropdown menu, open a new viewport to have a quick look at your favorite map-positions. Independent zoom and quick jump to/from viewport (Dribbel)
darkvater
parents: 131
diff changeset
   168
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
bool ScrollMainWindowToTile(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   170
bool ScrollMainWindowTo(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
void DrawSprite(uint32 img, int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   172
bool EnsureNoVehicle(TileIndex tile);
3794
ac26a7b4615d (svn r4790) Remove slope magic from EnsureNoVehicleZ() and rename it to EnsureNoVehicleOnGround() to make more clear what it does
tron
parents: 3636
diff changeset
   173
bool EnsureNoVehicleOnGround(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
void MarkAllViewportsDirty(int left, int top, int right, int bottom);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost);
1935
f43f062c9498 (svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents: 1914
diff changeset
   176
void ShowFeederIncomeAnimation(int x, int y, int z, int32 cost);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
void DrawFoundation(TileInfo *ti, uint f);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
1977
4392ae3d8e31 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
   180
bool CheckIfAuthorityAllows(TileIndex tile);
4392ae3d8e31 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
   181
Town *ClosestTownFromTile(TileIndex tile, uint threshold);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   182
void ChangeTownRating(Town *t, int add, int max);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   183
4000
bab1ebc37da0 (svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents: 3794
diff changeset
   184
uint GetTownRadiusGroup(const Town* t, TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
int FindFirstBit(uint32 x);
998
d9dc257b8949 (svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents: 988
diff changeset
   186
void ShowHighscoreTable(int difficulty, int8 rank);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   187
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   188
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   189
void AfterLoadTown(void);
3121
2e50f731567a (svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents: 2817
diff changeset
   190
void UpdatePatches(void);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   191
void AskExitGame(void);
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   192
void AskExitToGameMenu(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   193
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   194
void RedrawAutosave(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   195
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   196
StringID RemapOldStringID(StringID s);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   197
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   198
void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   199
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   200
enum {
4300
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4261
diff changeset
   201
	SLD_LOAD_GAME,
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4261
diff changeset
   202
	SLD_LOAD_SCENARIO,
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4261
diff changeset
   203
	SLD_SAVE_GAME,
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4261
diff changeset
   204
	SLD_SAVE_SCENARIO,
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4261
diff changeset
   205
	SLD_LOAD_HEIGHTMAP,
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4261
diff changeset
   206
	SLD_NEW_GAME,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   207
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   208
void ShowSaveLoadDialog(int mode);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   209
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   210
// callback from drivers that is called if the game size changes dynamically
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   211
void GameSizeChanged(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   212
bool FileExists(const char *filename);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   213
bool ReadLanguagePack(int index);
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   214
void InitializeLanguagePacks(void);
3329
992d1f7cb747 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3297
diff changeset
   215
const char *GetCurrentLocale(const char *param);
1310
85cde2193afc (svn r1814) Let ReadFileToMem() return void* (instead of byte*) because we don't know what the caller wants to do with the data
tron
parents: 1309
diff changeset
   216
void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   217
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   218
void LoadFromConfig(void);
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   219
void SaveToConfig(void);
1688
787400219027 (svn r2192) - Add greater control to the 'message options' window. Now you can turn off the telegraphc ticker sound for summarized messages, or turn off news-messages altogether (you get a red blot to notify you though). The [<][>] set the settings in one way, while clicking on the option itself, cycles it. This commit also 'fixes' bugs [1166973], [1121484] and patch [1169930].
Darkvater
parents: 1589
diff changeset
   220
void CheckConfig(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   221
int ttd_main(int argc, char* argv[]);
4548
23b56455df33 (svn r6380) -Codechange: unify all ways to quit OTTD.
rubidium
parents: 4512
diff changeset
   222
void HandleExitGameRequest(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   223
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   224
void DeterminePaths(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   225
2380
3b26659b4a9a (svn r2906) Fix some threaded saving problems. Now the thread only interfaces with the main program through a sort of mutex. Communication uses the function OTTD_SendThreadMessage() with the approiate message which is handled in ProcessSentMessage() during the main loop.
Darkvater
parents: 2306
diff changeset
   226
void CSleep(int milliseconds);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   227
#endif /* FUNCTIONS_H */