summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-31 00:19:18 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-31 00:19:18 +0300
commit694e07d193e7c5758a7d672b45668651b034003d (patch)
tree20a4aec8dee2b3b5475db9f3667e797fb43c603b /src/game.cpp
parentc9a84749b3b71d4df6cc3b9b488d60dc4a013a20 (diff)
downloadmanaplus-694e07d193e7c5758a7d672b45668651b034003d.tar.gz
manaplus-694e07d193e7c5758a7d672b45668651b034003d.tar.bz2
manaplus-694e07d193e7c5758a7d672b45668651b034003d.tar.xz
manaplus-694e07d193e7c5758a7d672b45668651b034003d.zip
Convert InputAction enum into strong typed enum.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 88d38f1a4..5ffc461f5 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1129,7 +1129,7 @@ void Game::updateHistory(const SDL_Event &event)
{
bool old = false;
- const int key = keyboard.getKeyIndex(event);
+ const InputActionT key = keyboard.getKeyIndex(event);
const int time = cur_time;
int idx = -1;
for (int f = 0; f < MAX_LASTKEYS; f ++)
@@ -1152,8 +1152,11 @@ void Game::updateHistory(const SDL_Event &event)
for (int f = 0; f < MAX_LASTKEYS; f ++)
{
LastKey &lastKey = mLastKeys[f];
- if (lastKey.key == -1 || lastKey.time < mLastKeys[idx].time)
+ if (lastKey.key == InputAction::NO_VALUE ||
+ lastKey.time < mLastKeys[idx].time)
+ {
idx = f;
+ }
}
}
@@ -1186,13 +1189,13 @@ void Game::checkKeys()
for (int f = 0; f < MAX_LASTKEYS; f ++)
{
LastKey &lastKey = mLastKeys[f];
- if (lastKey.key != -1)
+ if (lastKey.key != InputAction::NO_VALUE)
{
if (lastKey.time + timeRange < time)
{
if (lastKey.cnt > cntInTime)
mValidSpeed = false;
- lastKey.key = -1;
+ lastKey.key = InputAction::NO_VALUE;
}
}
}
@@ -1209,7 +1212,7 @@ void Game::clearKeysArray()
for (int f = 0; f < MAX_LASTKEYS; f ++)
{
mLastKeys[f].time = 0;
- mLastKeys[f].key = -1;
+ mLastKeys[f].key = InputAction::NO_VALUE;
mLastKeys[f].cnt = 0;
}
}