From d5c92f748bd64fa385169dec505e6bb766cd81ee Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 7 Sep 2002 21:12:22 +0000 Subject: [PATCH] Add RAGE_ASSERT. This is closely related to RageException; perhaps RageException should be RageErrorHandler or something like that. --- stepmania/src/RageException.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/stepmania/src/RageException.h b/stepmania/src/RageException.h index 91f10e4ab9..76e2ffe537 100644 --- a/stepmania/src/RageException.h +++ b/stepmania/src/RageException.h @@ -1,4 +1,5 @@ -#pragma once +#ifndef RAGEEXCEPTION_H +#define RAGEEXCEPTION_H /* ----------------------------------------------------------------------------- Class: RageError @@ -24,3 +25,13 @@ protected: CString m_sError; }; +#include "crash.h" + +/* Assertion that sets an optional message and brings up the crash handler, so + * we get a backtrace. This should probably be used instead of throwing an + * exception in most cases we expect never to happen (but not in cases that + * we do expect, such as d3d init failure.) */ +#define RAGE_ASSERT_M(COND, MESSAGE) { if(!(COND)) { VDCHECKPOINT_M(MESSAGE); *(char*)0=0; } } +#define RAGE_ASSERT(COND) RAGE_ASSERT_M((COND), "Assertion failure") + +#endif