author | rubidium |
Fri, 21 Dec 2007 22:50:51 +0000 | |
changeset 8119 | 52b48108425a |
parent 7971 | 8509d595142a |
child 8121 | 3bc6351e7369 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5668
diff
changeset
|
3 |
/** @file functions.h */ |
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5668
diff
changeset
|
4 |
|
0 | 5 |
#ifndef FUNCTIONS_H |
6 |
#define FUNCTIONS_H |
|
7 |
||
5636
3c19b56dc982
(svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents:
5587
diff
changeset
|
8 |
#include "gfx.h" |
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7758
diff
changeset
|
9 |
#include "viewport.h" |
7935
c2d1b2f4ecd6
(svn r11488) -Codechange: Spilt the random functions out to seperate file
skidd13
parents:
7889
diff
changeset
|
10 |
#include "core/random_func.hpp" |
8119
52b48108425a
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents:
7971
diff
changeset
|
11 |
#include "command_type.h" |
5636
3c19b56dc982
(svn r8095) -Codechange: stuff that is not related to HAL moved from hal.h to gfx.h
KUDr
parents:
5587
diff
changeset
|
12 |
|
1377
7ab329d1fc28
(svn r1881) -Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
celestar
parents:
1335
diff
changeset
|
13 |
void UpdateTownMaxPass(Town *t); |
0 | 14 |
|
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5668
diff
changeset
|
15 |
/* clear_land.cpp */ |
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
|
16 |
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
|
17 |
void DrawClearLandTile(const TileInfo *ti, byte set); |
2220 | 18 |
void DrawClearLandFence(const TileInfo *ti); |
1420
83e74e76f600
(svn r1924) Use same type names in declaration and implementation
tron
parents:
1377
diff
changeset
|
19 |
void TileLoopClearHelper(TileIndex tile); |
0 | 20 |
|
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5668
diff
changeset
|
21 |
/* players.cpp */ |
6943
1914f26aee04
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents:
6879
diff
changeset
|
22 |
bool CheckPlayerHasMoney(CommandCost cost); |
1914f26aee04
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents:
6879
diff
changeset
|
23 |
void SubtractMoneyFromPlayer(CommandCost cost); |
1914f26aee04
(svn r10197) -Codechange: replace int32 with CommandCost where appropriate.
rubidium
parents:
6879
diff
changeset
|
24 |
void SubtractMoneyFromPlayerFract(PlayerID player, CommandCost cost); |
4849
1c6f21eb97f2
(svn r6775) -Codechange: Use some more proper types, especially Owner and PlayerID as
Darkvater
parents:
4833
diff
changeset
|
25 |
bool CheckOwnership(Owner owner); |
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1935
diff
changeset
|
26 |
bool CheckTileOwnership(TileIndex tile); |
0 | 27 |
|
28 |
/* standard */ |
|
29 |
void ShowInfo(const char *str); |
|
30 |
void CDECL ShowInfoF(const char *str, ...); |
|
31 |
||
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5668
diff
changeset
|
32 |
/* openttd.cpp */ |
2073 | 33 |
static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); } |
6247 | 34 |
static inline TileIndex RandomTile() { return TILE_MASK(Random()); } |
2073 | 35 |
|
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5668
diff
changeset
|
36 |
/* texteff.cpp */ |
7694
3c4a0b7894cd
(svn r11228) -Codechange: implement the "moreanimation" feature of TTDP, so we can properly support newindustries.
rubidium
parents:
7681
diff
changeset
|
37 |
void AddAnimatedTile(TileIndex tile); |
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1935
diff
changeset
|
38 |
void DeleteAnimatedTile(TileIndex tile); |
6247 | 39 |
void AnimateAnimatedTiles(); |
40 |
void InitializeAnimatedTiles(); |
|
0 | 41 |
|
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5668
diff
changeset
|
42 |
/* misc_cmd.cpp */ |
6247 | 43 |
void PlaceTreesRandomly(); |
0 | 44 |
|
45 |
void InitializeLandscapeVariables(bool only_constants); |
|
46 |
||
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5668
diff
changeset
|
47 |
/* misc.cpp */ |
4862
ac034ec9ed2b
(svn r6788) - Codechange: Add and use a function to test if a string ID is a custom name.
peter1138
parents:
4849
diff
changeset
|
48 |
bool IsCustomName(StringID id); |
0 | 49 |
void DeleteName(StringID id); |
7318
632cd0497770
(svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium
parents:
7097
diff
changeset
|
50 |
char *GetName(char *buff, StringID id, const char *last); |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
51 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
536
diff
changeset
|
52 |
#define AllocateName(name, skip) RealAllocateName(name, skip, false) |
1328
eacd8225ed42
(svn r1832) Next byte -> char iteration: custom names
tron
parents:
1317
diff
changeset
|
53 |
StringID RealAllocateName(const char *name, byte skip, bool check_double); |
6247 | 54 |
void ConvertNameArray(); |
0 | 55 |
|
56 |
/* misc functions */ |
|
7545
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
57 |
/** |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
58 |
* Mark a tile given by its coordinate dirty for repaint. |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
59 |
* |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
60 |
* @ingroup dirty |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
61 |
*/ |
0 | 62 |
void MarkTileDirty(int x, int y); |
7545
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
63 |
|
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
64 |
/** |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
65 |
* Mark a tile given by its index dirty for repaint. |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
66 |
* |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
67 |
* @ingroup dirty |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
68 |
*/ |
0 | 69 |
void MarkTileDirtyByTile(TileIndex tile); |
2788
0187c588107e
(svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents:
2639
diff
changeset
|
70 |
void InvalidateWindow(WindowClass cls, WindowNumber number); |
0187c588107e
(svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents:
2639
diff
changeset
|
71 |
void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index); |
0187c588107e
(svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents:
2639
diff
changeset
|
72 |
void InvalidateWindowClasses(WindowClass cls); |
4766
aa276d0ec2eb
(svn r6680) -Codechange r6679: [train build window] only generate the list when the window data is invalidated or the window is generated, not on each redraw
bjarni
parents:
4548
diff
changeset
|
73 |
void InvalidateWindowClassesData(WindowClass cls); |
0 | 74 |
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
|
75 |
void DeleteWindowByClass(WindowClass cls); |
0 | 76 |
|
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7758
diff
changeset
|
77 |
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, ViewportHighlightMode mode, Window *w); |
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7758
diff
changeset
|
78 |
void SetObjectToPlace(CursorID icon, SpriteID pal, ViewportHighlightMode mode, WindowClass window_class, WindowNumber window_num); |
0 | 79 |
|
6247 | 80 |
void ResetObjectToPlace(); |
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
|
81 |
|
7318
632cd0497770
(svn r10673) -Cleanup: some assorted style cleanups. Primarily type* var -> type *var.
rubidium
parents:
7097
diff
changeset
|
82 |
bool ScrollWindowTo(int x, int y, Window *w, bool instant = false); |
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
|
83 |
|
6730
9311a208f8f7
(svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138
parents:
6622
diff
changeset
|
84 |
bool ScrollMainWindowToTile(TileIndex tile, bool instant = false); |
9311a208f8f7
(svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138
parents:
6622
diff
changeset
|
85 |
bool ScrollMainWindowTo(int x, int y, bool instant = false); |
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
|
86 |
bool EnsureNoVehicleOnGround(TileIndex tile); |
7545
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
87 |
|
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
88 |
/** |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
89 |
* Mark all viewports dirty for repaint. |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
90 |
* |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
91 |
* @ingroup dirty |
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7516
diff
changeset
|
92 |
*/ |
0 | 93 |
void MarkAllViewportsDirty(int left, int top, int right, int bottom); |
6990
136a08baf0ed
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents:
6943
diff
changeset
|
94 |
void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost); |
136a08baf0ed
(svn r10246) -Fix (r10297): some forgotten money conversions and truncation issues. Thanks to benc for providing the patch.
rubidium
parents:
6943
diff
changeset
|
95 |
void ShowFeederIncomeAnimation(int x, int y, int z, Money cost); |
0 | 96 |
|
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1935
diff
changeset
|
97 |
bool CheckIfAuthorityAllows(TileIndex tile); |
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1935
diff
changeset
|
98 |
Town *ClosestTownFromTile(TileIndex tile, uint threshold); |
0 | 99 |
void ChangeTownRating(Town *t, int add, int max); |
100 |
||
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3794
diff
changeset
|
101 |
uint GetTownRadiusGroup(const Town* t, TileIndex tile); |
6879
6f2927f456d7
(svn r10122) -Codechange: Add a CountBitsSet function and use it to replace some less efficient loops.
maedhros
parents:
6730
diff
changeset
|
102 |
void ShowHighscoreTable(int difficulty, int8 rank); |
6f2927f456d7
(svn r10122) -Codechange: Add a CountBitsSet function and use it to replace some less efficient loops.
maedhros
parents:
6730
diff
changeset
|
103 |
|
6247 | 104 |
void AfterLoadTown(); |
105 |
void UpdatePatches(); |
|
106 |
void AskExitGame(); |
|
107 |
void AskExitToGameMenu(); |
|
0 | 108 |
|
6247 | 109 |
void RedrawAutosave(); |
0 | 110 |
|
111 |
StringID RemapOldStringID(StringID s); |
|
112 |
||
113 |
void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str); |
|
114 |
||
115 |
enum { |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4261
diff
changeset
|
116 |
SLD_LOAD_GAME, |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4261
diff
changeset
|
117 |
SLD_LOAD_SCENARIO, |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4261
diff
changeset
|
118 |
SLD_SAVE_GAME, |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4261
diff
changeset
|
119 |
SLD_SAVE_SCENARIO, |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4261
diff
changeset
|
120 |
SLD_LOAD_HEIGHTMAP, |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4261
diff
changeset
|
121 |
SLD_NEW_GAME, |
0 | 122 |
}; |
123 |
void ShowSaveLoadDialog(int mode); |
|
124 |
||
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
5668
diff
changeset
|
125 |
/* callback from drivers that is called if the game size changes dynamically */ |
6247 | 126 |
void GameSizeChanged(); |
0 | 127 |
bool FileExists(const char *filename); |
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
|
128 |
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
|
129 |
void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize); |
0 | 130 |
|
6247 | 131 |
void LoadFromConfig(); |
132 |
void SaveToConfig(); |
|
133 |
void CheckConfig(); |
|
0 | 134 |
int ttd_main(int argc, char* argv[]); |
6247 | 135 |
void HandleExitGameRequest(); |
0 | 136 |
|
137 |
#endif /* FUNCTIONS_H */ |