78 // Doesn't work with network yet. |
78 // Doesn't work with network yet. |
79 //#define MERSENNE_TWISTER |
79 //#define MERSENNE_TWISTER |
80 |
80 |
81 // Mersenne twister functions |
81 // Mersenne twister functions |
82 void SeedMT(uint32 seed); |
82 void SeedMT(uint32 seed); |
83 uint32 RandomMT(void); |
83 uint32 RandomMT(); |
84 |
84 |
85 |
85 |
86 #ifdef MERSENNE_TWISTER |
86 #ifdef MERSENNE_TWISTER |
87 static inline uint32 Random(void) { return RandomMT(); } |
87 static inline uint32 Random() { return RandomMT(); } |
88 uint RandomRange(uint max); |
88 uint RandomRange(uint max); |
89 #else |
89 #else |
90 |
90 |
91 #ifdef RANDOM_DEBUG |
91 #ifdef RANDOM_DEBUG |
92 #define Random() DoRandom(__LINE__, __FILE__) |
92 #define Random() DoRandom(__LINE__, __FILE__) |
93 uint32 DoRandom(int line, const char *file); |
93 uint32 DoRandom(int line, const char *file); |
94 #define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__) |
94 #define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__) |
95 uint DoRandomRange(uint max, int line, const char *file); |
95 uint DoRandomRange(uint max, int line, const char *file); |
96 #else |
96 #else |
97 uint32 Random(void); |
97 uint32 Random(); |
98 uint RandomRange(uint max); |
98 uint RandomRange(uint max); |
99 #endif |
99 #endif |
100 #endif // MERSENNE_TWISTER |
100 #endif // MERSENNE_TWISTER |
101 |
101 |
102 static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); } |
102 static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); } |
103 static inline TileIndex RandomTile(void) { return TILE_MASK(Random()); } |
103 static inline TileIndex RandomTile() { return TILE_MASK(Random()); } |
104 |
104 |
105 |
105 |
106 uint32 InteractiveRandom(void); // Used for random sequences that are not the same on the other end of the multiplayer link |
106 uint32 InteractiveRandom(); // Used for random sequences that are not the same on the other end of the multiplayer link |
107 uint InteractiveRandomRange(uint max); |
107 uint InteractiveRandomRange(uint max); |
108 |
108 |
109 /* texteff.cpp */ |
109 /* texteff.cpp */ |
110 void MoveAllTextEffects(void); |
110 void MoveAllTextEffects(); |
111 void AddTextEffect(StringID msg, int x, int y, uint16 duration); |
111 void AddTextEffect(StringID msg, int x, int y, uint16 duration); |
112 void InitTextEffects(void); |
112 void InitTextEffects(); |
113 void DrawTextEffects(DrawPixelInfo *dpi); |
113 void DrawTextEffects(DrawPixelInfo *dpi); |
114 |
114 |
115 void InitTextMessage(void); |
115 void InitTextMessage(); |
116 void DrawTextMessage(void); |
116 void DrawTextMessage(); |
117 void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...); |
117 void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...); |
118 void UndrawTextMessage(void); |
118 void UndrawTextMessage(); |
119 |
119 |
120 bool AddAnimatedTile(TileIndex tile); |
120 bool AddAnimatedTile(TileIndex tile); |
121 void DeleteAnimatedTile(TileIndex tile); |
121 void DeleteAnimatedTile(TileIndex tile); |
122 void AnimateAnimatedTiles(void); |
122 void AnimateAnimatedTiles(); |
123 void InitializeAnimatedTiles(void); |
123 void InitializeAnimatedTiles(); |
124 |
124 |
125 /* tunnelbridge_cmd.cpp */ |
125 /* tunnelbridge_cmd.cpp */ |
126 bool CheckBridge_Stuff(byte bridge_type, uint bridge_len); |
126 bool CheckBridge_Stuff(byte bridge_type, uint bridge_len); |
127 uint32 GetBridgeLength(TileIndex begin, TileIndex end); |
127 uint32 GetBridgeLength(TileIndex begin, TileIndex end); |
128 int CalcBridgeLenCostFactor(int x); |
128 int CalcBridgeLenCostFactor(int x); |
129 |
129 |
130 /* misc_cmd.cpp */ |
130 /* misc_cmd.cpp */ |
131 void PlaceTreesRandomly(void); |
131 void PlaceTreesRandomly(); |
132 |
132 |
133 void InitializeLandscapeVariables(bool only_constants); |
133 void InitializeLandscapeVariables(bool only_constants); |
134 |
134 |
135 /* misc.cpp */ |
135 /* misc.cpp */ |
136 bool IsCustomName(StringID id); |
136 bool IsCustomName(StringID id); |
140 /* AllocateNameUnique also tests if the name used is not used anywere else |
140 /* AllocateNameUnique also tests if the name used is not used anywere else |
141 * and if it is used, it returns an error. */ |
141 * and if it is used, it returns an error. */ |
142 #define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true) |
142 #define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true) |
143 #define AllocateName(name, skip) RealAllocateName(name, skip, false) |
143 #define AllocateName(name, skip) RealAllocateName(name, skip, false) |
144 StringID RealAllocateName(const char *name, byte skip, bool check_double); |
144 StringID RealAllocateName(const char *name, byte skip, bool check_double); |
145 void ConvertNameArray(void); |
145 void ConvertNameArray(); |
146 |
146 |
147 /* misc functions */ |
147 /* misc functions */ |
148 void MarkTileDirty(int x, int y); |
148 void MarkTileDirty(int x, int y); |
149 void MarkTileDirtyByTile(TileIndex tile); |
149 void MarkTileDirtyByTile(TileIndex tile); |
150 void InvalidateWindow(WindowClass cls, WindowNumber number); |
150 void InvalidateWindow(WindowClass cls, WindowNumber number); |
155 void DeleteWindowByClass(WindowClass cls); |
155 void DeleteWindowByClass(WindowClass cls); |
156 |
156 |
157 void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, byte mode, Window *w); |
157 void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, byte mode, Window *w); |
158 void SetObjectToPlace(CursorID icon, SpriteID pal, byte mode, WindowClass window_class, WindowNumber window_num); |
158 void SetObjectToPlace(CursorID icon, SpriteID pal, byte mode, WindowClass window_class, WindowNumber window_num); |
159 |
159 |
160 void ResetObjectToPlace(void); |
160 void ResetObjectToPlace(); |
161 |
161 |
162 bool ScrollWindowTo(int x, int y, Window * w); |
162 bool ScrollWindowTo(int x, int y, Window * w); |
163 |
163 |
164 bool ScrollMainWindowToTile(TileIndex tile); |
164 bool ScrollMainWindowToTile(TileIndex tile); |
165 bool ScrollMainWindowTo(int x, int y); |
165 bool ScrollMainWindowTo(int x, int y); |
179 uint GetTownRadiusGroup(const Town* t, TileIndex tile); |
179 uint GetTownRadiusGroup(const Town* t, TileIndex tile); |
180 int FindFirstBit(uint32 x); |
180 int FindFirstBit(uint32 x); |
181 void ShowHighscoreTable(int difficulty, int8 rank); |
181 void ShowHighscoreTable(int difficulty, int8 rank); |
182 TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng); |
182 TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng); |
183 |
183 |
184 void AfterLoadTown(void); |
184 void AfterLoadTown(); |
185 void UpdatePatches(void); |
185 void UpdatePatches(); |
186 void AskExitGame(void); |
186 void AskExitGame(); |
187 void AskExitToGameMenu(void); |
187 void AskExitToGameMenu(); |
188 |
188 |
189 void RedrawAutosave(void); |
189 void RedrawAutosave(); |
190 |
190 |
191 StringID RemapOldStringID(StringID s); |
191 StringID RemapOldStringID(StringID s); |
192 |
192 |
193 void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str); |
193 void UpdateViewportSignPos(ViewportSign *sign, int left, int top, StringID str); |
194 |
194 |
201 SLD_NEW_GAME, |
201 SLD_NEW_GAME, |
202 }; |
202 }; |
203 void ShowSaveLoadDialog(int mode); |
203 void ShowSaveLoadDialog(int mode); |
204 |
204 |
205 /* callback from drivers that is called if the game size changes dynamically */ |
205 /* callback from drivers that is called if the game size changes dynamically */ |
206 void GameSizeChanged(void); |
206 void GameSizeChanged(); |
207 bool FileExists(const char *filename); |
207 bool FileExists(const char *filename); |
208 bool ReadLanguagePack(int index); |
|
209 void InitializeLanguagePacks(void); |
|
210 const char *GetCurrentLocale(const char *param); |
208 const char *GetCurrentLocale(const char *param); |
211 void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize); |
209 void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize); |
212 |
210 |
213 void LoadFromConfig(void); |
211 void LoadFromConfig(); |
214 void SaveToConfig(void); |
212 void SaveToConfig(); |
215 void CheckConfig(void); |
213 void CheckConfig(); |
216 int ttd_main(int argc, char* argv[]); |
214 int ttd_main(int argc, char* argv[]); |
217 void HandleExitGameRequest(void); |
215 void HandleExitGameRequest(); |
218 |
|
219 void DeterminePaths(void); |
|
220 |
216 |
221 #endif /* FUNCTIONS_H */ |
217 #endif /* FUNCTIONS_H */ |