From e993e32410104f8f4655464137d878ca09ef8efc Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 31 Mar 2013 18:00:33 +0000 Subject: BlockArea: Added runtime check for coords in Debug mode git-svn-id: http://mc-server.googlecode.com/svn/trunk@1337 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/BlockArea.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/BlockArea.cpp b/source/BlockArea.cpp index b3ae4d916..ca2f6a5bb 100644 --- a/source/BlockArea.cpp +++ b/source/BlockArea.cpp @@ -1636,6 +1636,13 @@ bool cBlockArea::SetSize(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes) int cBlockArea::MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const { + ASSERT(a_RelX >= 0); + ASSERT(a_RelX < m_SizeX); + ASSERT(a_RelY >= 0); + ASSERT(a_RelY < m_SizeY); + ASSERT(a_RelZ >= 0); + ASSERT(a_RelZ < m_SizeZ); + return a_RelX + a_RelZ * m_SizeX + a_RelY * m_SizeX * m_SizeZ; } -- cgit v1.2.3