/*********************************************************************

Name:		Raytracer
Author:		Kamil Szatkowski "Netrix" (C)
Website:	http://www.netrix.org.pl/
License:	GNU GPL

*********************************************************************/
/*********************************************************************

Name:		Raytracer
Author:		Kamil Szatkowski "Netrix" (C)

*********************************************************************/
#pragma once

#ifdef _DEBUG
	#include "nBase.hpp"
	#include <windows.h>
	#include <stdlib.h>

	namespace NIne
	{
		extern bool NAssertFunction(bool bResult, const char* szExpression, const char* szDescription, const char* szLine, const char* szFilename, const char* szFunction, bool* pbIgnoreAlways);
	}

	// Makrodefinicja
	#define NAssert(szExpression, szDescription) \
	{\
		static bool bIgnoreAlways = false;\
		if(!bIgnoreAlways) \
		{\
			if(NIne::NAssertFunction(szExpression, NMAKE_STRING_A(szExpression), szDescription, NMAKE_STRING_A(__LINE__), __FILE__, __FUNCTION__, &bIgnoreAlways))\
			{\
				if(::IsDebuggerPresent())\
				{\
					__debugbreak();\
				}\
				else\
				{\
					exit(1);\
				}\
			}\
		}\
	}

#else
	#ifdef _MSC_VER
		#define NAssert(szExpression, szDescription) (__assume(szExpression))
	#else
		#define NAssert(szExpression, szDescription)
	#endif
#endif