diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-31 00:24:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-31 00:53:27 +0300 |
commit | 33777ea0994f01c696b74677f4937fe2987552c9 (patch) | |
tree | daf075a6dc57597301b0441a8d4e485ad80daedf /src | |
parent | 694e07d193e7c5758a7d672b45668651b034003d (diff) | |
download | manaverse-33777ea0994f01c696b74677f4937fe2987552c9.tar.gz manaverse-33777ea0994f01c696b74677f4937fe2987552c9.tar.bz2 manaverse-33777ea0994f01c696b74677f4937fe2987552c9.tar.xz manaverse-33777ea0994f01c696b74677f4937fe2987552c9.zip |
Add opearator+ for InputAction and unsigned int.
Signed-off-by: Andrei Karas <akaras@inbox.ru>
Diffstat (limited to 'src')
-rw-r--r-- | src/input/inputactionoperators.cpp | 6 | ||||
-rw-r--r-- | src/input/inputactionoperators.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/input/inputactionoperators.cpp b/src/input/inputactionoperators.cpp index a2c0eb496..ef0c48d69 100644 --- a/src/input/inputactionoperators.cpp +++ b/src/input/inputactionoperators.cpp @@ -26,6 +26,12 @@ InputActionT operator+(InputActionT action, const int& i) return action; } +InputActionT operator+(InputActionT action, const unsigned int& i) +{ + action = static_cast<InputActionT>(static_cast<unsigned int>(action) + i); + return action; +} + int operator-(const InputActionT &action1, const InputActionT &action2) { return static_cast<int>(action1) - static_cast<int>(action2); diff --git a/src/input/inputactionoperators.h b/src/input/inputactionoperators.h index 2a5244c46..a01c75bf8 100644 --- a/src/input/inputactionoperators.h +++ b/src/input/inputactionoperators.h @@ -26,6 +26,7 @@ #include "enums/input/inputaction.h" InputActionT operator+(InputActionT action, const int& i); +InputActionT operator+(InputActionT action, const unsigned int& i); int operator-(const InputActionT &action1, const InputActionT &action2); #endif // INPUT_INPUTACTIONOPERATORS_H |