* Fix wrong pointer dereference in InputTask.
authorMatthijs Kooijman <m.kooijman@student.utwente.nl>
Tue, 12 Jun 2007 06:14:53 +0000 (08:14 +0200)
committerMatthijs Kooijman <m.kooijman@student.utwente.nl>
Tue, 12 Jun 2007 06:14:53 +0000 (08:14 +0200)
 * Interpret the key status right.

ABM2/Engine/InputTask.cpp
ABM2/Engine/InputTask.h

index 54e71cbca99d73ae76a637ffcfa38ac3ef57d8c8..97f04f8747690f2f8028c47d01b7152dce16d657 100755 (executable)
@@ -51,7 +51,7 @@ void CInputTask::Update()
        SDL_PumpEvents();\r
        oldButtons=buttons;\r
        buttons=SDL_GetRelativeMouseState(&dX,&dY);\r
-       memcpy((unsigned char*)(*oldKeys),keys,sizeof(unsigned char)*keyCount);\r
+       memcpy(oldKeys,keys,sizeof(unsigned char)*keyCount);\r
        keys=SDL_GetKeyState(&keyCount);\r
 }\r
 \r
index 897e6608880c47c117a8c6ec3add2a8dd20deb22..6f8cb43f1e36cc670e08ccde68f1308c20a2da28 100755 (executable)
@@ -10,6 +10,7 @@
 #endif // _MSC_VER > 1000\r
 \r
 #include "engine.h"\r
+#include "Amaltheia/Input.h"\r
 #ifdef WIN32\r
 #define DIRECTINPUT_VERSION 0x0800\r
 #include <dinput.h>\r
@@ -33,8 +34,8 @@ public:
        static unsigned int buttons;\r
        static unsigned int oldButtons;\r
 \r
-       static bool inline curKey(int index) { return (keys[index] & 0x80) != 0; }\r
-       static bool inline oldKey(int index) { return (oldKeys[index] & 0x80) != 0; }\r
+       static bool inline curKey(int index) { return (keys[index]) != 0; }\r
+       static bool inline oldKey(int index) { return (oldKeys[index]) != 0; }\r
 \r
        //some helper functions to make certain things easier\r
        //static bool inline keyDown(int index)         { return ( curKey(index))&&(!oldKey(index)); }\r