summaryrefslogtreecommitdiff
path: root/game/shared/schemainitutils.h
blob: 7d914025952114da1c9df5bed12051bd2d328f68 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: schemainitutils: Helpful macros when initing stuff that you'll
//			want to record multiple errors from
//
//=============================================================================

#ifndef SCHEMAINITUTILS_H
#define SCHEMAINITUTILS_H
#ifdef _WIN32
#pragma once
#endif

// used for initialization functions. Adds an error message if we're recording
// them or returns false if we're not
#define SCHEMA_INIT_CHECK( expr, ... )							\
	if ( false == ( expr ) )											\
	{																	\
		CUtlString msg;													\
		msg.Format( __VA_ARGS__ );										\
		if ( NULL == ( pVecErrors ) )									\
		{																\
			AssertMsg( expr, "%s", msg.String() );						\
		}																\
		else															\
		{																\
			pVecErrors->AddToTail( msg );								\
		}																\
		return false;													\
	}																	

#define SCHEMA_INIT_SUCCESS( )											\
	( NULL == pVecErrors ) || ( 0 == pVecErrors->Count() )

#define SCHEMA_INIT_SUBSTEP( expr )										\
	if ( !( expr ) )	\
		return false;


#endif // SCHEMAINITUTILS_H