From 32adea5719fbfd07390c7a459ee4a60c48f84835 Mon Sep 17 00:00:00 2001 From: ge49jic Date: Sat, 29 Dec 2018 10:53:53 +0100 Subject: cObjectHandler:clickEvent now checks coordinates and sets activeObject --- cObjectHandler.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cObjectHandler.cpp') diff --git a/cObjectHandler.cpp b/cObjectHandler.cpp index edd021c..68abace 100644 --- a/cObjectHandler.cpp +++ b/cObjectHandler.cpp @@ -73,6 +73,13 @@ int cObjectHandler::write() int cObjectHandler::clickEvent(sPos _pos, unsigned int _button) { + if(_pos.x >= iHitMap.size()) + return 1; + if(_pos.y >= iHitMap[_pos.x].size()) + return 1; + + iActiveObject = iHitMap[_pos.x][_pos.y]; //Set active object + if(objects[ iHitMap[_pos.x][_pos.y] ]) objects[ iHitMap[_pos.x][_pos.y] ]->onClick(_pos, _button); else -- cgit v1.2.3