aboutsummaryrefslogtreecommitdiff
path: root/cObjectHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cObjectHandler.cpp')
-rw-r--r--cObjectHandler.cpp7
1 files changed, 7 insertions, 0 deletions
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