summaryrefslogtreecommitdiff
path: root/macros.h
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-03-28 21:51:14 +0000
committerDarkvater <darkvater@openttd.org>2006-03-28 21:51:14 +0000
commit85602659537e2ff2b93f47294a1a1add6dbaeee6 (patch)
tree2f3c43d8636a934d32307352bc552d097094e7cd /macros.h
parent1e428481b2c7035fdba6936b2ba3f9af347d76e9 (diff)
downloadopenttd-85602659537e2ff2b93f47294a1a1add6dbaeee6.tar.xz
(svn r4142) - Fix [FS#74]: Incorrectly loaded settings from the config file when the signed uint32 variable would be negative.
Diffstat (limited to 'macros.h')
-rw-r--r--macros.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/macros.h b/macros.h
index 8f1064a0d..4f9fa192d 100644
--- a/macros.h
+++ b/macros.h
@@ -35,6 +35,12 @@ static inline int clamp(int a, int min, int max)
return a;
}
+static inline uint clampu(uint a, uint min, uint max)
+{
+ if (a <= min) return min;
+ if (a >= max) return max;
+ return a;
+}
static inline int32 BIGMULSS(int32 a, int32 b, int shift) {
return (int32)(((int64)(a) * (int64)(b)) >> (shift));