From: Matthijs Kooijman Date: Tue, 12 Jun 2007 06:14:53 +0000 (+0200) Subject: * Fix wrong pointer dereference in InputTask. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=9712243130639ad13f421415171df4e5fc1e4773;p=matthijs%2FABM2.git * Fix wrong pointer dereference in InputTask. * Interpret the key status right. --- diff --git a/ABM2/Engine/InputTask.cpp b/ABM2/Engine/InputTask.cpp index 54e71cb..97f04f8 100755 --- a/ABM2/Engine/InputTask.cpp +++ b/ABM2/Engine/InputTask.cpp @@ -51,7 +51,7 @@ void CInputTask::Update() SDL_PumpEvents(); oldButtons=buttons; buttons=SDL_GetRelativeMouseState(&dX,&dY); - memcpy((unsigned char*)(*oldKeys),keys,sizeof(unsigned char)*keyCount); + memcpy(oldKeys,keys,sizeof(unsigned char)*keyCount); keys=SDL_GetKeyState(&keyCount); } diff --git a/ABM2/Engine/InputTask.h b/ABM2/Engine/InputTask.h index 897e660..6f8cb43 100755 --- a/ABM2/Engine/InputTask.h +++ b/ABM2/Engine/InputTask.h @@ -10,6 +10,7 @@ #endif // _MSC_VER > 1000 #include "engine.h" +#include "Amaltheia/Input.h" #ifdef WIN32 #define DIRECTINPUT_VERSION 0x0800 #include @@ -33,8 +34,8 @@ public: static unsigned int buttons; static unsigned int oldButtons; - static bool inline curKey(int index) { return (keys[index] & 0x80) != 0; } - static bool inline oldKey(int index) { return (oldKeys[index] & 0x80) != 0; } + static bool inline curKey(int index) { return (keys[index]) != 0; } + static bool inline oldKey(int index) { return (oldKeys[index]) != 0; } //some helper functions to make certain things easier //static bool inline keyDown(int index) { return ( curKey(index))&&(!oldKey(index)); }