author | signde |
Mon, 13 Sep 2004 22:49:11 +0000 | |
changeset 239 | 23958632a582 |
parent 223 | 0e5cc5a65df6 |
child 337 | cbe0c766c947 |
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 */ |
239 | 103 |
uint InteractiveRandomRange(uint max); |
104 |
||
0 | 105 |
void SetDate(uint date); |
106 |
/* facedraw.c */ |
|
107 |
void DrawPlayerFace(uint32 face, int color, int x, int y); |
|
108 |
||
109 |
/* texteff.c */ |
|
110 |
void MoveAllTextEffects(); |
|
111 |
void AddTextEffect(StringID msg, int x, int y, uint16 duration); |
|
112 |
void InitTextEffects(); |
|
113 |
void DrawTextEffects(DrawPixelInfo *dpi); |
|
114 |
||
115 |
bool AddAnimatedTile(uint tile); |
|
116 |
void DeleteAnimatedTile(uint tile); |
|
117 |
void AnimateAnimatedTiles(); |
|
118 |
void InitializeAnimatedTiles(); |
|
119 |
||
120 |
/* tunnelbridge_cmd.c */ |
|
121 |
bool CheckTunnelInWay(uint tile, int z); |
|
122 |
bool CheckBridge_Stuff(byte bridge_type, int bridge_len); |
|
123 |
uint32 GetBridgeLength(TileIndex begin, TileIndex end); |
|
124 |
int CalcBridgeLenCostFactor(int x); |
|
125 |
||
126 |
/* network.c */ |
|
127 |
typedef void CommandCallback(bool success, uint tile, uint32 p1, uint32 p2); |
|
128 |
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd); |
|
129 |
||
130 |
void NetworkReceive(); |
|
131 |
void NetworkSend(); |
|
132 |
void NetworkProcessCommands(); |
|
105 | 133 |
void NetworkListen(); |
134 |
void NetworkInitialize(); |
|
0 | 135 |
void NetworkShutdown(); |
136 |
void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback); |
|
239 | 137 |
void NetworkSendEvent(uint16 type, uint16 data_len, void * data); |
105 | 138 |
void NetworkStartSync(bool fcreset); |
139 |
void NetworkClose(bool client); |
|
185
646403e35006
(svn r186) -Add: debug 'net' for network debug (sign_de)
truelight
parents:
175
diff
changeset
|
140 |
void NetworkSendReadyPacket(); |
206 | 141 |
void NetworkSendSyncPackets(); |
208 | 142 |
void NetworkSendFrameSyncPackets(); |
206 | 143 |
bool NetworkCheckClientReady(); |
105 | 144 |
|
0 | 145 |
void NetworkIPListInit(); |
105 | 146 |
|
147 |
void NetworkCoreInit(); |
|
148 |
void NetworkCoreShutdown(); |
|
149 |
void NetworkCoreDisconnect(); |
|
150 |
void NetworkCoreLoop(bool incomming); |
|
175
d6cccece959a
(svn r176) -Fix: network_gui const and warnings fixes (Tron)
darkvater
parents:
159
diff
changeset
|
151 |
bool NetworkCoreConnectGame(const byte* b, unsigned short port); |
211 | 152 |
bool NetworkCoreConnectGameStruct(NetworkGameList * item); |
105 | 153 |
bool NetworkCoreStartGame(); |
154 |
||
155 |
void NetworkLobbyShutdown(); |
|
156 |
void NetworkLobbyInit(); |
|
157 |
||
158 |
void NetworkGameListClear(); |
|
211 | 159 |
NetworkGameList * NetworkGameListAdd(); |
105 | 160 |
void NetworkGameListFromLAN(); |
161 |
void NetworkGameListFromInternet(); |
|
211 | 162 |
NetworkGameList * NetworkGameListItem(uint16 index); |
105 | 163 |
|
164 |
void NetworkGameFillDefaults(); |
|
165 |
void NetworkGameChangeDate(uint16 newdate); |
|
0 | 166 |
|
167 |
/* misc_cmd.c */ |
|
168 |
void PlaceTreesRandomly(); |
|
169 |
||
170 |
uint GetTileDist(TileIndex xy1, TileIndex xy2); |
|
171 |
uint GetTileDist1D(TileIndex xy1, TileIndex xy2); |
|
172 |
uint GetTileDist1Db(TileIndex xy1, TileIndex xy2); |
|
173 |
uint GetTileDistAdv(TileIndex xy1, TileIndex xy2); |
|
174 |
bool CheckDistanceFromEdge(TileIndex tile, uint distance); |
|
175 |
||
176 |
void InitializeLandscapeVariables(bool only_constants); |
|
177 |
||
178 |
/* misc.c */ |
|
179 |
void DeleteName(StringID id); |
|
180 |
byte *GetName(int id, byte *buff); |
|
181 |
StringID AllocateName(const byte *name, byte skip); |
|
182 |
void ConvertDayToYMD(YearMonthDay *ymd, uint16 date); |
|
183 |
uint ConvertYMDToDay(uint year, uint month, uint day); |
|
184 |
uint ConvertIntDate(uint date); |
|
185 |
||
186 |
||
187 |
||
188 |
/* misc functions */ |
|
189 |
void MarkTileDirty(int x, int y); |
|
190 |
void MarkTileDirtyByTile(TileIndex tile); |
|
191 |
void InvalidateWindow(byte cls, WindowNumber number); |
|
192 |
void InvalidateWindowWidget(byte cls, WindowNumber number, byte widget_index); |
|
193 |
void InvalidateWindowClasses(byte cls); |
|
194 |
void DeleteWindowById(WindowClass cls, WindowNumber number); |
|
195 |
||
196 |
void SetObjectToPlaceWnd(int icon, byte mode, Window *w); |
|
197 |
void SetObjectToPlace(int icon, byte mode, byte window_class, uint16 window_num); |
|
198 |
||
199 |
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
|
200 |
|
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
|
201 |
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
|
202 |
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
|
203 |
|
0 | 204 |
bool ScrollMainWindowToTile(TileIndex tile); |
205 |
bool ScrollMainWindowTo(int x, int y); |
|
206 |
void DrawSprite(uint32 img, int x, int y); |
|
207 |
bool EnsureNoVehicle(TileIndex tile); |
|
208 |
bool EnsureNoVehicleZ(TileIndex tile, byte z); |
|
209 |
void MarkAllViewportsDirty(int left, int top, int right, int bottom); |
|
210 |
void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost); |
|
211 |
void MarkWholeScreenDirty(); |
|
212 |
||
213 |
void DrawFoundation(TileInfo *ti, uint f); |
|
214 |
||
215 |
bool CheckIfAuthorityAllows(uint tile); |
|
216 |
Town *ClosestTownFromTile(uint tile, uint threshold); |
|
217 |
void ChangeTownRating(Town *t, int add, int max); |
|
218 |
||
219 |
uint GetRoadBitsByTile(TileIndex tile); |
|
220 |
int GetTownRadiusGroup(Town *t, uint tile); |
|
221 |
int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, byte cargo_type); |
|
222 |
void ShowRenameSignWindow(SignStruct *ss); |
|
223 |
void ShowRenameCheckpointWindow(Checkpoint *cp); |
|
224 |
int FindFirstBit(uint32 x); |
|
225 |
void ShowHighscoreTable(int tbl); |
|
226 |
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng); |
|
227 |
||
228 |
enum SaveOrLoadResult { |
|
229 |
SL_OK = 0, // completed successfully |
|
230 |
SL_ERROR = 1, // error that was caught before internal structures were modified |
|
231 |
SL_REINIT = 2, // error that was caught in the middle of updating game state, need to clear it. (can only happen during load) |
|
232 |
}; |
|
233 |
enum SaveOrLoadMode { |
|
234 |
SL_INVALID = -1, |
|
235 |
SL_LOAD = 0, |
|
236 |
SL_SAVE = 1, |
|
237 |
SL_OLD_LOAD = 2, |
|
238 |
}; |
|
239 |
||
240 |
int SaveOrLoad(const char *filename, int mode); |
|
241 |
||
242 |
void AfterLoadTown(); |
|
243 |
void AskExitGame(); |
|
244 |
void AskExitToGameMenu(); |
|
245 |
||
246 |
void RedrawAutosave(); |
|
247 |
||
248 |
StringID RemapOldStringID(StringID s); |
|
249 |
||
250 |
void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str); |
|
251 |
||
252 |
enum { |
|
253 |
SLD_LOAD_GAME = 0, |
|
254 |
SLD_LOAD_SCENARIO = 1, |
|
255 |
SLD_SAVE_GAME = 2, |
|
256 |
SLD_SAVE_SCENARIO = 3, |
|
257 |
SLD_NEW_GAME = 4, |
|
258 |
}; |
|
259 |
void ShowSaveLoadDialog(int mode); |
|
260 |
||
261 |
void ttd_strlcpy(char *dst, const char *src, size_t len); |
|
262 |
||
263 |
// callback from drivers that is called if the game size changes dynamically |
|
264 |
void GameSizeChanged(); |
|
265 |
bool MakeScreenshot(); |
|
266 |
bool MakeWorldScreenshot(int left, int top, int width, int height, int zoom); |
|
267 |
bool FileExists(const char *filename); |
|
268 |
bool ReadLanguagePack(int index); |
|
269 |
void InitializeLanguagePacks(); |
|
270 |
byte *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize); |
|
271 |
int GetLanguageList(char **languages, int max); |
|
272 |
||
273 |
const char *GetScreenshotFormatDesc(int i); |
|
274 |
void InitializeScreenshotFormats(); |
|
275 |
void SetScreenshotFormat(int i); |
|
276 |
void CheckSwitchToEuro(); |
|
277 |
||
278 |
void LoadFromConfig(); |
|
279 |
void SaveToConfig(); |
|
280 |
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
|
281 |
byte GetOSVersion(); |
0 | 282 |
|
283 |
void DeterminePaths(); |
|
284 |
char * CDECL str_fmt(const char *str, ...); |
|
285 |
||
286 |
#endif /* FUNCTIONS_H */ |