From 9712243130639ad13f421415171df4e5fc1e4773 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 12 Jun 2007 08:14:53 +0200 Subject: [PATCH] * Fix wrong pointer dereference in InputTask. * Interpret the key status right. --- ABM2/Engine/InputTask.cpp | 2 +- ABM2/Engine/InputTask.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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)); } -- 2.30.2