summaryrefslogtreecommitdiff
path: root/src/core/random_func.hpp
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2008-06-22 15:21:51 +0000
committerskidd13 <skidd13@openttd.org>2008-06-22 15:21:51 +0000
commit640e5478862e3b83d85db6332e0d82a45a95e4ed (patch)
tree8904cbdb49b1373360cba22af59cfdea4811c6de /src/core/random_func.hpp
parent31b002dab0cb1bcbc00c9982a72e2cd948f74de5 (diff)
downloadopenttd-640e5478862e3b83d85db6332e0d82a45a95e4ed.tar.xz
(svn r13606) -Codechange: use "static FORCEINLINE" where possible as default for core functions (big functions use just inline instead)
Diffstat (limited to 'src/core/random_func.hpp')
-rw-r--r--src/core/random_func.hpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/random_func.hpp b/src/core/random_func.hpp
index cd273cb08..18cde93d3 100644
--- a/src/core/random_func.hpp
+++ b/src/core/random_func.hpp
@@ -59,12 +59,12 @@ void SetRandomSeed(uint32 seed);
#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
uint DoRandomRange(uint max, int line, const char *file);
#else
- static inline uint32 Random() { return _random.Next(); }
- static inline uint32 RandomRange(uint16 max) { return _random.Next(max); }
+ static FORCEINLINE uint32 Random() { return _random.Next(); }
+ static FORCEINLINE uint32 RandomRange(uint16 max) { return _random.Next(max); }
#endif
-static inline uint32 InteractiveRandom() { return _interactive_random.Next(); }
-static inline uint32 InteractiveRandomRange(uint16 max) { return _interactive_random.Next(max); }
+static FORCEINLINE uint32 InteractiveRandom() { return _interactive_random.Next(); }
+static FORCEINLINE uint32 InteractiveRandomRange(uint16 max) { return _interactive_random.Next(max); }
/**
* Checks if a given randomize-number is below a given probability.
@@ -81,7 +81,7 @@ static inline uint32 InteractiveRandomRange(uint16 max) { return _interactive_ra
* @param r The given randomize-number
* @return True if v is less or equals (a/b)
*/
-static inline bool Chance16I(const uint a, const uint b, const uint32 r)
+static FORCEINLINE bool Chance16I(const uint a, const uint b, const uint32 r)
{
assert(b != 0);
return (uint16)r < (uint16)(((a << 16) + b / 2) / b);
@@ -99,7 +99,7 @@ static inline bool Chance16I(const uint a, const uint b, const uint32 r)
* @param b The denominator of the fraction
* @return True in (a/b) percent
*/
-static inline bool Chance16(const uint a, const uint b)
+static FORCEINLINE bool Chance16(const uint a, const uint b)
{
return Chance16I(a, b, Random());
}
@@ -119,7 +119,7 @@ static inline bool Chance16(const uint a, const uint b)
* @param r The variable to save the randomize-number from Random()
* @return True in (a/b) percent
*/
-static inline bool Chance16R(const uint a, const uint b, uint32 &r)
+static FORCEINLINE bool Chance16R(const uint a, const uint b, uint32 &r)
{
r = Random();
return Chance16I(a, b, r);