aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/server/test_stressentities.h
diff options
context:
space:
mode:
authorJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
committerJoe Ludwig <[email protected]>2013-06-26 15:22:04 -0700
commit39ed87570bdb2f86969d4be821c94b722dc71179 (patch)
treeabc53757f75f40c80278e87650ea92808274aa59 /sp/src/game/server/test_stressentities.h
downloadsource-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz
source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/game/server/test_stressentities.h')
-rw-r--r--sp/src/game/server/test_stressentities.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/sp/src/game/server/test_stressentities.h b/sp/src/game/server/test_stressentities.h
new file mode 100644
index 00000000..3d8511c1
--- /dev/null
+++ b/sp/src/game/server/test_stressentities.h
@@ -0,0 +1,56 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef TEST_STRESSENTITIES_H
+#define TEST_STRESSENTITIES_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+
+class CBaseEntity;
+
+
+typedef CBaseEntity* (*StressEntityFn)(); // Function to create an entity for the stress test.
+
+
+// Each game DLL can instantiate these to register types of entities it can create
+// for the entity stress test.
+class CStressEntityReg
+{
+public:
+
+ CStressEntityReg( StressEntityFn fn )
+ {
+ m_pFn = fn;
+ m_pNext = s_pHead;
+ s_pHead = this;
+ }
+
+ static CStressEntityReg*GetListHead() { return s_pHead; }
+ CStressEntityReg* GetNext() { return m_pNext; }
+ StressEntityFn GetFn() { return m_pFn; }
+
+
+private:
+ static CStressEntityReg *s_pHead; // List of all CStressEntityReg's.
+ CStressEntityReg *m_pNext;
+ StressEntityFn m_pFn;
+};
+
+
+// Use this macro to register a function to create stresstest entities.
+#define REGISTER_STRESS_ENTITY( fnName ) static CStressEntityReg s_##fnName##__( fnName );
+
+
+// Helper function for the functions that create the stress entities.
+// Moves the entity to a random place in the level and returns the entity.
+CBaseEntity* MoveToRandomSpot( CBaseEntity *pEnt );
+Vector GetRandomSpot();
+
+
+#endif // TEST_STRESSENTITIES_H