functions.h
author darkvater
Sun, 30 Jan 2005 14:32:52 +0000
changeset 1225 16a44e26efa5
parent 1217 59c024cfaf54
child 1245 3822f77cbc53
permissions -rw-r--r--
(svn r1729) - Fix: [ 1112469 ] Clearing land for free by reallocating HQ
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);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
void FindLandscapeHeightByTile(TileInfo *ti, uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
uint GetTileSlope(uint tile, int *h);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
int GetTileZ(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
void DoClearSquare(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
void CDECL ModifyTile(uint tile, uint flags, ...);
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
    17
void RunTileLoop(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
uint GetPartialZ(int x, int y, int corners);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
uint GetSlopeZ(int x, int y);
159
139cf78bfb28 (svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents: 152
diff changeset
    21
uint32 GetTileTrackStatus(uint tile, TransportType mode);
473
77f0ef57e7cf (svn r724) Remove restriction that a tile can only accept 3 cargo types.
tron
parents: 430
diff changeset
    22
void GetAcceptedCargo(uint tile, AcceptedCargo ac);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    23
void ChangeTileOwner(uint tile, byte old_player, byte new_player);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
void AnimateTile(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
void ClickTile(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    26
void GetTileDesc(uint tile, TileDesc *td);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
void DrawTile(TileInfo *ti);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
131
16e59d059384 (svn r132) -Fix: [1014278] TileAddWrap() gave wrong results. Fixed now.
truelight
parents: 105
diff changeset
    29
uint TileAddWrap(TileIndex tile, int addx, int addy);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    31
	TILE_WRAPPED = (uint)-1
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
bool IsValidTile(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
536
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    36
static inline Point RemapCoords(int x, int y, int z)
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
#if !defined(NEW_ROTATION)
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    39
	Point pt;
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    40
	pt.x = (y - x) * 2;
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    41
	pt.y = y + x - z;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
#else
781
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    43
	Point pt;
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    44
	pt.x = (x + y) * 2;
4c9177888196 (svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents: 738
diff changeset
    45
	pt.y = x - y - z;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    46
#endif
536
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    47
	return pt;
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    48
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
536
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    50
static inline Point RemapCoords2(int x, int y)
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    51
{
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    52
	return RemapCoords(x, y, GetSlopeZ(x, y));
03d80fecb999 (svn r907) Sprinkle holy ANSI water:
tron
parents: 473
diff changeset
    53
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    54
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
/* game.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
byte *GetString(byte *buffr, uint16 string);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
void InjectDparam(int amount);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
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
    59
int32 GetParamInt32(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
    60
int GetParamInt16(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
    61
int GetParamInt8(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
    62
int GetParamUint16(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
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
/* clear_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
void DrawHillyLandTile(TileInfo *ti);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    67
void DrawClearLandTile(TileInfo *ti, byte set);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
void DrawClearLandFence(TileInfo *ti, byte img);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    69
void TileLoopClearHelper(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    71
/* station_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    72
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
    73
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
/* track_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    75
void DrawTrainDepotSprite(int x, int y, int image, int railtype);
415
20f981988266 (svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
dominik
parents: 395
diff changeset
    76
void DrawWaypointSprite(int x, int y, int image, int railtype);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    77
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
/* road_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    79
void DrawRoadDepotSprite(int x, int y, int image);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    80
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
/* water_land.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
void DrawShipDepotSprite(int x, int y, int image);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
void TileLoop_Water(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    85
/* players.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    86
bool CheckPlayerHasMoney(int32 cost);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    87
void SubtractMoneyFromPlayer(int32 cost);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    88
void SubtractMoneyFromPlayerFract(byte player, int32 cost);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    89
bool CheckOwnership(byte owner);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    90
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
    91
StringID GetPlayerNameString(byte player, byte index);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
/* standard */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    94
void ShowInfo(const char *str);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    95
void CDECL ShowInfoF(const char *str, ...);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    96
void NORETURN CDECL error(const char *str, ...);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    97
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
/* ttd.c */
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
    99
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   100
// **************
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   101
// * 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
   102
// *
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   103
// * 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
   104
// *  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
   105
// *  is to help finding desync problems.
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   106
// *
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   107
// * 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
   108
// **************
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   109
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   110
//#define RANDOM_DEBUG
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   111
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   112
#ifdef RANDOM_DEBUG
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   113
	#define Random() DoRandom(__LINE__, __FILE__)
1120
047e8b16a954 (svn r1621) -Fix: fixed some compiler warnings for the random-debug-switch
truelight
parents: 1115
diff changeset
   114
	uint32 DoRandom(int line, const char *file);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   115
	#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
   116
	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
   117
#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
   118
	uint32 Random(void);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   119
	uint RandomRange(uint max);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   120
#endif
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   121
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
   122
void InitPlayerRandoms(void);
206
7f8c26d8526b (svn r207) -Codechange: randomizer handling
signde
parents: 185
diff changeset
   123
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
   124
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
   125
uint InteractiveRandomRange(uint max);
23958632a582 (svn r240) -Fix: desync on subsidy generation
signde
parents: 223
diff changeset
   126
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   127
void SetDate(uint date);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   128
/* facedraw.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   129
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
   130
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
/* 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
   132
void MoveAllTextEffects(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   133
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
   134
void InitTextEffects(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   135
void DrawTextEffects(DrawPixelInfo *dpi);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   136
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
   137
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
   138
void DrawTextMessage(void);
619
abab6c8f1af7 (svn r1045) -Fix: OpenTTD compiles again under VC6 (sign_de)
truelight
parents: 543
diff changeset
   139
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
   140
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
   141
void TextMessageDailyLoop(void);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   142
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   143
bool AddAnimatedTile(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   144
void DeleteAnimatedTile(uint 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
   145
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
   146
void InitializeAnimatedTiles(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   147
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
/* tunnelbridge_cmd.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   149
bool CheckTunnelInWay(uint tile, int z);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   150
bool CheckBridge_Stuff(byte bridge_type, int bridge_len);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   151
uint32 GetBridgeLength(TileIndex begin, TileIndex end);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   152
int CalcBridgeLenCostFactor(int x);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   153
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   154
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
   155
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
   156
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   157
/* network.c */
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   158
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
   159
void NetworkStartUp(void);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   160
void NetworkShutDown(void);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   161
void NetworkGameLoop(void);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   162
void NetworkUDPGameLoop(void);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   163
bool NetworkServerStart(void);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   164
bool NetworkClientConnectGame(const byte* 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
   165
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
   166
void NetworkDisconnect(void);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   167
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
   168
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
/* 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
   170
void PlaceTreesRandomly(void);
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
uint GetTileDist(TileIndex xy1, TileIndex xy2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   173
uint GetTileDist1D(TileIndex xy1, TileIndex xy2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
uint GetTileDist1Db(TileIndex xy1, TileIndex xy2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
uint GetTileDistAdv(TileIndex xy1, TileIndex xy2);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
bool CheckDistanceFromEdge(TileIndex tile, uint distance);
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 InitializeLandscapeVariables(bool only_constants);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   180
/* misc.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
void DeleteName(StringID id);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   182
byte *GetName(int id, byte *buff);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   183
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   184
// 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
   185
//  and if it is used, it returns an error.
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   186
#define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true)
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   187
#define AllocateName(name, skip) RealAllocateName(name, skip, false)
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   188
StringID RealAllocateName(const byte *name, byte skip, bool check_double);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   189
void ConvertDayToYMD(YearMonthDay *ymd, uint16 date);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   190
uint ConvertYMDToDay(uint year, uint month, uint day);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
uint ConvertIntDate(uint date);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   192
void CSleep(int milliseconds);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   193
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   195
/* misc functions */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   196
void MarkTileDirty(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   197
void MarkTileDirtyByTile(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   198
void InvalidateWindow(byte cls, WindowNumber number);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   199
void InvalidateWindowWidget(byte cls, WindowNumber number, byte widget_index);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   200
void InvalidateWindowClasses(byte cls);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   201
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
   202
void DeleteWindowByClass(WindowClass cls);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   204
void SetObjectToPlaceWnd(int icon, byte mode, Window *w);
873
732553f5b169 (svn r1354) Use WindowClass/WindowNumber to store/pass window class/number, not some arbitrary data types
tron
parents: 781
diff changeset
   205
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
   206
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
   207
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
   208
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
   209
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
   210
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
   211
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   212
bool ScrollMainWindowToTile(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   213
bool ScrollMainWindowTo(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   214
void DrawSprite(uint32 img, int x, int y);
1082
a83d7ac6fecb (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
   215
uint GetCorrectTileHeight(TileIndex tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   216
bool EnsureNoVehicle(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   217
bool EnsureNoVehicleZ(TileIndex tile, byte z);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   218
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
   219
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
   220
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   221
void DrawFoundation(TileInfo *ti, uint f);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   222
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   223
bool CheckIfAuthorityAllows(uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   224
Town *ClosestTownFromTile(uint tile, uint threshold);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   225
void ChangeTownRating(Town *t, int add, int max);
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
uint GetRoadBitsByTile(TileIndex tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   228
int GetTownRadiusGroup(Town *t, uint tile);
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   229
void ShowNetworkChatQueryWindow(byte desttype, byte dest);
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 536
diff changeset
   230
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
   231
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
   232
void ShowNetworkNeedCompanyPassword(void);
395
788a9bba0889 (svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents: 393
diff changeset
   233
void ShowRenameWaypointWindow(Waypoint *cp);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
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
   235
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
   236
void ShowEndGameChart(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
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
enum SaveOrLoadResult {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   240
	SL_OK = 0, // completed successfully
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   241
	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
   242
	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
   243
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   244
enum SaveOrLoadMode {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   245
	SL_INVALID = -1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   246
	SL_LOAD = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   247
	SL_SAVE = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   248
	SL_OLD_LOAD = 2,
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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   251
int SaveOrLoad(const char *filename, int mode);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   252
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
   253
void AfterLoadTown(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
   254
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
   255
void AskExitToGameMenu(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   256
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
   257
void RedrawAutosave(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   258
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   259
StringID RemapOldStringID(StringID s);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   260
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   261
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
   262
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   263
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   264
	SLD_LOAD_GAME = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   265
	SLD_LOAD_SCENARIO = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   266
	SLD_SAVE_GAME = 2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   267
	SLD_SAVE_SCENARIO = 3,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   268
	SLD_NEW_GAME = 4,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   269
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   270
void ShowSaveLoadDialog(int mode);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   271
1115
55b99683ce51 (svn r1616) Introduce ttd_strlcat() and use it to de-uglify some piece of code in misc_cmd.
tron
parents: 1093
diff changeset
   272
void ttd_strlcpy(char *dst, const char *src, size_t size);
55b99683ce51 (svn r1616) Introduce ttd_strlcat() and use it to de-uglify some piece of code in misc_cmd.
tron
parents: 1093
diff changeset
   273
void ttd_strlcat(char *dst, const char *src, size_t size);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   274
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   275
// 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
   276
void GameSizeChanged(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   277
bool FileExists(const char *filename);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   278
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
   279
void InitializeLanguagePacks(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   280
byte *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   281
int GetLanguageList(char **languages, int max);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   282
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
   283
void CheckSwitchToEuro(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   284
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
   285
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
   286
void SaveToConfig(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   287
int ttd_main(int argc, char* argv[]);
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
   288
byte GetOSVersion(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   289
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
   290
void DeterminePaths(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   291
char * CDECL str_fmt(const char *str, ...);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   292
1217
59c024cfaf54 (svn r1721) -Feature: It is now possible to build multiple road stations (up to 8) on
celestar
parents: 1211
diff changeset
   293
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
   294
#endif /* FUNCTIONS_H */