author | darkvater |
Sun, 12 Sep 2004 22:03:14 +0000 | |
changeset 223 | 0e5cc5a65df6 |
parent 211 | 2954c4b30525 |
child 239 | 23958632a582 |
permissions | -rw-r--r-- |
0 | 1 |
#ifndef FUNCTIONS_H |
2 |
#define FUNCTIONS_H |
|
3 |
||
211 | 4 |
#include "network.h" |
5 |
||
0 | 6 |
/* vehicle.c */ |
7 |
||
8 |
/* window.c */ |
|
9 |
||
10 |
||
11 |
/* landscape.c */ |
|
12 |
void FindLandscapeHeight(TileInfo *ti, uint x, uint y); |
|
13 |
void FindLandscapeHeightByTile(TileInfo *ti, uint tile); |
|
14 |
uint GetTileSlope(uint tile, int *h); |
|
15 |
int GetTileZ(uint tile); |
|
16 |
||
17 |
void DoClearSquare(uint tile); |
|
18 |
void CDECL ModifyTile(uint tile, uint flags, ...); |
|
19 |
void SetMapExtraBits(uint tile, byte flags); |
|
20 |
uint GetMapExtraBits(uint tile); |
|
21 |
void RunTileLoop(); |
|
22 |
||
23 |
uint GetPartialZ(int x, int y, int corners); |
|
24 |
uint GetSlopeZ(int x, int y); |
|
159
139cf78bfb28
(svn r160) -Codechange: made GetTileTrackStatus more readable (blathijs)
truelight
parents:
152
diff
changeset
|
25 |
uint32 GetTileTrackStatus(uint tile, TransportType mode); |
0 | 26 |
void GetAcceptedCargo(uint tile, AcceptedCargo *ac); |
27 |
void ChangeTileOwner(uint tile, byte old_player, byte new_player); |
|
28 |
void AnimateTile(uint tile); |
|
29 |
void ClickTile(uint tile); |
|
30 |
void GetTileDesc(uint tile, TileDesc *td); |
|
31 |
void DrawTile(TileInfo *ti); |
|
32 |
||
131
16e59d059384
(svn r132) -Fix: [1014278] TileAddWrap() gave wrong results. Fixed now.
truelight
parents:
105
diff
changeset
|
33 |
uint TileAddWrap(TileIndex tile, int addx, int addy); |
0 | 34 |
enum { |
35 |
TILE_WRAPPED = (uint)-1 |
|
36 |
}; |
|
37 |
||
38 |
bool IsValidTile(uint tile); |
|
39 |
||
40 |
#if !defined(NEW_ROTATION) |
|
41 |
static Point FORCEINLINE RemapCoords(int x, int y, int z) { Point pt = { (y-x)*2, y + x -z }; return pt; } |
|
42 |
#else |
|
43 |
static Point FORCEINLINE RemapCoords(int x, int y, int z) { Point pt = { (x + y)*2, x - y -z }; return pt; } |
|
44 |
#endif |
|
45 |
||
46 |
static Point FORCEINLINE RemapCoords2(int x, int y) { return RemapCoords(x, y, GetSlopeZ(x, y)); } |
|
47 |
||
48 |
/* game.c */ |
|
49 |
byte *GetString(byte *buffr, uint16 string); |
|
50 |
void InjectDparam(int amount); |
|
51 |
||
52 |
int32 GetParamInt32(); |
|
53 |
int GetParamInt16(); |
|
54 |
int GetParamInt8(); |
|
55 |
int GetParamUint16(); |
|
56 |
||
57 |
||
58 |
/* sound.c */ |
|
59 |
void SndPlayTileFx(int sound, TileIndex tile); |
|
60 |
void SndPlayVehicleFx(int sound, Vehicle *v); |
|
61 |
void SndPlayFx(int sound); |
|
62 |
||
63 |
/* clear_land.c */ |
|
64 |
void DrawHillyLandTile(TileInfo *ti); |
|
65 |
void DrawClearLandTile(TileInfo *ti, byte set); |
|
66 |
void DrawClearLandFence(TileInfo *ti, byte img); |
|
67 |
void TileLoopClearHelper(uint tile); |
|
68 |
||
69 |
/* station_land.c */ |
|
70 |
void StationPickerDrawSprite(int x, int y, int railtype, int image); |
|
71 |
||
72 |
/* track_land.c */ |
|
73 |
void DrawTrainDepotSprite(int x, int y, int image, int railtype); |
|
74 |
||
75 |
/* road_land.c */ |
|
76 |
void DrawRoadDepotSprite(int x, int y, int image); |
|
77 |
||
78 |
/* water_land.c */ |
|
79 |
void DrawShipDepotSprite(int x, int y, int image); |
|
80 |
void TileLoop_Water(uint tile); |
|
81 |
||
82 |
/* players.c */ |
|
83 |
bool CheckPlayerHasMoney(int32 cost); |
|
84 |
void SubtractMoneyFromPlayer(int32 cost); |
|
85 |
void SubtractMoneyFromPlayerFract(byte player, int32 cost); |
|
86 |
bool CheckOwnership(byte owner); |
|
87 |
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
|
88 |
StringID GetPlayerNameString(byte player, byte index); |
0 | 89 |
|
90 |
/* standard */ |
|
91 |
void ShowInfo(const char *str); |
|
92 |
void CDECL ShowInfoF(const char *str, ...); |
|
93 |
void NORETURN CDECL error(const char *str, ...); |
|
94 |
void memswap(void *a, void *b, size_t size); |
|
95 |
||
96 |
/* ttd.c */ |
|
97 |
uint32 Random(); |
|
98 |
uint RandomRange(uint max); |
|
99 |
||
206 | 100 |
void InitPlayerRandoms(); |
101 |
||
0 | 102 |
uint32 InteractiveRandom(); /* Used for random sequences that are not the same on the other end of the multiplayer link */ |
103 |
void SetDate(uint date); |
|
104 |
/* facedraw.c */ |
|
105 |
void DrawPlayerFace(uint32 face, int color, int x, int y); |
|
106 |
||
107 |
/* texteff.c */ |
|
108 |
void MoveAllTextEffects(); |
|
109 |
void AddTextEffect(StringID msg, int x, int y, uint16 duration); |
|
110 |
void InitTextEffects(); |
|
111 |
void DrawTextEffects(DrawPixelInfo *dpi); |
|
112 |
||
113 |
bool AddAnimatedTile(uint tile); |
|
114 |
void DeleteAnimatedTile(uint tile); |
|
115 |
void AnimateAnimatedTiles(); |
|
116 |
void InitializeAnimatedTiles(); |
|
117 |
||
118 |
/* tunnelbridge_cmd.c */ |
|
119 |
bool CheckTunnelInWay(uint tile, int z); |
|
120 |
bool CheckBridge_Stuff(byte bridge_type, int bridge_len); |
|
121 |
uint32 GetBridgeLength(TileIndex begin, TileIndex end); |
|
122 |
int CalcBridgeLenCostFactor(int x); |
|
123 |
||
124 |
/* network.c */ |
|
125 |
typedef void CommandCallback(bool success, uint tile, uint32 p1, uint32 p2); |
|
126 |
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd); |
|
127 |
||
128 |
void NetworkReceive(); |
|
129 |
void NetworkSend(); |
|
130 |
void NetworkProcessCommands(); |
|
105 | 131 |
void NetworkListen(); |
132 |
void NetworkInitialize(); |
|
0 | 133 |
void NetworkShutdown(); |
134 |
void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback); |
|
105 | 135 |
void NetworkStartSync(bool fcreset); |
136 |
void NetworkClose(bool client); |
|
185
646403e35006
(svn r186) -Add: debug 'net' for network debug (sign_de)
truelight
parents:
175
diff
changeset
|
137 |
void NetworkSendReadyPacket(); |
206 | 138 |
void NetworkSendSyncPackets(); |
208 | 139 |
void NetworkSendFrameSyncPackets(); |
206 | 140 |
bool NetworkCheckClientReady(); |
105 | 141 |
|
0 | 142 |
void NetworkIPListInit(); |
105 | 143 |
|
144 |
void NetworkCoreInit(); |
|
145 |
void NetworkCoreShutdown(); |
|
146 |
void NetworkCoreDisconnect(); |
|
147 |
void NetworkCoreLoop(bool incomming); |
|
175
d6cccece959a
(svn r176) -Fix: network_gui const and warnings fixes (Tron)
darkvater
parents:
159
diff
changeset
|
148 |
bool NetworkCoreConnectGame(const byte* b, unsigned short port); |
211 | 149 |
bool NetworkCoreConnectGameStruct(NetworkGameList * item); |
105 | 150 |
bool NetworkCoreStartGame(); |
151 |
||
152 |
void NetworkLobbyShutdown(); |
|
153 |
void NetworkLobbyInit(); |
|
154 |
||
155 |
void NetworkGameListClear(); |
|
211 | 156 |
NetworkGameList * NetworkGameListAdd(); |
105 | 157 |
void NetworkGameListFromLAN(); |
158 |
void NetworkGameListFromInternet(); |
|
211 | 159 |
NetworkGameList * NetworkGameListItem(uint16 index); |
105 | 160 |
|
161 |
void NetworkGameFillDefaults(); |
|
162 |
void NetworkGameChangeDate(uint16 newdate); |
|
0 | 163 |
|
164 |
/* misc_cmd.c */ |
|
165 |
void PlaceTreesRandomly(); |
|
166 |
||
167 |
uint GetTileDist(TileIndex xy1, TileIndex xy2); |
|
168 |
uint GetTileDist1D(TileIndex xy1, TileIndex xy2); |
|
169 |
uint GetTileDist1Db(TileIndex xy1, TileIndex xy2); |
|
170 |
uint GetTileDistAdv(TileIndex xy1, TileIndex xy2); |
|
171 |
bool CheckDistanceFromEdge(TileIndex tile, uint distance); |
|
172 |
||
173 |
void InitializeLandscapeVariables(bool only_constants); |
|
174 |
||
175 |
/* misc.c */ |
|
176 |
void DeleteName(StringID id); |
|
177 |
byte *GetName(int id, byte *buff); |
|
178 |
StringID AllocateName(const byte *name, byte skip); |
|
179 |
void ConvertDayToYMD(YearMonthDay *ymd, uint16 date); |
|
180 |
uint ConvertYMDToDay(uint year, uint month, uint day); |
|
181 |
uint ConvertIntDate(uint date); |
|
182 |
||
183 |
||
184 |
||
185 |
/* misc functions */ |
|
186 |
void MarkTileDirty(int x, int y); |
|
187 |
void MarkTileDirtyByTile(TileIndex tile); |
|
188 |
void InvalidateWindow(byte cls, WindowNumber number); |
|
189 |
void InvalidateWindowWidget(byte cls, WindowNumber number, byte widget_index); |
|
190 |
void InvalidateWindowClasses(byte cls); |
|
191 |
void DeleteWindowById(WindowClass cls, WindowNumber number); |
|
192 |
||
193 |
void SetObjectToPlaceWnd(int icon, byte mode, Window *w); |
|
194 |
void SetObjectToPlace(int icon, byte mode, byte window_class, uint16 window_num); |
|
195 |
||
196 |
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
|
197 |
|
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
|
198 |
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
|
199 |
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
|
200 |
|
0 | 201 |
bool ScrollMainWindowToTile(TileIndex tile); |
202 |
bool ScrollMainWindowTo(int x, int y); |
|
203 |
void DrawSprite(uint32 img, int x, int y); |
|
204 |
bool EnsureNoVehicle(TileIndex tile); |
|
205 |
bool EnsureNoVehicleZ(TileIndex tile, byte z); |
|
206 |
void MarkAllViewportsDirty(int left, int top, int right, int bottom); |
|
207 |
void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost); |
|
208 |
void MarkWholeScreenDirty(); |
|
209 |
||
210 |
void DrawFoundation(TileInfo *ti, uint f); |
|
211 |
||
212 |
bool CheckIfAuthorityAllows(uint tile); |
|
213 |
Town *ClosestTownFromTile(uint tile, uint threshold); |
|
214 |
void ChangeTownRating(Town *t, int add, int max); |
|
215 |
||
216 |
uint GetRoadBitsByTile(TileIndex tile); |
|
217 |
int GetTownRadiusGroup(Town *t, uint tile); |
|
218 |
int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, byte cargo_type); |
|
219 |
void ShowRenameSignWindow(SignStruct *ss); |
|
220 |
void ShowRenameCheckpointWindow(Checkpoint *cp); |
|
221 |
int FindFirstBit(uint32 x); |
|
222 |
void ShowHighscoreTable(int tbl); |
|
223 |
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng); |
|
224 |
||
225 |
enum SaveOrLoadResult { |
|
226 |
SL_OK = 0, // completed successfully |
|
227 |
SL_ERROR = 1, // error that was caught before internal structures were modified |
|
228 |
SL_REINIT = 2, // error that was caught in the middle of updating game state, need to clear it. (can only happen during load) |
|
229 |
}; |
|
230 |
enum SaveOrLoadMode { |
|
231 |
SL_INVALID = -1, |
|
232 |
SL_LOAD = 0, |
|
233 |
SL_SAVE = 1, |
|
234 |
SL_OLD_LOAD = 2, |
|
235 |
}; |
|
236 |
||
237 |
int SaveOrLoad(const char *filename, int mode); |
|
238 |
||
239 |
void AfterLoadTown(); |
|
240 |
void AskExitGame(); |
|
241 |
void AskExitToGameMenu(); |
|
242 |
||
243 |
void RedrawAutosave(); |
|
244 |
||
245 |
StringID RemapOldStringID(StringID s); |
|
246 |
||
247 |
void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str); |
|
248 |
||
249 |
enum { |
|
250 |
SLD_LOAD_GAME = 0, |
|
251 |
SLD_LOAD_SCENARIO = 1, |
|
252 |
SLD_SAVE_GAME = 2, |
|
253 |
SLD_SAVE_SCENARIO = 3, |
|
254 |
SLD_NEW_GAME = 4, |
|
255 |
}; |
|
256 |
void ShowSaveLoadDialog(int mode); |
|
257 |
||
258 |
void ttd_strlcpy(char *dst, const char *src, size_t len); |
|
259 |
||
260 |
// callback from drivers that is called if the game size changes dynamically |
|
261 |
void GameSizeChanged(); |
|
262 |
bool MakeScreenshot(); |
|
263 |
bool MakeWorldScreenshot(int left, int top, int width, int height, int zoom); |
|
264 |
bool FileExists(const char *filename); |
|
265 |
bool ReadLanguagePack(int index); |
|
266 |
void InitializeLanguagePacks(); |
|
267 |
byte *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize); |
|
268 |
int GetLanguageList(char **languages, int max); |
|
269 |
||
270 |
const char *GetScreenshotFormatDesc(int i); |
|
271 |
void InitializeScreenshotFormats(); |
|
272 |
void SetScreenshotFormat(int i); |
|
273 |
void CheckSwitchToEuro(); |
|
274 |
||
275 |
void LoadFromConfig(); |
|
276 |
void SaveToConfig(); |
|
277 |
int ttd_main(int argc, char* argv[]); |
|
223
0e5cc5a65df6
(svn r224) -Fix: Music now finally works on WinXP. DirectMusic is now default for an OS >= WinNT4 (WinNT4, Win2k, WinXP), and MIDI driver for lower OS's (Win95, Win98, WinME, etc).
darkvater
parents:
211
diff
changeset
|
278 |
byte GetOSVersion(); |
0 | 279 |
|
280 |
void DeterminePaths(); |
|
281 |
char * CDECL str_fmt(const char *str, ...); |
|
282 |
||
283 |
#endif /* FUNCTIONS_H */ |