SmaugWizard/Backup/
SmaugWizard/Backup/L/
SmaugWizard/Boards/
SmaugWizard/Building/
SmaugWizard/Corpses/
SmaugWizard/Councils/
SmaugWizard/Deity/
SmaugWizard/Gods/
SmaugWizard/MudProgs/
SmaugWizard/Player/L/
SmaugWizard/Src/
SmaugWizard/Src/res/
/****************************************************************************
 * [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame      |				*
 * -----------------------------------------------------------|   \\._.//	*
 * SmaugWizard (C) 1998 by Russ Pillsbury (Windows NT version)|   (0...0)	*
 * -----------------------------------------------------------|    ).:.(	*
 * SMAUG (C) 1994, 1995, 1996 by Derek Snider                 |    {o o}	*
 * -----------------------------------------------------------|   / ' ' \	*
 * SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus,      |~'~.VxvxV.~'~*
 * Scryn, Swordbearer, Rennard, Tricops, and Gorog.           |				*
 * ------------------------------------------------------------------------ *
 * Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael        *
 * Chastain, Michael Quan, and Mitchell Tse.                                *
 * Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,          *
 * Michael Seifert, Hans Henrik Staerfeldt, Tom Madsen, and Katja Nyboe.    *
 ****************************************************************************/
// Smaugx.cpp - SmaugWiz Exception handler class

#include	"stdafx.h"
#include	"smaug.h"
#include	"Smaugx.h"

#pragma hdrstop

#ifdef AFX_AUX_SEG
#pragma code_seg(AFX_AUX_SEG)
#endif

#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

#ifdef _DEBUG

// character strings to use for dumping CPayException
static char BASED_CODE szNone[] = "none";
static char BASED_CODE szGeneric[] = "generic";

static char FAR* BASED_CODE rgszCSmaugExceptionCause[] =
{
    szNone,
    szGeneric,
};

#endif


IMPLEMENT_DYNAMIC (CSmaugException, CException)


#ifdef _DEBUG
void CSmaugException::Dump (CDumpContext& dc) const
{
    CObject::Dump (dc);
    dc << " m_cause = ";

    if (m_cause > none &&
        m_cause < sizeof(rgszCSmaugExceptionCause)
			/ sizeof(char FAR*)) then
			   dc << rgszCSmaugExceptionCause [m_cause];
    else dc << "Unknown -" << m_cause;
    if (m_cause) then getchar ();
}
#endif


void PASCAL ThrowSmaugException (int cause)
{
#ifdef _DEBUG
    TRACE ("CSmaug exception: ");
    if (cause > 0 &&
	cause < sizeof (rgszCSmaugExceptionCause) / sizeof (char FAR*)) then
	    afxDump << (char FAR*)rgszCSmaugExceptionCause [cause];
    else afxDump << "Unknown (" << cause << ")";
    if (cause) then getchar ();
#endif
    THROW (new CSmaugException (cause));
}


void CSwException::Printf (char *fmt, ...)
{
	va_list	args;

	va_start (args, fmt);
	vsprintf (m_buf, fmt, args);
	va_end (args);
}