summaryrefslogtreecommitdiff
path: root/src/functions.h
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2007-11-21 19:13:38 +0000
committerskidd13 <skidd13@openttd.org>2007-11-21 19:13:38 +0000
commit039570342d9c77650d88835c82aef4e6c801a1a0 (patch)
treee5365f6350e2ea95f1048090f341a3d4c533c9e8 /src/functions.h
parent00c376129d0f241dfe0b71bd2ffacf4c5dfd1803 (diff)
downloadopenttd-039570342d9c77650d88835c82aef4e6c801a1a0.tar.xz
(svn r11488) -Codechange: Spilt the random functions out to seperate file
-Codechange: Make the mersenne twister more readable -Codechange: Unify the seeding process of random
Diffstat (limited to 'src/functions.h')
-rw-r--r--src/functions.h44
1 files changed, 1 insertions, 43 deletions
diff --git a/src/functions.h b/src/functions.h
index ec680e7e8..191ad7708 100644
--- a/src/functions.h
+++ b/src/functions.h
@@ -7,6 +7,7 @@
#include "gfx.h"
#include "viewport.h"
+#include "core/random_func.hpp"
void UpdateTownMaxPass(Town *t);
@@ -32,52 +33,9 @@ void ShowInfo(const char *str);
void CDECL ShowInfoF(const char *str, ...);
/* openttd.cpp */
-
-/**************
- * Warning: DO NOT enable this unless you understand what it does
- *
- * If enabled, in a network game all randoms will be dumped to the
- * stdout if the first client joins (or if you are a client). This
- * is to help finding desync problems.
- *
- * Warning: DO NOT enable this unless you understand what it does
- **************/
-
-//#define RANDOM_DEBUG
-
-
-// Enable this to produce higher quality random numbers.
-// Doesn't work with network yet.
-//#define MERSENNE_TWISTER
-
-// Mersenne twister functions
-void SeedMT(uint32 seed);
-uint32 RandomMT();
-
-
-#ifdef MERSENNE_TWISTER
- static inline uint32 Random() { return RandomMT(); }
- uint RandomRange(uint max);
-#else
-
-#ifdef RANDOM_DEBUG
- #define Random() DoRandom(__LINE__, __FILE__)
- uint32 DoRandom(int line, const char *file);
- #define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
- uint DoRandomRange(uint max, int line, const char *file);
-#else
- uint32 Random();
- uint RandomRange(uint max);
-#endif
-#endif // MERSENNE_TWISTER
-
static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
static inline TileIndex RandomTile() { return TILE_MASK(Random()); }
-
-uint32 InteractiveRandom(); // Used for random sequences that are not the same on the other end of the multiplayer link
-uint InteractiveRandomRange(uint max);
-
/* texteff.cpp */
void AddAnimatedTile(TileIndex tile);
void DeleteAnimatedTile(TileIndex tile);