summaryrefslogtreecommitdiff
path: root/game/shared/schemainitutils.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/schemainitutils.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/shared/schemainitutils.h')
-rw-r--r--game/shared/schemainitutils.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/game/shared/schemainitutils.h b/game/shared/schemainitutils.h
new file mode 100644
index 0000000..7d91402
--- /dev/null
+++ b/game/shared/schemainitutils.h
@@ -0,0 +1,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 \ No newline at end of file