summaryrefslogtreecommitdiff
path: root/game/client/tf2/c_hint_events.cpp
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/client/tf2/c_hint_events.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/tf2/c_hint_events.cpp')
-rw-r--r--game/client/tf2/c_hint_events.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/game/client/tf2/c_hint_events.cpp b/game/client/tf2/c_hint_events.cpp
new file mode 100644
index 0000000..71b29e4
--- /dev/null
+++ b/game/client/tf2/c_hint_events.cpp
@@ -0,0 +1,49 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "cbase.h"
+#include "c_hint_events.h"
+#include "c_tf_hints.h"
+#include "c_tf_hintmanager.h"
+#include <KeyValues.h>
+#include "c_baseobject.h"
+
+
+void GlobalHintEvent( C_HintEvent_Base *pEvent )
+{
+ // Call the static registered functions for each hint type.
+ for ( int i=0; i < GetNumHintDatas(); i++ )
+ {
+ CHintData *pData = GetHintData( i );
+ if ( pData && pData->m_pEventFn )
+ pData->m_pEventFn( pData, pEvent );
+ }
+}
+
+
+void HintEventFn_BuildObject( CHintData *pData, C_HintEvent_Base *pEvent )
+{
+ if ( pEvent->GetType() == HINTEVENT_OBJECT_BUILT_BY_LOCAL_PLAYER )
+ {
+ C_BaseObject *pObj = ((C_HintEvent_ObjectBuiltByLocalPlayer*)pEvent)->m_pObject;
+
+ if ( pObj->GetType() == pData->m_ObjectType )
+ {
+ // Ok, they just built the object that any hints of this type are referring to, so disable
+ // all further hints of this type.
+ KeyValues *pkvStats = GetHintDisplayStats();
+ if ( pkvStats )
+ {
+ KeyValues *pkvStatSection = pkvStats->FindKey( pData->name, true );
+ if ( pkvStatSection )
+ {
+ pkvStatSection->SetString( "times_shown", VarArgs( "%i", 100 ) );
+ }
+ }
+ }
+ }
+}
+