1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-19 20:16:10 +08:00

Fix ConVar and ConCommands

This commit is contained in:
Scott Ehlert
2015-07-09 08:58:19 -04:00
committed by Nicholas Hastings
parent cd9b331641
commit 4e0f6d3c60
4 changed files with 22 additions and 28 deletions

Binary file not shown.

View File

@ -140,13 +140,13 @@ public:
virtual bool IsCommand( void ) const;
// Check flag
virtual bool IsFlagSet( int flag ) const;
virtual bool IsFlagSet( int64 flag ) const;
// Set flag
virtual void AddFlags( int flags );
virtual void AddFlags( int64 flags );
// Clear flag
virtual void RemoveFlags( int flags );
virtual void RemoveFlags( int64 flags );
virtual int GetFlags() const;
virtual int64 GetFlags() const;
// Return name of cvar
virtual const char *GetName( void ) const;
@ -175,8 +175,6 @@ protected:
char *CopyString( const char *from );
private:
int m_Unknown;
// Next ConVar in chain
// Prior to register, it points to the next convar in the DLL.
// Once registered, though, m_pNext is reset to point to the next
@ -191,8 +189,7 @@ private:
const char *m_pszHelpString;
// ConVar flags
int m_nFlags;
int m_nFlags2;
int64 m_nFlags;
protected:
// ConVars add themselves to this list for the executable.
@ -377,7 +374,7 @@ public:
virtual ~ConVar( void );
virtual bool IsFlagSet( int flag ) const;
virtual bool IsFlagSet( int64 flag ) const;
virtual const char* GetHelpText( void ) const;
virtual bool IsRegistered( void ) const;
virtual const char *GetName( void ) const;
@ -385,8 +382,8 @@ public:
virtual const char *GetBaseName( void ) const;
virtual int GetSplitScreenPlayerSlot() const;
virtual void AddFlags( int flags );
virtual int GetFlags() const;
virtual void AddFlags( int64 flags );
virtual int64 GetFlags() const;
virtual bool IsCommand( void ) const;
// Install a change callback (there shouldn't already be one....)
@ -636,7 +633,7 @@ public:
void Init( const char *pName, bool bIgnoreMissing );
bool IsValid() const;
bool IsFlagSet( int nFlags ) const;
bool IsFlagSet( int64 nFlags ) const;
IConVar *GetLinkedConVar();
// Get/Set value
@ -670,7 +667,7 @@ private:
//-----------------------------------------------------------------------------
// Did we find an existing convar of that name?
//-----------------------------------------------------------------------------
FORCEINLINE_CVAR bool ConVarRef::IsFlagSet( int nFlags ) const
FORCEINLINE_CVAR bool ConVarRef::IsFlagSet( int64 nFlags ) const
{
return ( m_pConVar->IsFlagSet( nFlags ) != 0 );
}
@ -771,7 +768,7 @@ public:
void Init( const char *pName, bool bIgnoreMissing );
bool IsValid() const;
bool IsFlagSet( int nFlags ) const;
bool IsFlagSet( int64 nFlags ) const;
// Get/Set value
float GetFloat( int nSlot ) const;
@ -805,7 +802,7 @@ private:
//-----------------------------------------------------------------------------
// Did we find an existing convar of that name?
//-----------------------------------------------------------------------------
FORCEINLINE_CVAR bool SplitScreenConVarRef::IsFlagSet( int nFlags ) const
FORCEINLINE_CVAR bool SplitScreenConVarRef::IsFlagSet( int64 nFlags ) const
{
return ( m_Info[ 0 ].m_pConVar->IsFlagSet( nFlags ) != 0 );
}

View File

@ -112,11 +112,11 @@ public:
// Accessors.. not as efficient as using GetState()/GetInfo()
// if you call these methods multiple times on the same IConVar
virtual bool IsFlagSet( int nFlag ) const = 0;
virtual bool IsFlagSet( int64 nFlag ) const = 0;
virtual int GetSplitScreenPlayerSlot() const = 0;
virtual void AddFlags( int flags ) = 0;
virtual void AddFlags( int64 flags ) = 0;
};

View File

@ -104,10 +104,7 @@ ConCommandBase::ConCommandBase( void )
m_pszHelpString = NULL;
m_nFlags = 0;
m_nFlags2 = 0;
m_pNext = NULL;
m_Unknown = 0;
}
//-----------------------------------------------------------------------------
@ -227,7 +224,7 @@ const char *ConCommandBase::GetName( void ) const
// Input : flag -
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool ConCommandBase::IsFlagSet( int flag ) const
bool ConCommandBase::IsFlagSet( int64 flag ) const
{
return ( flag & m_nFlags ) ? true : false;
}
@ -236,7 +233,7 @@ bool ConCommandBase::IsFlagSet( int flag ) const
// Purpose:
// Input : flags -
//-----------------------------------------------------------------------------
void ConCommandBase::AddFlags( int flags )
void ConCommandBase::AddFlags( int64 flags )
{
m_nFlags |= flags;
@ -245,12 +242,12 @@ void ConCommandBase::AddFlags( int flags )
#endif
}
void ConCommandBase::RemoveFlags( int flags )
void ConCommandBase::RemoveFlags( int64 flags )
{
m_nFlags &= ~flags;
}
int ConCommandBase::GetFlags( void ) const
int64 ConCommandBase::GetFlags( void ) const
{
return m_nFlags;
}
@ -714,7 +711,7 @@ void ConVar::InstallChangeCallback( FnChangeCallback_t callback, bool bInvoke )
}
}
bool ConVar::IsFlagSet( int flag ) const
bool ConVar::IsFlagSet( int64 flag ) const
{
return ( flag & m_pParent->m_nFlags ) ? true : false;
}
@ -724,7 +721,7 @@ const char *ConVar::GetHelpText( void ) const
return m_pParent->m_pszHelpString;
}
void ConVar::AddFlags( int flags )
void ConVar::AddFlags( int64 flags )
{
m_pParent->m_nFlags |= flags;
@ -733,7 +730,7 @@ void ConVar::AddFlags( int flags )
#endif
}
int ConVar::GetFlags( void ) const
int64 ConVar::GetFlags( void ) const
{
return m_pParent->m_nFlags;
}