summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2019-04-21 21:48:08 +0100
committerPeterN <peter@fuzzle.org>2019-04-21 22:31:12 +0100
commit66cd32a252ee0edab11448b560371878b2189223 (patch)
treeb3e89642700c76b4384b4b79152f8cbccb17d38e /src/core
parentac1e1a272fbba07195c1bf7613a886b692fb159d (diff)
downloadopenttd-66cd32a252ee0edab11448b560371878b2189223.tar.xz
Codechange: Use std::underlying_type for DECLARE_POSTFIX_INCREMENT.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/enum_type.hpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/enum_type.hpp b/src/core/enum_type.hpp
index 920cb514a..d5bcf6dbe 100644
--- a/src/core/enum_type.hpp
+++ b/src/core/enum_type.hpp
@@ -13,17 +13,17 @@
#define ENUM_TYPE_HPP
/** Some enums need to have allowed incrementing (i.e. StationClassID) */
-#define DECLARE_POSTFIX_INCREMENT(type) \
- inline type operator ++(type& e, int) \
+#define DECLARE_POSTFIX_INCREMENT(enum_type) \
+ inline enum_type operator ++(enum_type& e, int) \
{ \
- type e_org = e; \
- e = (type)((int)e + 1); \
+ enum_type e_org = e; \
+ e = (enum_type)((std::underlying_type<enum_type>::type)e + 1); \
return e_org; \
} \
- inline type operator --(type& e, int) \
+ inline enum_type operator --(enum_type& e, int) \
{ \
- type e_org = e; \
- e = (type)((int)e - 1); \
+ enum_type e_org = e; \
+ e = (enum_type)((std::underlying_type<enum_type>::type)e - 1); \
return e_org; \
}