hl2sdk/tier1/rangecheckedvar.cpp
Scott Ehlert 0912401df2 Added reverse-engineered interfaces lib code and hacked up tier1 and mathlib to build against the newer headers.
--HG--
extra : rebase_source : 8a0863b93ca0391f0aa7270767bd3adcfa3a09fc
2012-05-21 02:49:35 -05:00

43 lines
770 B
C++

//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================//
#include "mathlib/mathlib.h"
#include "rangecheckedvar.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
bool g_bDoRangeChecks = true;
static int g_nDisables = 0;
CDisableRangeChecks::CDisableRangeChecks()
{
if ( !ThreadInMainThread() )
return;
g_nDisables++;
g_bDoRangeChecks = false;
}
CDisableRangeChecks::~CDisableRangeChecks()
{
if ( !ThreadInMainThread() )
return;
Assert( g_nDisables > 0 );
--g_nDisables;
if ( g_nDisables == 0 )
{
g_bDoRangeChecks = true;
}
}