diff options
author | truebrain <truebrain@openttd.org> | 2011-12-20 17:57:56 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-12-20 17:57:56 +0000 |
commit | 1c9bec19993417b1f3b240f2bdb0745aa26c0cb3 (patch) | |
tree | d09407cc962ee87ac1bbbbc60951cad74c6b1db7 /src/core/random_func.hpp | |
parent | 7a38642a1c83531a65907ae784bc03a82d35132a (diff) | |
download | openttd-1c9bec19993417b1f3b240f2bdb0745aa26c0cb3.tar.xz |
(svn r23640) -Fix: stop using FORCEINLINE (1/3rd of the instances were, the others were still regular inline), but make sure inline is always a 'forced' inline (I am looking at you MSVC)
Diffstat (limited to 'src/core/random_func.hpp')
-rw-r--r-- | src/core/random_func.hpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/random_func.hpp b/src/core/random_func.hpp index 597efcdc7..8c3bed166 100644 --- a/src/core/random_func.hpp +++ b/src/core/random_func.hpp @@ -81,23 +81,23 @@ void SetRandomSeed(uint32 seed); #define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__) uint32 DoRandomRange(uint32 max, int line, const char *file); #else - static FORCEINLINE uint32 Random() + static inline uint32 Random() { return _random.Next(); } - static FORCEINLINE uint32 RandomRange(uint32 max) + static inline uint32 RandomRange(uint32 max) { return _random.Next(max); } #endif -static FORCEINLINE uint32 InteractiveRandom() +static inline uint32 InteractiveRandom() { return _interactive_random.Next(); } -static FORCEINLINE uint32 InteractiveRandomRange(uint32 max) +static inline uint32 InteractiveRandomRange(uint32 max) { return _interactive_random.Next(max); } @@ -117,7 +117,7 @@ static FORCEINLINE uint32 InteractiveRandomRange(uint32 max) * @param r The given randomize-number * @return True if the probability given by r is less or equal to (a/b) */ -static FORCEINLINE bool Chance16I(const uint a, const uint b, const uint32 r) +static inline bool Chance16I(const uint a, const uint b, const uint32 r) { assert(b != 0); return (((uint16)r * b + b / 2) >> 16) < a; @@ -136,7 +136,7 @@ static FORCEINLINE bool Chance16I(const uint a, const uint b, const uint32 r) #ifdef RANDOM_DEBUG #define Chance16(a, b) Chance16I(a, b, DoRandom(__LINE__, __FILE__)) #else -static FORCEINLINE bool Chance16(const uint a, const uint b) +static inline bool Chance16(const uint a, const uint b) { return Chance16I(a, b, Random()); } @@ -160,7 +160,7 @@ static FORCEINLINE bool Chance16(const uint a, const uint b) #ifdef RANDOM_DEBUG #define Chance16R(a, b, r) (r = DoRandom(__LINE__, __FILE__), Chance16I(a, b, r)) #else -static FORCEINLINE bool Chance16R(const uint a, const uint b, uint32 &r) +static inline bool Chance16R(const uint a, const uint b, uint32 &r) { r = Random(); return Chance16I(a, b, r); |