diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/server/sdk/sdk_logicalentity.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/server/sdk/sdk_logicalentity.cpp')
| -rw-r--r-- | mp/src/game/server/sdk/sdk_logicalentity.cpp | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/mp/src/game/server/sdk/sdk_logicalentity.cpp b/mp/src/game/server/sdk/sdk_logicalentity.cpp index 5cdd4a6e..4f55393c 100644 --- a/mp/src/game/server/sdk/sdk_logicalentity.cpp +++ b/mp/src/game/server/sdk/sdk_logicalentity.cpp @@ -1,66 +1,66 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose: Simple logical entity that counts up to a threshold value, then
-// fires an output when reached.
-//
-//=============================================================================//
-
-#include "cbase.h"
-
-class CMyLogicalEntity : public CLogicalEntity
-{
-public:
- DECLARE_CLASS( CMyLogicalEntity , CLogicalEntity );
- DECLARE_DATADESC();
-
- // Constructor
- CMyLogicalEntity ( void ) : m_nCounter( 0 ) {}
-
- // Input function
- void InputTick( inputdata_t &inputData );
-
-private:
-
- int m_nThreshold; // Count at which to fire our output
- int m_nCounter; // Internal counter
-
- COutputEvent m_OnThreshold; // Output even when the counter reaches the threshold
-};
-
-LINK_ENTITY_TO_CLASS( my_logical_entity, CMyLogicalEntity );
-
-// Start of our data description for the class
-BEGIN_DATADESC( CMyLogicalEntity )
-
- // For save/load
- DEFINE_FIELD( m_nCounter, FIELD_INTEGER ),
-
- // Links our member variable to our keyvalue from Hammer
- DEFINE_KEYFIELD( m_nThreshold, FIELD_INTEGER, "threshold" ),
-
- // Links our input name from Hammer to our input member function
- DEFINE_INPUTFUNC( FIELD_VOID, "Tick", InputTick ),
-
- // Links our output member to the output name used by Hammer
- DEFINE_OUTPUT( m_OnThreshold, "OnThreshold" ),
-
-END_DATADESC()
-
-//-----------------------------------------------------------------------------
-// Purpose: Handle a tick input from another entity
-//-----------------------------------------------------------------------------
-void CMyLogicalEntity ::InputTick( inputdata_t &inputData )
-{
- // Increment our counter
- m_nCounter++;
-
- // See if we've met or crossed our threshold value
- if ( m_nCounter >= m_nThreshold )
- {
- // Fire an output event
- m_OnThreshold.FireOutput( inputData.pActivator, this );
-
- // Reset our counter
- m_nCounter = 0;
- }
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Simple logical entity that counts up to a threshold value, then +// fires an output when reached. +// +//=============================================================================// + +#include "cbase.h" + +class CMyLogicalEntity : public CLogicalEntity +{ +public: + DECLARE_CLASS( CMyLogicalEntity , CLogicalEntity ); + DECLARE_DATADESC(); + + // Constructor + CMyLogicalEntity ( void ) : m_nCounter( 0 ) {} + + // Input function + void InputTick( inputdata_t &inputData ); + +private: + + int m_nThreshold; // Count at which to fire our output + int m_nCounter; // Internal counter + + COutputEvent m_OnThreshold; // Output even when the counter reaches the threshold +}; + +LINK_ENTITY_TO_CLASS( my_logical_entity, CMyLogicalEntity ); + +// Start of our data description for the class +BEGIN_DATADESC( CMyLogicalEntity ) + + // For save/load + DEFINE_FIELD( m_nCounter, FIELD_INTEGER ), + + // Links our member variable to our keyvalue from Hammer + DEFINE_KEYFIELD( m_nThreshold, FIELD_INTEGER, "threshold" ), + + // Links our input name from Hammer to our input member function + DEFINE_INPUTFUNC( FIELD_VOID, "Tick", InputTick ), + + // Links our output member to the output name used by Hammer + DEFINE_OUTPUT( m_OnThreshold, "OnThreshold" ), + +END_DATADESC() + +//----------------------------------------------------------------------------- +// Purpose: Handle a tick input from another entity +//----------------------------------------------------------------------------- +void CMyLogicalEntity ::InputTick( inputdata_t &inputData ) +{ + // Increment our counter + m_nCounter++; + + // See if we've met or crossed our threshold value + if ( m_nCounter >= m_nThreshold ) + { + // Fire an output event + m_OnThreshold.FireOutput( inputData.pActivator, this ); + + // Reset our counter + m_nCounter = 0; + } }
\ No newline at end of file |