[Scummvm-cvs-logs] SF.net SVN: scummvm:[48078] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Feb 17 17:08:47 CET 2010


Revision: 48078
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48078&view=rev
Author:   lordhoto
Date:     2010-02-17 16:08:47 +0000 (Wed, 17 Feb 2010)

Log Message:
-----------
Use Common::KeyCode instead of int as key type for KeyMap.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui_lol.cpp
    scummvm/trunk/engines/kyra/kyra_v1.h

Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp	2010-02-17 16:07:32 UTC (rev 48077)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp	2010-02-17 16:08:47 UTC (rev 48078)
@@ -843,9 +843,9 @@
 	} else {
 		evt.type = Common::EVENT_KEYDOWN;
 
-		for (Common::HashMap<int, int16>::const_iterator c = _keyMap.begin(); c != _keyMap.end(); ++c) {
+		for (KeyMap::const_iterator c = _keyMap.begin(); c != _keyMap.end(); ++c) {
 			if (c->_value == eventType)
-				evt.kbd.keycode = (Common::KeyCode) c->_key;
+				evt.kbd.keycode = (Common::KeyCode)c->_key;
 		}
 	}
 

Modified: scummvm/trunk/engines/kyra/kyra_v1.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v1.h	2010-02-17 16:07:32 UTC (rev 48077)
+++ scummvm/trunk/engines/kyra/kyra_v1.h	2010-02-17 16:08:47 UTC (rev 48078)
@@ -119,6 +119,10 @@
 	byte gameID;
 };
 
+struct KeyCodeHash : public Common::UnaryFunction<Common::KeyCode, uint> {
+	uint operator()(Common::KeyCode val) const { return (uint)val; }
+};
+
 enum {
 	GI_KYRA1 = 0,
 	GI_KYRA2 = 1,
@@ -277,7 +281,7 @@
 		operator Common::Event() const { return event; }
 	};
 	Common::List<Event> _eventList;
-	typedef Common::HashMap<int, int16> KeyMap;
+	typedef Common::HashMap<Common::KeyCode, int16, KeyCodeHash> KeyMap;
 	KeyMap _keyMap;
 
 	// config specific


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list