aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/shared/gamerules_register.cpp
diff options
context:
space:
mode:
authorJørgen P. Tjernø <[email protected]>2013-12-02 19:31:46 -0800
committerJørgen P. Tjernø <[email protected]>2013-12-02 19:46:31 -0800
commitf56bb35301836e56582a575a75864392a0177875 (patch)
treede61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/shared/gamerules_register.cpp
parentMark some more files as text. (diff)
downloadsource-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz
source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/shared/gamerules_register.cpp')
-rw-r--r--mp/src/game/shared/gamerules_register.cpp268
1 files changed, 134 insertions, 134 deletions
diff --git a/mp/src/game/shared/gamerules_register.cpp b/mp/src/game/shared/gamerules_register.cpp
index fd4cfa1c..8f83ec9f 100644
--- a/mp/src/game/shared/gamerules_register.cpp
+++ b/mp/src/game/shared/gamerules_register.cpp
@@ -1,134 +1,134 @@
-//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================//
-
-#include "cbase.h"
-#include "gamerules_register.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-// ------------------------------------------------------------------------------------------ //
-// CGameRulesRegister implementation.
-// ------------------------------------------------------------------------------------------ //
-
-CGameRulesRegister* CGameRulesRegister::s_pHead = NULL;
-
-
-CGameRulesRegister::CGameRulesRegister( const char *pClassName, CreateGameRulesFn fn )
-{
- m_pClassName = pClassName;
- m_pFn = fn;
-
- m_pNext = s_pHead; // Add us to the global list.
- s_pHead = this;
-}
-
-void CGameRulesRegister::CreateGameRules()
-{
- m_pFn();
-}
-
-CGameRulesRegister* CGameRulesRegister::FindByName( const char *pName )
-{
- for ( CGameRulesRegister *pCur=s_pHead; pCur; pCur=pCur->m_pNext )
- {
- if ( Q_stricmp( pName, pCur->m_pClassName ) == 0 )
- return pCur;
- }
- return NULL;
-}
-
-
-// ------------------------------------------------------------------------------------------ //
-// Functions to dispatch the messages to create the game rules object on the client.
-// ------------------------------------------------------------------------------------------ //
-#define GAMERULES_STRINGTABLE_NAME "GameRulesCreation"
-
-#ifdef CLIENT_DLL
- #include "networkstringtable_clientdll.h"
-
- INetworkStringTable *g_StringTableGameRules = NULL;
-
- void OnGameRulesCreationStringChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, void const *newData )
- {
- // The server has created a new CGameRules object.
- delete g_pGameRules;
- g_pGameRules = NULL;
-
- const char *pClassName = (const char*)newData;
- CGameRulesRegister *pReg = CGameRulesRegister::FindByName( pClassName );
- if ( !pReg )
- {
- Error( "OnGameRulesCreationStringChanged: missing gamerules class '%s' on the client", pClassName );
- }
-
- // Create the new game rules object.
- pReg->CreateGameRules();
-
- if ( !g_pGameRules )
- {
- Error( "OnGameRulesCreationStringChanged: game rules entity (%s) not created", pClassName );
- }
- }
-
- // On the client, we respond to string table changes on the server.
- void InstallStringTableCallback_GameRules()
- {
- if ( !g_StringTableGameRules )
- {
- g_StringTableGameRules = networkstringtable->FindTable( GAMERULES_STRINGTABLE_NAME );
- if ( g_StringTableGameRules )
- {
- g_StringTableGameRules->SetStringChangedCallback( NULL, OnGameRulesCreationStringChanged );
- }
- }
- }
-
-#else
- #include "networkstringtable_gamedll.h"
-
- INetworkStringTable *g_StringTableGameRules = NULL;
-
- void CreateNetworkStringTables_GameRules()
- {
- // Create the string tables
- g_StringTableGameRules = networkstringtable->CreateStringTable( GAMERULES_STRINGTABLE_NAME, 1 );
-
-#ifdef CSTRIKE_DLL
- void CreateBlackMarketString( void );
- CreateBlackMarketString();
-#endif
- }
-
- void CreateGameRulesObject( const char *pClassName )
- {
- // Delete the old game rules object.
- delete g_pGameRules;
- g_pGameRules = NULL;
-
- // Create a new game rules object.
- CGameRulesRegister *pReg = CGameRulesRegister::FindByName( pClassName );
- if ( !pReg )
- Error( "InitGameRules: missing gamerules class '%s' on the server", pClassName );
-
- pReg->CreateGameRules();
- if ( !g_pGameRules )
- {
- Error( "InitGameRules: game rules entity (%s) not created", pClassName );
- }
-
- // Make sure the client gets notification to make a new game rules object.
- Assert( g_StringTableGameRules );
- g_StringTableGameRules->AddString( true, "classname", strlen( pClassName ) + 1, pClassName );
-
- if ( g_pGameRules )
- {
- g_pGameRules->CreateCustomNetworkStringTables();
- }
- }
-
-#endif
-
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#include "cbase.h"
+#include "gamerules_register.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+// ------------------------------------------------------------------------------------------ //
+// CGameRulesRegister implementation.
+// ------------------------------------------------------------------------------------------ //
+
+CGameRulesRegister* CGameRulesRegister::s_pHead = NULL;
+
+
+CGameRulesRegister::CGameRulesRegister( const char *pClassName, CreateGameRulesFn fn )
+{
+ m_pClassName = pClassName;
+ m_pFn = fn;
+
+ m_pNext = s_pHead; // Add us to the global list.
+ s_pHead = this;
+}
+
+void CGameRulesRegister::CreateGameRules()
+{
+ m_pFn();
+}
+
+CGameRulesRegister* CGameRulesRegister::FindByName( const char *pName )
+{
+ for ( CGameRulesRegister *pCur=s_pHead; pCur; pCur=pCur->m_pNext )
+ {
+ if ( Q_stricmp( pName, pCur->m_pClassName ) == 0 )
+ return pCur;
+ }
+ return NULL;
+}
+
+
+// ------------------------------------------------------------------------------------------ //
+// Functions to dispatch the messages to create the game rules object on the client.
+// ------------------------------------------------------------------------------------------ //
+#define GAMERULES_STRINGTABLE_NAME "GameRulesCreation"
+
+#ifdef CLIENT_DLL
+ #include "networkstringtable_clientdll.h"
+
+ INetworkStringTable *g_StringTableGameRules = NULL;
+
+ void OnGameRulesCreationStringChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, void const *newData )
+ {
+ // The server has created a new CGameRules object.
+ delete g_pGameRules;
+ g_pGameRules = NULL;
+
+ const char *pClassName = (const char*)newData;
+ CGameRulesRegister *pReg = CGameRulesRegister::FindByName( pClassName );
+ if ( !pReg )
+ {
+ Error( "OnGameRulesCreationStringChanged: missing gamerules class '%s' on the client", pClassName );
+ }
+
+ // Create the new game rules object.
+ pReg->CreateGameRules();
+
+ if ( !g_pGameRules )
+ {
+ Error( "OnGameRulesCreationStringChanged: game rules entity (%s) not created", pClassName );
+ }
+ }
+
+ // On the client, we respond to string table changes on the server.
+ void InstallStringTableCallback_GameRules()
+ {
+ if ( !g_StringTableGameRules )
+ {
+ g_StringTableGameRules = networkstringtable->FindTable( GAMERULES_STRINGTABLE_NAME );
+ if ( g_StringTableGameRules )
+ {
+ g_StringTableGameRules->SetStringChangedCallback( NULL, OnGameRulesCreationStringChanged );
+ }
+ }
+ }
+
+#else
+ #include "networkstringtable_gamedll.h"
+
+ INetworkStringTable *g_StringTableGameRules = NULL;
+
+ void CreateNetworkStringTables_GameRules()
+ {
+ // Create the string tables
+ g_StringTableGameRules = networkstringtable->CreateStringTable( GAMERULES_STRINGTABLE_NAME, 1 );
+
+#ifdef CSTRIKE_DLL
+ void CreateBlackMarketString( void );
+ CreateBlackMarketString();
+#endif
+ }
+
+ void CreateGameRulesObject( const char *pClassName )
+ {
+ // Delete the old game rules object.
+ delete g_pGameRules;
+ g_pGameRules = NULL;
+
+ // Create a new game rules object.
+ CGameRulesRegister *pReg = CGameRulesRegister::FindByName( pClassName );
+ if ( !pReg )
+ Error( "InitGameRules: missing gamerules class '%s' on the server", pClassName );
+
+ pReg->CreateGameRules();
+ if ( !g_pGameRules )
+ {
+ Error( "InitGameRules: game rules entity (%s) not created", pClassName );
+ }
+
+ // Make sure the client gets notification to make a new game rules object.
+ Assert( g_StringTableGameRules );
+ g_StringTableGameRules->AddString( true, "classname", strlen( pClassName ) + 1, pClassName );
+
+ if ( g_pGameRules )
+ {
+ g_pGameRules->CreateCustomNetworkStringTables();
+ }
+ }
+
+#endif
+