functions.h
author tron
Sun, 21 May 2006 13:51:36 +0000
changeset 3884 793081f80381
parent 3794 f72053a38797
child 4000 4009d092b306
permissions -rw-r--r--
(svn r4940) Remove the dubious feature of remembering the last built depot. It serves no real purpose except causing confusion
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2162
diff changeset
     1
/* $Id$ */
db48cf29b983 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
/* landscape.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
void FindLandscapeHeight(TileInfo *ti, uint x, uint y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
1589
bac29165710f (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
     9
void DoClearSquare(TileIndex tile);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
    10
void RunTileLoop(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
3636
a36cc46e754d (svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
tron
parents: 3416
diff changeset
    12
uint GetPartialZ(int x, int y, Slope corners);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
uint GetSlopeZ(int x, int y);
1589
bac29165710f (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    14
uint32 GetTileTrackStatus(TileIndex tile, TransportType mode);
bac29165710f (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    15
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
bac29165710f (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    16
void ChangeTileOwner(TileIndex tile, byte old_player, byte new_player);
bac29165710f (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    17
void AnimateTile(TileIndex tile);
bac29165710f (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    18
void ClickTile(TileIndex tile);
bac29165710f (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    19
void GetTileDesc(TileIndex tile, TileDesc *td);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
void DrawTile(TileInfo *ti);
1377
7ab329d1fc28 (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1335
diff changeset
    21
void UpdateTownMaxPass(Town *t);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
1589
bac29165710f (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    23
bool IsValidTile(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
536
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    25
static inline Point RemapCoords(int x, int y, int z)
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    26
{
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
#if !defined(NEW_ROTATION)
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    28
	Point pt;
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    29
	pt.x = (y - x) * 2;
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    30
	pt.y = y + x - z;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    31
#else
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    32
	Point pt;
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    33
	pt.x = (x + y) * 2;
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    34
	pt.y = x - y - z;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
#endif
536
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    36
	return pt;
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    37
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
536
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    39
static inline Point RemapCoords2(int x, int y)
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    40
{
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    41
	return RemapCoords(x, y, GetSlopeZ(x, y));
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    42
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    43
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    44
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    45
/* clear_land.c */
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2380
diff changeset
    46
void DrawHillyLandTile(const TileInfo *ti);
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2380
diff changeset
    47
void DrawClearLandTile(const TileInfo *ti, byte set);
2220
cacd492f3c1c (svn r2738) Small bit fiddling cleanup
tron
parents: 2210
diff changeset
    48
void DrawClearLandFence(const TileInfo *ti);
1420
83e74e76f600 (svn r1924) Use same type names in declaration and implementation
tron
parents: 1377
diff changeset
    49
