From c8470e1d8915134bca7836732c174c40d3b9cf97 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 17 Feb 2010 16:18:23 +0000 Subject: [PATCH] Use Common::KEYCODE_* instead of ASCII values for keycode comparison. svn-id: r48079 --- engines/kyra/gui.cpp | 2 +- engines/kyra/kyra_v1.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index f5fe417c0d1..d976c3463dd 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -421,7 +421,7 @@ void GUI::checkTextfieldInput() { while (_vm->_eventMan->pollEvent(event) && running) { switch (event.type) { case Common::EVENT_KEYDOWN: - if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL) + if (event.kbd.keycode == Common::KEYCODE_q && event.kbd.flags == Common::KBD_CTRL) _vm->quitGame(); else _keyPressed = event.kbd; diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index 451750ce140..2c2d6a424b7 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -261,9 +261,9 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag) switch (event.type) { case Common::EVENT_KEYDOWN: - if (event.kbd.keycode >= '1' && event.kbd.keycode <= '9' && + if (event.kbd.keycode >= Common::KEYCODE_1 && event.kbd.keycode <= Common::KEYCODE_9 && (event.kbd.flags == Common::KBD_CTRL || event.kbd.flags == Common::KBD_ALT) && mainLoop) { - int saveLoadSlot = 9 - (event.kbd.keycode - '0') + 990; + int saveLoadSlot = 9 - (event.kbd.keycode - Common::KEYCODE_0) + 990; if (event.kbd.flags == Common::KBD_CTRL) { loadGameStateCheck(saveLoadSlot); @@ -271,14 +271,14 @@ int KyraEngine_v1::checkInput(Button *buttonList, bool mainLoop, int eventFlag) breakLoop = true; } else { char savegameName[14]; - sprintf(savegameName, "Quicksave %d", event.kbd.keycode - '0'); + sprintf(savegameName, "Quicksave %d", event.kbd.keycode - Common::KEYCODE_0); saveGameState(saveLoadSlot, savegameName, 0); } } else if (event.kbd.flags == Common::KBD_CTRL) { - if (event.kbd.keycode == 'd') { + if (event.kbd.keycode == Common::KEYCODE_d) { if (_debugger) _debugger->attach(); - } else if (event.kbd.keycode == 'q') { + } else if (event.kbd.keycode == Common::KEYCODE_q) { quitGame(); } } else { @@ -379,12 +379,12 @@ void KyraEngine_v1::updateInput() { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: - if (event.kbd.keycode == '.' || event.kbd.keycode == Common::KEYCODE_ESCAPE || + if (event.kbd.keycode == Common::KEYCODE_PERIOD || event.kbd.keycode == Common::KEYCODE_ESCAPE || event.kbd.keycode == Common::KEYCODE_SPACE || event.kbd.keycode == Common::KEYCODE_RETURN || event.kbd.keycode == Common::KEYCODE_UP || event.kbd.keycode == Common::KEYCODE_RIGHT || event.kbd.keycode == Common::KEYCODE_DOWN || event.kbd.keycode == Common::KEYCODE_LEFT) _eventList.push_back(Event(event, true)); - else if (event.kbd.keycode == 'q' && event.kbd.flags == Common::KBD_CTRL) + else if (event.kbd.keycode == Common::KEYCODE_q && event.kbd.flags == Common::KBD_CTRL) quitGame(); else _eventList.push_back(event);