diff --git a/public/eiface.h b/public/eiface.h index 3e78e2b3..910270a5 100644 --- a/public/eiface.h +++ b/public/eiface.h @@ -26,6 +26,7 @@ #include "tier1/utlstring.h" #include "tier1/bufferstring.h" #include +#include "playerslot.h" //----------------------------------------------------------------------------- // forward declarations @@ -111,25 +112,6 @@ struct bbox_t Vector maxs; }; -struct CPlayerSlot -{ - CPlayerSlot( int slot ) - { - _slot = slot; - } - - int Get() const - { - return _slot; - } - - bool operator==( const CPlayerSlot &other ) const { return other._slot == _slot; } - bool operator!=( const CPlayerSlot &other ) const { return other._slot != _slot; } - -private: - int _slot; -}; - struct CEntityIndex { CEntityIndex( int index ) @@ -556,7 +538,7 @@ public: // Client is going active // If bLoadGame is true, don't spawn the player because its state is already setup. - virtual void ClientActive( CPlayerSlot slot, bool /*bLoadGame??*/, const char */*pszName??*/, int ) = 0; + virtual void ClientActive( CPlayerSlot slot, bool /*bLoadGame??*/, const char * /*pszName??*/, int ) = 0; virtual void ClientFullyConnect( CPlayerSlot slot ) = 0; diff --git a/public/filesystem.h b/public/filesystem.h index 7a131304..7174b672 100644 --- a/public/filesystem.h +++ b/public/filesystem.h @@ -770,7 +770,7 @@ public: virtual void GetSearchPathsForPathID( const char*, GetSearchPathTypes_t, CUtlVector & ) = 0; - virtual void MarkCorrupt( bool, const char* ) = 0; + virtual void MarkContentCorrupt( bool bMissingFilesOnly, const char* pFile ) = 0; }; //----------------------------------------------------------------------------- diff --git a/public/icvar.h b/public/icvar.h index c9aaed02..b7c88d3f 100644 --- a/public/icvar.h +++ b/public/icvar.h @@ -45,8 +45,8 @@ public: virtual void DispatchConCommand( ConCommandHandle cmd, const CCommandContext &ctx, const CCommand &args ) = 0; // Install a global change callback (to be called when any convar changes) - virtual void InstallGlobalChangeCallback( FnChangeCallback_t callback ) = 0; - virtual void RemoveGlobalChangeCallback( FnChangeCallback_t callback ) = 0; + virtual void InstallGlobalChangeCallback( FnChangeCallbackGlobal_t callback ) = 0; + virtual void RemoveGlobalChangeCallback( FnChangeCallbackGlobal_t callback ) = 0; virtual void CallGlobalChangeCallbacks( ConVarRefAbstract *var, CSplitScreenSlot nSlot, const char *pOldString, float flOldValue ) = 0; // Reverts cvars which contain a specific flag @@ -79,7 +79,7 @@ public: // Register, unregister commands virtual ConCommandHandle RegisterConCommand( ConCommand *pCmd, int64 nAdditionalFlags = 0 ) = 0; virtual void UnregisterConCommand( ConCommandHandle handle ) = 0; - virtual ConCommand* GetCommand( ConCommandHandle handle ) = 0; + virtual ConCommand* GetCommand( ConCommandHandle handle ) = 0; virtual void QueueThreadSetValue( ConVarRefAbstract *ref, CSplitScreenSlot nSlot, CVValue_t *value ) = 0; }; diff --git a/public/inetchannel.h b/public/inetchannel.h index a5ec0817..47460367 100644 --- a/public/inetchannel.h +++ b/public/inetchannel.h @@ -14,6 +14,7 @@ #include "inetchannelinfo.h" #include "tier1/bitbuf.h" #include "tier1/netadr.h" +#include "tier1/utldelegate.h" #include class IDemoRecorderBase; diff --git a/public/playerslot.h b/public/playerslot.h new file mode 100644 index 00000000..da9bc53c --- /dev/null +++ b/public/playerslot.h @@ -0,0 +1,31 @@ +#ifndef PLAYERSLOT_H +#define PLAYERSLOT_H + +#if _WIN32 +#pragma once +#endif + +class CPlayerSlot +{ +public: + CPlayerSlot(int slot) : m_Data(slot) + { + } + + int Get() const + { + return m_Data; + } + + bool operator==(const CPlayerSlot &other) const { + return other.m_Data == m_Data; + } + bool operator!=(const CPlayerSlot &other) const { + return other.m_Data != m_Data; + } + +private: + int m_Data; +}; + +#endif // PLAYERSLOT_H \ No newline at end of file diff --git a/public/tier0/basetypes.h b/public/tier0/basetypes.h index 9890125f..a295d5c1 100644 --- a/public/tier0/basetypes.h +++ b/public/tier0/basetypes.h @@ -599,7 +599,7 @@ protected: inline Type operator++( Type &a, int ) { Type t = a; ++a; return t; } \ inline Type operator--( Type &a, int ) { Type t = a; --a; return t; } -#define MAX_SPLITSCREEN_CLIENT_BITS 2 +#define MAX_SPLITSCREEN_CLIENT_BITS 0 // this should == MAX_JOYSTICKS in InputEnums.h #define MAX_SPLITSCREEN_CLIENTS ( 1 << MAX_SPLITSCREEN_CLIENT_BITS ) // 4 diff --git a/public/tier1/bufferstring.h b/public/tier1/bufferstring.h index cdff1963..2c983f68 100644 --- a/public/tier1/bufferstring.h +++ b/public/tier1/bufferstring.h @@ -67,11 +67,11 @@ public: public: DLL_CLASS_IMPORT const char *AppendConcat(int, const char * const *, const int *, bool bIgnoreAlignment = false); DLL_CLASS_IMPORT const char *AppendConcat(const char *, const char *, ...); - DLL_CLASS_IMPORT const char *AppendConcatV(const char *, const char *, char *, bool bIgnoreAlignment = false); + DLL_CLASS_IMPORT const char *AppendConcatV(const char *, const char *, va_list, bool bIgnoreAlignment = false); DLL_CLASS_IMPORT const char *Concat(const char *, const char *, ...); DLL_CLASS_IMPORT int AppendFormat(const char *pFormat, ...); - DLL_CLASS_IMPORT int AppendFormatV(const char *pFormat, char *pData); + DLL_CLASS_IMPORT int AppendFormatV(const char *pFormat, va_list pData); DLL_CLASS_IMPORT const char *AppendRepeat(char cChar, int nChars, bool bIgnoreAlignment = false); @@ -188,6 +188,13 @@ public: DLL_CLASS_IMPORT const char *TruncateAt(const char *pStr, bool bIgnoreAlignment = false); DLL_CLASS_IMPORT int UnicodeCaseConvert(int, EStringConvertErrorPolicy eErrorPolicy); + + // Casts to CBufferStringGrowable. Very dirty solution until someone figures out the sane one. + template> + T *ToGrowable() + { + return (T *)this; + } }; template diff --git a/public/tier1/convar.h b/public/tier1/convar.h index 67cc97b4..716bc30f 100644 --- a/public/tier1/convar.h +++ b/public/tier1/convar.h @@ -21,6 +21,7 @@ #include "tier1/utlstring.h" #include "Color.h" #include "mathlib/vector4d.h" +#include "playerslot.h" #ifdef _WIN32 #define FORCEINLINE_CVAR FORCEINLINE @@ -66,18 +67,25 @@ private: class CCommandContext { - CCommandContext(int nTarget) +public: + CCommandContext(CommandTarget_t nTarget, CPlayerSlot nSlot) : + m_nTarget(nTarget), m_nPlayerSlot(nSlot) { - m_nTarget = nTarget; } - int Get() const + CommandTarget_t GetTarget() const { return m_nTarget; } + CPlayerSlot GetPlayerSlot() const + { + return m_nPlayerSlot; + } + private: - int m_nTarget; + CommandTarget_t m_nTarget; + CPlayerSlot m_nPlayerSlot; }; class ALIGN8 ConCommandHandle @@ -169,6 +177,7 @@ struct CSplitScreenSlot enum EConVarType : short { + EConVarType_Invalid = -1, EConVarType_Bool, EConVarType_Int16, EConVarType_UInt16, @@ -353,7 +362,7 @@ inline const char **CCommand::ArgV() const inline const char *CCommand::ArgS() const { - return m_nArgv0Size ? *(const char **)(m_ArgSBuffer.Base() + m_nArgv0Size) : ""; + return m_nArgv0Size ? (m_ArgSBuffer.Base() + m_nArgv0Size) : ""; } inline const char *CCommand::GetCommandString() const diff --git a/public/tier1/utlmap.h b/public/tier1/utlmap.h index 6f933c81..13cb3ad5 100644 --- a/public/tier1/utlmap.h +++ b/public/tier1/utlmap.h @@ -30,7 +30,7 @@ #define FOR_EACH_MAP_FAST( mapName, iteratorName ) \ for ( int iteratorName = 0; iteratorName < mapName.MaxElement(); ++iteratorName ) if ( !mapName.IsValidIndex( iteratorName ) ) continue; else -template +template class CUtlMap { public: @@ -40,7 +40,7 @@ public: // Less func typedef // Returns true if the first parameter is "less" than the second - typedef bool (*LessFunc_t)( const KeyType_t &, const KeyType_t & ); + typedef LF LessFunc_t; // constructor, destructor // Left at growSize = 0, the memory will first allocate 1 element and double in size