summaryrefslogtreecommitdiff
path: root/src/enums
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-15 13:58:32 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-16 01:52:14 +0300
commit41cc92f73e39cec5dfea6b1164176610cccc7df4 (patch)
tree22fd3d388084d2c61fe80f0441c3c30ab8ffd33c /src/enums
parent7aa637abc8b0bca35aacdb9492e65f557ed32038 (diff)
downloadplus-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.gz
plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.bz2
plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.xz
plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.zip
Add strong typed int for item color.
Diffstat (limited to 'src/enums')
-rw-r--r--src/enums/simpletypes/intdefines.h6
-rw-r--r--src/enums/simpletypes/itemcolor.h29
2 files changed, 33 insertions, 2 deletions
diff --git a/src/enums/simpletypes/intdefines.h b/src/enums/simpletypes/intdefines.h
index 984e9d411..975c63c3f 100644
--- a/src/enums/simpletypes/intdefines.h
+++ b/src/enums/simpletypes/intdefines.h
@@ -29,7 +29,8 @@
enum class name : type \
{ \
}; \
- const name name##_zero = static_cast<name>(0)
+ const name name##_zero = static_cast<name>(0); \
+ const name name##_one = static_cast<name>(1)
#define fromInt(val, name) static_cast<name>(val)
#define toInt(val, name) static_cast<name>(val)
@@ -39,7 +40,8 @@
#define defIntEnum(name, type) \
typedef type name; \
- const name name##_zero = 0
+ const name name##_zero = 0; \
+ const name name##_one = 1
#define fromInt(val, name) (val)
#define toInt(val, name) (val)
#define defIntEnumNeg(name) const name name##_negOne = -1
diff --git a/src/enums/simpletypes/itemcolor.h b/src/enums/simpletypes/itemcolor.h
new file mode 100644
index 000000000..55966596e
--- /dev/null
+++ b/src/enums/simpletypes/itemcolor.h
@@ -0,0 +1,29 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2015 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ENUMS_SIMPLETYPES_ITEMCOLOR_H
+#define ENUMS_SIMPLETYPES_ITEMCOLOR_H
+
+#include "enums/simpletypes/intdefines.h"
+
+defIntEnum(ItemColor, uint16_t);
+defIntEnumNeg(ItemColor);
+
+#endif // ENUMS_SIMPLETYPES_ITEMCOLOR_H