void TileLoopClearHelper(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
/* road_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    52
void DrawRoadDepotSprite(int x, int y, int image);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    53
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    54
/* water_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
void DrawShipDepotSprite(int x, int y, int image);
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
    56
void TileLoop_Water(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
/* players.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
bool CheckPlayerHasMoney(int32 cost);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
void SubtractMoneyFromPlayer(int32 cost);
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2380
diff changeset
    61
void SubtractMoneyFromPlayerFract(PlayerID player, int32 cost);
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2380
diff changeset
    62
bool CheckOwnership(PlayerID owner);
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
    63
bool CheckTileOwnership(TileIndex tile);
2475
efdcc705cb61 (svn r3001) s/Player*/const Player*/
tron
parents: 2471
diff changeset
    64
StringID GetPlayerNameString(PlayerID player, uint index);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
/* standard */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    67
void ShowInfo(const char *str);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
void CDECL ShowInfoF(const char *str, ...);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
void NORETURN CDECL error(const char *str, ...);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
2075
21d2986569d1 (svn r2585) - Fix [Makefile]: some small cleanups, remove warnings, and add mersenne to makefile (Luca)
Darkvater
parents: 2073
diff changeset
    71
/* openttd.c */
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    72
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    73
// **************
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    74
// * Warning: DO NOT enable this unless you understand what it does
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    75
// *
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    76
// * If enabled, in a network game all randoms will be dumped to the
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    77
// *  stdout if the first client joins (or if you are a client). This
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    78
// *  is to help finding desync problems.
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    79
// *
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    80
// * Warning: DO NOT enable this unless you understand what it does
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    81
// **************
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    82
1539
b3fce185178a (svn r2043) -Fix: committed too many files in the last commit
truelight
parents: 1538
diff changeset
    83
//#define RANDOM_DEBUG
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    84
2073
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    85
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    86
// Enable this to produce higher quality random numbers.
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    87
// Doesn't work with network yet.
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    88
//#define MERSENNE_TWISTER
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    89
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    90
// Mersenne twister functions
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    91
void SeedMT(uint32 seed);
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    92
uint32 RandomMT(void);
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    93
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    94
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    95
#ifdef MERSENNE_TWISTER
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    96
	static inline uint32 Random(void) { return RandomMT(); }
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    97
	uint RandomRange(uint max);
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    98
#else
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
    99
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   100
#ifdef RANDOM_DEBUG
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   101
	#define Random() DoRandom(__LINE__, __FILE__)
1120
047e8b16a954 (svn r1621) -Fix: fixed some compiler warnings for the random-debug-switch
truelight
parents: 1115
diff changeset
   102
	uint32 DoRandom(int line, const char *file);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   103
	#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
1120
047e8b16a954 (svn r1621) -Fix: fixed some compiler warnings for the random-debug-switch
truelight
parents: 1115
diff changeset
   104
	uint DoRandomRange(uint max, int line, const char *file);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   105
#else
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   106
	uint32 Random(void);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   107
	uint RandomRange(uint max);
2073
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   108
#endif
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   109
#endif // MERSENNE_TWISTER
2051
e369160ce2f3 (svn r2560) Fix: various minor code changes.
ludde
parents: 1977
diff changeset
   110
2073
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   111
static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   112
static inline TileIndex RandomTile(void) { return TILE_MASK(Random()); }
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   113
2d63300e4a44 (svn r2583) Move OS specific code out of misc.c
ludde
parents: 2051
diff changeset
   114
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   115
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
   116
uint InteractiveRandomRange(uint max);
23958632a582 (svn r240) -Fix: desync on subsidy generation
signde
parents: 223
diff changeset
   117
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   118
void SetDate(uint date);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   119
/* facedraw.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   120
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
   121
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   122
/* texteff.c */
1093
4fdc46eaf423 (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 MoveAllTextEffects(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   124
void AddTextEffect(StringID msg, int x, int y, uint16 duration);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   125
void InitTextEffects(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   126
void DrawTextEffects(DrawPixelInfo *dpi);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   127
1093
4fdc46eaf423 (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 InitTextMessage(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   129
void DrawTextMessage(void);
619
abab6c8f1af7 (svn r1045) -Fix: OpenTTD compiles again under VC6 (sign_de)
truelight
parents: 543
diff changeset
   130
void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   131
void UndrawTextMessage(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   132
void TextMessageDailyLoop(void);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   133
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
   134
bool AddAnimatedTile(TileIndex tile);
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
   135
void DeleteAnimatedTile(TileIndex tile);
1093
4fdc46eaf423 (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 AnimateAnimatedTiles(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   137
void InitializeAnimatedTiles(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   138
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
/* tunnelbridge_cmd.c */
2639
eeaefdabfdfd (svn r3181) -Bracing
tron
parents: 2520
diff changeset
   140
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
   141
uint32 GetBridgeLength(TileIndex begin, TileIndex end);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   142
int CalcBridgeLenCostFactor(int x);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   143
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
   144
typedef void CommandCallback(bool success, TileIndex tile, uint32 p1, uint32 p2);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   145
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   146
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   147
/* network.c */
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   148
void NetworkUDPClose(void);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   149
void NetworkStartUp(void);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   150
void NetworkShutDown(void);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   151
void NetworkGameLoop(void);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   152
void NetworkUDPGameLoop(void);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   153
bool NetworkServerStart(void);
1329
6988419aa6f0 (svn r1833) byte -> char transition: the rest
tron
parents: 1328
diff changeset
   154
bool NetworkClientConnectGame(const char* host, unsigned short port);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   155
void NetworkReboot(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   156
void NetworkDisconnect(void);
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
   157
void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   158
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
/* misc_cmd.c */
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   160
void PlaceTreesRandomly(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   161
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   162
void InitializeLandscapeVariables(bool only_constants);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   163
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
/* misc.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
void DeleteName(StringID id);
1328
eacd8225ed42 (svn r1832) Next byte -> char iteration: custom names
tron
parents: 1317
diff changeset
   166
char *GetName(int id, char *buff);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   167
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   168
// AllocateNameUnique also tests if the name used is not used anywere else
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   169
//  and if it is used, it returns an error.
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   170
#define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true)
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   171
#define AllocateName(name, skip) RealAllocateName(name, skip, false)
1328
eacd8225ed42 (svn r1832) Next byte -> char iteration: custom names
tron
parents: 1317
diff changeset
   172
StringID RealAllocateName(const char *name, byte skip, bool check_double);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   173
void ConvertDayToYMD(YearMonthDay *ymd, uint16 date);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
uint ConvertYMDToDay(uint year, uint month, uint day);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
uint ConvertIntDate(uint date);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
/* misc functions */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
void MarkTileDirty(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
void MarkTileDirtyByTile(TileIndex tile);
2788
0187c588107e (svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents: 2639
diff changeset
   180
void InvalidateWindow(WindowClass cls, WindowNumber number);
0187c588107e (svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents: 2639
diff changeset
   181
void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index);
0187c588107e (svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents: 2639
diff changeset
   182
void InvalidateWindowClasses(WindowClass cls);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   183
void DeleteWindowById(WindowClass cls, WindowNumber number);
999
647f65adeb9e (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
   184
void DeleteWindowByClass(WindowClass cls);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
1914
2b4b3c3a95b4 (svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents: 1885
diff changeset
   186
void SetObjectToPlaceWnd(CursorID icon, byte mode, Window *w);
2b4b3c3a95b4 (svn r2420) - Codechange: magic number elminitation of cursorsprites.
Darkvater
parents: 1885
diff changeset
   187
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
   188
1093
4fdc46eaf423 (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 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
   190
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
   191
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
   192
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   193
bool ScrollMainWindowToTile(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
bool ScrollMainWindowTo(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   195
void DrawSprite(uint32 img, int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   196
bool EnsureNoVehicle(TileIndex tile);
3794
f72053a38797 (svn r4790) Remove slope magic from EnsureNoVehicleZ() and rename it to EnsureNoVehicleOnGround() to make more clear what it does
tron
parents: 3636
diff changeset
   197
bool EnsureNoVehicleOnGround(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   198
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
   199
void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost);
1935
164d58b9137c (svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents: 1914
diff changeset
   200
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
   201
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   202
void DrawFoundation(TileInfo *ti, uint f);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
   204
bool CheckIfAuthorityAllows(TileIndex tile);
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1935
diff changeset
   205
Town *ClosestTownFromTile(TileIndex tile, uint threshold);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   206
void ChangeTownRating(Town *t, int add, int max);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   207
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2380
diff changeset
   208
int GetTownRadiusGroup(const Town *t, TileIndex tile);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   209
void ShowNetworkChatQueryWindow(byte desttype, byte dest);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   210
void ShowNetworkGiveMoneyWindow(byte player);
1093
4fdc46eaf423 (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 ShowNetworkNeedGamePassword(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   212
void ShowNetworkNeedCompanyPassword(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   213
int FindFirstBit(uint32 x);
998
c90459c24842 (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
   214
void ShowHighscoreTable(int difficulty, int8 rank);
983
4765bf636f6b (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents: 873
diff changeset
   215
void ShowEndGameChart(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   216
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   217
1093
4fdc46eaf423 (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 AfterLoadTown(void);
3121
72fb0554f9f1 (svn r3726) - [6/6] Finalize conversion, finally save the patches struct.
Darkvater
parents: 2817
diff changeset
   219
void UpdatePatches(void);
1794
24b4239f2090 (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1688
diff changeset
   220
void GenRandomNewGame(uint32 rnd1, uint32 rnd2);
1796
614d996f6be7 (svn r2300) - CodeChange: check the last number of commands, now only the refit ones remain, and some server-only commands.
Darkvater
parents: 1794
diff changeset
   221
void StartScenarioEditor(uint32 rnd1, uint32 rnd2);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   222
void AskExitGame(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   223
void AskExitToGameMenu(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   224
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   225
void RedrawAutosave(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   226
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   227
StringID RemapOldStringID(StringID s);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   228
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   229
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
   230
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   231
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   232
	SLD_LOAD_GAME = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
	SLD_LOAD_SCENARIO = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
	SLD_SAVE_GAME = 2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   235
	SLD_SAVE_SCENARIO = 3,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   236
	SLD_NEW_GAME = 4,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   238
void ShowSaveLoadDialog(int mode);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   239
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   240
// callback from drivers that is called if the game size changes dynamically
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   241
void GameSizeChanged(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   242
bool FileExists(const char *filename);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   243
bool ReadLanguagePack(int index);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   244
void InitializeLanguagePacks(void);
3329
9885789ecaf7 (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
   245
const char *GetCurrentLocale(const char *param);
1310
99c921090356 (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
   246
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
   247
int GetLanguageList(char **languages, int max);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   248
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   249
void LoadFromConfig(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   250
void SaveToConfig(void);
1688
af2bb9bcb2ed (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
   251
void CheckConfig(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   252
int ttd_main(int argc, char* argv[]);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   253
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1082
diff changeset
   254
void DeterminePaths(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   255
2380
392bba57462d (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
   256
void CSleep(int milliseconds);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   257
#endif /* FUNCTIONS_H */