functions.h
author Darkvater
Thu, 12 May 2005 00:18:30 +0000
changeset 1794 44f9deff97ed
parent 1688 787400219027
child 1796 cae31916ae54
permissions -rw-r--r--
(svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
- CodeChange: renamed CmdTrainGotoDepot() to CmdSendTrainToDepot() to be consistent with other depot commands.
- CodeChange: 'newgame' console command now calls the unabused GenRandomNewGame(). For the server it still creates a new game, a client quits the game and continues in SP.
- CodeChange: in the game-difficulty window, setup the disabled buttons on window creation, not every redraw.
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     1
#ifndef FUNCTIONS_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     2
#define FUNCTIONS_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     4
/* vehicle.c */
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
/* window.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
/* landscape.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
void FindLandscapeHeight(TileInfo *ti, uint x, uint y);
1420
5308b177b5b3 (svn r1924) Use same type names in declaration and implementation
tron
parents: 1377
diff changeset
    11
void FindLandscapeHeightByTile(TileInfo *ti, TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
1589
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 DoClearSquare(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
    14
void CDECL ModifyTile(TileIndex tile, uint flags, ...);
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
    15
void RunTileLoop(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    17
uint GetPartialZ(int x, int y, int corners);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
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
    19
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
    20
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
    21
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
    22
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
    23
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
    24
void GetTileDesc(TileIndex tile, TileDesc *td);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
void DrawTile(TileInfo *ti);
1377
2a418162176e (svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents: 1335
diff changeset
    26
void UpdateTownMaxPass(Town *t);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
1589
58d173b56509 (svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
tron
parents: 1542
diff changeset
    28
bool IsValidTile(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
536
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    30
static inline Point RemapCoords(int x, int y, int z)
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    31
{
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
#if !defined(NEW_ROTATION)
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    33
	Point pt;
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    34
	pt.x = (y - x) * 2;
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    35
	pt.y = y + x - z;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
#else
781
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    37
	Point pt;
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    38
	pt.x = (x + y) * 2;
9717ff353c17 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    39
	pt.y = x - y - z;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
#endif
536
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    41
	return pt;
aef4753985d3 (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
536
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    44
static inline Point RemapCoords2(int x, int y)
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    45
{
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    46
	return RemapCoords(x, y, GetSlopeZ(x, y));
aef4753985d3 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    47
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    48
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
/* clear_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
void DrawHillyLandTile(TileInfo *ti);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    52
void DrawClearLandTile(TileInfo *ti, byte set);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    53
void DrawClearLandFence(TileInfo *ti, byte img);
1420
5308b177b5b3 (svn r1924) Use same type names in declaration and implementation
tron
parents: 1377
diff changeset
    54
void TileLoopClearHelper(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
/* station_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
void StationPickerDrawSprite(int x, int y, int railtype, int image);
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
/* track_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
void DrawTrainDepotSprite(int x, int y, int image, int railtype);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
/* road_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
void DrawRoadDepotSprite(int x, int y, int image);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    64
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
/* water_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
void DrawShipDepotSprite(int x, int y, int image);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    67
void TileLoop_Water(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
/* players.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
bool CheckPlayerHasMoney(int32 cost);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    71
void SubtractMoneyFromPlayer(int32 cost);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    72
void SubtractMoneyFromPlayerFract(byte player, int32 cost);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    73
bool CheckOwnership(byte owner);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
bool CheckTileOwnership(uint tile);
2
104b2984cd3e (svn r3) -[1005611] Player Window patch: When looking in dropdownlist for player stuff, it will say
darkvater
parents: 1
diff changeset
    75
StringID GetPlayerNameString(byte player, byte index);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    76
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    77
/* standard */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
void ShowInfo(const char *str);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    79
void CDECL ShowInfoF(const char *str, ...);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    80
void NORETURN CDECL error(const char *str, ...);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
/* ttd.c */
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    83
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    84
// **************
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    85
// * Warning: DO NOT enable this unless you understand what it does
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    86
// *
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    87
// * If enabled, in a network game all randoms will be dumped to the
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    88
// *  stdout if the first client joins (or if you are a client). This
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    89
// *  is to help finding desync problems.
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    90
// *
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    91
// * Warning: DO NOT enable this unless you understand what it does
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    92
// **************
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    93
1539
3d5b40209884 (svn r2043) -Fix: committed too many files in the last commit
truelight
parents: 1538
diff changeset
    94
//#define RANDOM_DEBUG
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    95
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    96
#ifdef RANDOM_DEBUG
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    97
	#define Random() DoRandom(__LINE__, __FILE__)
1120
ea3bf8bc6678 (svn r1621) -Fix: fixed some compiler warnings for the random-debug-switch
truelight
parents: 1115
diff changeset
    98
	uint32 DoRandom(int line, const char *file);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    99
	#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
   100
	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
   101
#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
   102
	uint32 Random(void);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   103
	uint RandomRange(uint max);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   104
#endif
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   105
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
   106
void InitPlayerRandoms(void);
206
7f8c26d8526b (svn r207) -Codechange: randomizer handling
signde
parents: 185
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
void SetDate(uint date);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   112
/* facedraw.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   113
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
   114
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   115
/* 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
   116
void MoveAllTextEffects(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   117
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
   118
void InitTextEffects(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   119
void DrawTextEffects(DrawPixelInfo *dpi);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   120
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
   121
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
   122
void DrawTextMessage(void);
619
2a8675eeeb3f (svn r1045) -Fix: OpenTTD compiles again under VC6 (sign_de)
truelight
parents: 543
diff changeset
   123
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
   124
void UndrawTextMessage(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
   125
void TextMessageDailyLoop(void);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   126
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   127
bool AddAnimatedTile(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   128
void DeleteAnimatedTile(uint 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
   129
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
   130
void InitializeAnimatedTiles(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   132
/* tunnelbridge_cmd.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   133
bool CheckTunnelInWay(uint tile, int z);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   134
bool CheckBridge_Stuff(byte bridge_type, int bridge_len);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   135
uint32 GetBridgeLength(TileIndex begin, TileIndex end);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   136
int CalcBridgeLenCostFactor(int x);
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
typedef void CommandCallback(bool success, uint tile, uint32 p1, uint32 p2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
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
   140
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   141
/* network.c */
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   142
void NetworkUDPClose(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
   143
void NetworkStartUp(void);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   144
void NetworkShutDown(void);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   145
void NetworkGameLoop(void);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   146
void NetworkUDPGameLoop(void);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   147
bool NetworkServerStart(void);
1329
a8a0d60b0a8e (svn r1833) byte -> char transition: the rest
tron
parents: 1328
diff changeset
   148
bool NetworkClientConnectGame(const char* host, unsigned short port);
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
   149
void NetworkReboot(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
   150
void NetworkDisconnect(void);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   151
void NetworkSend_Command(uint32 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
   152
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   153
/* 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
   154
void PlaceTreesRandomly(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   155
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   156
void InitializeLandscapeVariables(bool only_constants);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   157
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   158
/* misc.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
void DeleteName(StringID id);
1328
e069d2db0e4c (svn r1832) Next byte -> char iteration: custom names
tron
parents: 1317
diff changeset
   160
char *GetName(int id, char *buff);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   161
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   162
// 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
   163
//  and if it is used, it returns an error.
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   164
#define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   165
#define AllocateName(name, skip) RealAllocateName(name, skip, false)
1328
e069d2db0e4c (svn r1832) Next byte -> char iteration: custom names
tron
parents: 1317
diff changeset
   166
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
   167
void ConvertDayToYMD(YearMonthDay *ymd, uint16 date);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   168
uint ConvertYMDToDay(uint year, uint month, uint day);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
uint ConvertIntDate(uint date);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   170
void CSleep(int milliseconds);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   172
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   173
/* misc functions */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
void MarkTileDirty(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
void MarkTileDirtyByTile(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
void InvalidateWindow(byte cls, WindowNumber number);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
void InvalidateWindowWidget(byte cls, WindowNumber number, byte widget_index);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
void InvalidateWindowClasses(byte cls);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
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
   180
void DeleteWindowByClass(WindowClass cls);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   182
void SetObjectToPlaceWnd(int icon, byte mode, Window *w);
873
46e892485be3 (svn r1354) Use WindowClass/WindowNumber to store/pass window class/number, not some arbitrary data types
tron
parents: 781
diff changeset
   183
void SetObjectToPlace(int 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
   184
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
   185
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
   186
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
   187
bool ScrollWindowToTile(TileIndex tile, 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
   188
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
   189
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   190
bool ScrollMainWindowToTile(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
bool ScrollMainWindowTo(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   192
void DrawSprite(uint32 img, int x, int y);
1082
56a4c048c5c3 (svn r1583) -Fix: You should no longer be able to delete bridges on any type of underground when there is a vehicle on it
darkvater
parents: 1009
diff changeset
   193
uint GetCorrectTileHeight(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
bool EnsureNoVehicle(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   195
bool EnsureNoVehicleZ(TileIndex tile, byte z);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   196
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
   197
void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   198
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   199
void DrawFoundation(TileInfo *ti, uint f);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   200
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   201
bool CheckIfAuthorityAllows(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   202
Town *ClosestTownFromTile(uint tile, uint threshold);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
void ChangeTownRating(Town *t, int add, int max);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   204
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   205
uint GetRoadBitsByTile(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   206
int GetTownRadiusGroup(Town *t, uint tile);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   207
void ShowNetworkChatQueryWindow(byte desttype, byte dest);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   208
void ShowNetworkGiveMoneyWindow(byte player);
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
   209
void ShowNetworkNeedGamePassword(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
   210
void ShowNetworkNeedCompanyPassword(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   211
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
   212
void ShowHighscoreTable(int difficulty, int8 rank);
983
1be852dcdd4c (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
   213
void ShowEndGameChart(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   214
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   215
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   216
enum SaveOrLoadResult {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   217
	SL_OK = 0, // completed successfully
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   218
	SL_ERROR = 1, // error that was caught before internal structures were modified
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   219
	SL_REINIT = 2, // error that was caught in the middle of updating game state, need to clear it. (can only happen during load)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   220
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   221
enum SaveOrLoadMode {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   222
	SL_INVALID = -1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   223
	SL_LOAD = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   224
	SL_SAVE = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   225
	SL_OLD_LOAD = 2,
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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   228
int SaveOrLoad(const char *filename, int mode);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   229
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
   230
void AfterLoadTown(void);
1794
44f9deff97ed (svn r2298) - CodeChange: removed CmdAbuses: CmdSetTownNameType(), CmdStartNewGame(), CmdCreateScenario(), CmdSetNewLandscapeType() and CmdGenRandomNewGame().
Darkvater
parents: 1688
diff changeset
   231
void GenRandomNewGame(uint32 rnd1, uint32 rnd2);
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
   232
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
   233
void AskExitToGameMenu(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
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
   235
void RedrawAutosave(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   236
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
StringID RemapOldStringID(StringID s);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   238
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   239
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
   240
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   241
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   242
	SLD_LOAD_GAME = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   243
	SLD_LOAD_SCENARIO = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   244
	SLD_SAVE_GAME = 2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   245
	SLD_SAVE_SCENARIO = 3,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   246
	SLD_NEW_GAME = 4,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   247
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   248
void ShowSaveLoadDialog(int mode);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   249
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   250
// 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
   251
void GameSizeChanged(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   252
bool FileExists(const char *filename);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   253
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
   254
void InitializeLanguagePacks(void);
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
   255
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
   256
int GetLanguageList(char **languages, int max);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   257
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
   258
void CheckSwitchToEuro(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   259
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
   260
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
   261
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
   262
void CheckConfig(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   263
int ttd_main(int argc, char* argv[]);
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
   264
byte GetOSVersion(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   265
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
   266
void DeterminePaths(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   267
char * CDECL str_fmt(const char *str, ...);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   268
1217
ab9f02a224ab (svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents: 1211
diff changeset
   269
void bubblesort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   270
#endif /* FUNCTIONS_H */