diff options
author | skidd13 <skidd13@openttd.org> | 2008-06-22 15:41:38 +0000 |
---|---|---|
committer | skidd13 <skidd13@openttd.org> | 2008-06-22 15:41:38 +0000 |
commit | b4ef380c49c2dfc78c7bd25a8ebc15d7a27b7243 (patch) | |
tree | 5108d49e47c818fec8c5b29f346e207dde9f22a7 /src/core | |
parent | 640e5478862e3b83d85db6332e0d82a45a95e4ed (diff) | |
download | openttd-b4ef380c49c2dfc78c7bd25a8ebc15d7a27b7243.tar.xz |
(svn r13607) -Fix (r13606): some coding style issues got fixed but some got/stayed broken
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/alloc_func.hpp | 2 | ||||
-rw-r--r-- | src/core/alloc_type.hpp | 19 | ||||
-rw-r--r-- | src/core/math_func.hpp | 3 | ||||
-rw-r--r-- | src/core/random_func.hpp | 22 |
4 files changed, 36 insertions, 10 deletions
diff --git a/src/core/alloc_func.hpp b/src/core/alloc_func.hpp index 45c0036d9..f1e0f7ba8 100644 --- a/src/core/alloc_func.hpp +++ b/src/core/alloc_func.hpp @@ -76,7 +76,7 @@ static FORCEINLINE T *CallocT(size_t num_elements) * @return NULL when num_elements == 0, non-NULL otherwise. */ template <typename T> -FORCEINLINE T *ReallocT(T *t_ptr, size_t num_elements) +static FORCEINLINE T *ReallocT(T *t_ptr, size_t num_elements) { /* * MorphOS cannot handle 0 elements allocations, or rather that always diff --git a/src/core/alloc_type.hpp b/src/core/alloc_type.hpp index fe9c3b81d..cc549658f 100644 --- a/src/core/alloc_type.hpp +++ b/src/core/alloc_type.hpp @@ -29,28 +29,39 @@ struct SmallStackSafeStackAlloc { /** Allocating the memory */ SmallStackSafeStackAlloc() : data(MallocT<T>(length)), len(length) {} + /** And freeing when it goes out of scope */ - ~SmallStackSafeStackAlloc() { free(data); } + ~SmallStackSafeStackAlloc() + { + free(data); + } #endif /** * Gets a pointer to the data stored in this wrapper. * @return the pointer. */ - FORCEINLINE operator T* () { return data; } + FORCEINLINE operator T* () + { + return data; + } /** * Gets a pointer to the data stored in this wrapper. * @return the pointer. */ - FORCEINLINE T* operator -> () { return data; } + FORCEINLINE T* operator -> () + { + return data; + } /** * Gets a pointer to the last data element stored in this wrapper. * @note needed because endof does not work properly for pointers. * @return the 'endof' pointer. */ - FORCEINLINE T* EndOf() { + FORCEINLINE T* EndOf() + { #if !defined(__NDS__) return endof(data); #else diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp index 6b91b3ddb..e2cc8b89c 100644 --- a/src/core/math_func.hpp +++ b/src/core/math_func.hpp @@ -192,7 +192,8 @@ static FORCEINLINE uint16 ClampToU16(const uint64 a) * @return The absolute difference between the given scalars */ template <typename T> -static FORCEINLINE T Delta(const T a, const T b) { +static FORCEINLINE T Delta(const T a, const T b) +{ return (a < b) ? b - a : a - b; } diff --git a/src/core/random_func.hpp b/src/core/random_func.hpp index 18cde93d3..d77d38906 100644 --- a/src/core/random_func.hpp +++ b/src/core/random_func.hpp @@ -59,12 +59,26 @@ void SetRandomSeed(uint32 seed); #define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__) uint DoRandomRange(uint max, int line, const char *file); #else - static FORCEINLINE uint32 Random() { return _random.Next(); } - static FORCEINLINE 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 FORCEINLINE uint32 InteractiveRandom() { return _interactive_random.Next(); } -static FORCEINLINE 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. |