summaryrefslogtreecommitdiff
path: root/src/cmd_helper.h
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-04-17 13:31:41 +0000
committerfrosch <frosch@openttd.org>2010-04-17 13:31:41 +0000
commit75d4bc947ddbb92ecf660d9a9858c854d5e34a15 (patch)
treeb218a672a78b894388373d2e700e6ad6ebe75b63 /src/cmd_helper.h
parent184fa43df2e14c73162e641bc9bc83e403f069ed (diff)
downloadopenttd-75d4bc947ddbb92ecf660d9a9858c854d5e34a15.tar.xz
(svn r19654) -Codechange: Use Extract<> in more places.
Diffstat (limited to 'src/cmd_helper.h')
-rw-r--r--src/cmd_helper.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd_helper.h b/src/cmd_helper.h
index 1530beedb..0b56fb767 100644
--- a/src/cmd_helper.h
+++ b/src/cmd_helper.h
@@ -20,7 +20,8 @@ template<typename T, uint S, uint N, typename U> static inline T Extract(U v)
assert_tcompile(N == EnumPropsT<T>::num_bits);
assert_tcompile(S + N <= sizeof(U) * 8);
assert_tcompile(EnumPropsT<T>::end <= (1 << N));
- return (T)GB(v, S, N);
+ U masked = GB(v, S, N);
+ return IsInsideMM(masked, EnumPropsT<T>::begin, EnumPropsT<T>::end) ? (T)masked : EnumPropsT<T>::invalid;
}
#endif