From 3d1894d1811ff0907eb9f2db29d09c8acaf6a735 Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:26 +0200 Subject: [PATCH 01/13] C++14 to C++20: enable /std:c++20 in the three projects The three projects are switched to /std:c++20 (LanguageStandard=stdcpp20) in every configuration. No conformance switch was relaxed: neither /Zc:twoPhase- nor /Zc:strictStrings- was added. --- src/game/client/swarm_sdk_client.vcxproj | 5 ++++- src/game/missionchooser/swarm_sdk_missionchooser.vcxproj | 5 ++++- src/game/server/swarm_sdk_server.vcxproj | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/game/client/swarm_sdk_client.vcxproj b/src/game/client/swarm_sdk_client.vcxproj index a770959e8..ac5ab5d3f 100644 --- a/src/game/client/swarm_sdk_client.vcxproj +++ b/src/game/client/swarm_sdk_client.vcxproj @@ -1,4 +1,4 @@ - + @@ -129,6 +129,7 @@ Prompt 26495;26812 false + stdcpp20 true @@ -240,6 +241,7 @@ exit /b 0 true true false + stdcpp20 NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) @@ -351,6 +353,7 @@ exit /b 0 true true false + stdcpp20 true diff --git a/src/game/missionchooser/swarm_sdk_missionchooser.vcxproj b/src/game/missionchooser/swarm_sdk_missionchooser.vcxproj index ff5fc5140..aa6f81375 100644 --- a/src/game/missionchooser/swarm_sdk_missionchooser.vcxproj +++ b/src/game/missionchooser/swarm_sdk_missionchooser.vcxproj @@ -1,4 +1,4 @@ - + @@ -124,6 +124,7 @@ Prompt 26495;26812 false + stdcpp20 true @@ -231,6 +232,7 @@ exit /b 0 true true false + stdcpp20 NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) @@ -338,6 +340,7 @@ exit /b 0 26495;26812 true false + stdcpp20 true true diff --git a/src/game/server/swarm_sdk_server.vcxproj b/src/game/server/swarm_sdk_server.vcxproj index 1afdd6902..bbfe704b0 100644 --- a/src/game/server/swarm_sdk_server.vcxproj +++ b/src/game/server/swarm_sdk_server.vcxproj @@ -1,4 +1,4 @@ - + @@ -125,6 +125,7 @@ Prompt 26495;26812 false + stdcpp20 true @@ -234,6 +235,7 @@ exit /b 0 true true false + stdcpp20 NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) @@ -341,6 +343,7 @@ exit /b 0 26495;26812 true false + stdcpp20 true true From 0006aa9bf3ae9b354077927a774ce2bda8f0086a Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:26 +0200 Subject: [PATCH 02/13] C++14 to C++20: fix C3861/C2065 (two-phase lookup) Dependent base members and file-scope declarations are found again: this-> where the base is dependent, explicit declarations and out-of-line definitions, and the missing includes (math.h for log10, tier1/KeyValues.h, fgdlib/WCKeyValues.h). The Debug configuration needed this-> as well, where Assert and #ifdef _DEBUG compile the call out in Release. --- src/fgdlib/wckeyvalues.cpp | 18 +++++----- .../layout_system/tilegen_expressions.h | 18 +++++----- src/public/UtlCachedFileData.h | 33 ++++++++++--------- src/public/bitvec.h | 4 +-- src/public/fgdlib/wckeyvalues.h | 8 ++--- src/public/networkvar.h | 2 +- src/public/tier1/UtlSortVector.h | 2 +- src/public/tier1/strtools.h | 1 + src/public/tier1/utllinkedlist.h | 2 +- src/public/tier1/utlobjectreference.h | 30 ++++++++--------- src/public/tier1/utlvector.h | 4 +-- src/public/vscript/ivscript.h | 7 ++-- .../runtime/response_types_internal.h | 4 ++- 13 files changed, 69 insertions(+), 64 deletions(-) diff --git a/src/fgdlib/wckeyvalues.cpp b/src/fgdlib/wckeyvalues.cpp index 0ee4ba836..46bc8f2e2 100644 --- a/src/fgdlib/wckeyvalues.cpp +++ b/src/fgdlib/wckeyvalues.cpp @@ -139,8 +139,8 @@ WCKeyValuesT::~WCKeyValuesT(void) template const char *WCKeyValuesT::GetValue(const char *pszKey, int *piIndex) const { - int i = FindByKeyName( pszKey ); - if ( i == GetInvalidIndex() ) + int i = this->FindByKeyName( pszKey ); + if ( i == this->GetInvalidIndex() ) { return NULL; } @@ -149,7 +149,7 @@ const char *WCKeyValuesT::GetValue(const char *pszKey, int *piIndex) const if(piIndex) piIndex[0] = i; - return m_KeyValues[i].szValue; + return this->m_KeyValues[i].szValue; } } @@ -233,8 +233,8 @@ void WCKeyValuesT::SetValue(const char *pszKey, const char *pszValue) StripEdgeWhiteSpace(szTmpKey); StripEdgeWhiteSpace(szTmpValue); - int i = FindByKeyName( szTmpKey ); - if ( i == GetInvalidIndex() ) + int i = this->FindByKeyName( szTmpKey ); + if ( i == this->GetInvalidIndex() ) { if ( pszValue ) { @@ -244,21 +244,21 @@ void WCKeyValuesT::SetValue(const char *pszKey, const char *pszValue) MDkeyvalue newkv; Q_strncpy( newkv.szKey, szTmpKey, sizeof( newkv.szKey ) ); Q_strncpy( newkv.szValue, szTmpValue, sizeof( newkv.szValue ) ); - InsertKeyValue( newkv ); + this->InsertKeyValue( newkv ); } } else { if (pszValue != NULL) { - V_strncpy(m_KeyValues[i].szValue, szTmpValue, sizeof(m_KeyValues[i].szValue)); + V_strncpy(this->m_KeyValues[i].szValue, szTmpValue, sizeof(this->m_KeyValues[i].szValue)); } // // If we are setting to a NULL value, delete the key. // else { - RemoveKeyAt( i ); + this->RemoveKeyAt( i ); } } } @@ -270,7 +270,7 @@ void WCKeyValuesT::SetValue(const char *pszKey, const char *pszValue) template void WCKeyValuesT::RemoveAll(void) { - m_KeyValues.RemoveAll(); + this->m_KeyValues.RemoveAll(); } diff --git a/src/game/missionchooser/layout_system/tilegen_expressions.h b/src/game/missionchooser/layout_system/tilegen_expressions.h index 71add7d7f..c38ca2740 100644 --- a/src/game/missionchooser/layout_system/tilegen_expressions.h +++ b/src/game/missionchooser/layout_system/tilegen_expressions.h @@ -78,8 +78,8 @@ class CTilegenExpression_Binary : public ITilegenExpression< TReturn > virtual bool LoadFromKeyValues( KeyValues *pKeyValues ) { bool bSuccess = true; - bSuccess &= CreateExpressionFromKeyValuesBlock( pKeyValues, "param0", GetTypeName(), &m_pExpression[0] ); - bSuccess &= CreateExpressionFromKeyValuesBlock( pKeyValues, "param1", GetTypeName(), &m_pExpression[1] ); + bSuccess &= CreateExpressionFromKeyValuesBlock( pKeyValues, "param0", this->GetTypeName(), &m_pExpression[0] ); + bSuccess &= CreateExpressionFromKeyValuesBlock( pKeyValues, "param1", this->GetTypeName(), &m_pExpression[1] ); return bSuccess; } @@ -244,7 +244,7 @@ class CTilegenExpression_Unary : public ITilegenExpression< TReturn > virtual bool LoadFromKeyValues( KeyValues *pKeyValues ) { - return CreateExpressionFromKeyValuesBlock( pKeyValues, "param", GetTypeName(), &m_pExpression ); + return CreateExpressionFromKeyValuesBlock( pKeyValues, "param", this->GetTypeName(), &m_pExpression ); } virtual TReturn Evaluate( CFreeVariableMap *pContext ) { return DirectEvaluate( pContext, m_pExpression->Evaluate( pContext ) ); } @@ -651,7 +651,7 @@ class CTilegenExpression_Variable : public ITilegenExpression< TValue > virtual bool LoadFromKeyValues( KeyValues *pKeyValues ) { - if ( !CreateExpressionFromKeyValuesBlock( pKeyValues, "variable", GetTypeName(), &m_pVariableNameExpression ) ) + if ( !CreateExpressionFromKeyValuesBlock( pKeyValues, "variable", this->GetTypeName(), &m_pVariableNameExpression ) ) { Log_Warning( LOG_TilegenLayoutSystem, "No variable specified for CTilegenExpression_Variable in key values.\n" ); return false; @@ -751,19 +751,19 @@ class CTilegenExpression_MapReduce : public ITilegenExpression< TMapOutput > if ( pRangeExpressionKV != NULL ) { - if ( !CreateExpressionFromKeyValuesBlock( pKeyValues, "range_expression", GetTypeName(), &m_pInputRangeExpression ) ) + if ( !CreateExpressionFromKeyValuesBlock( pKeyValues, "range_expression", this->GetTypeName(), &m_pInputRangeExpression ) ) return false; } else if ( pRangeKV != NULL) { - if ( !CreateRangeFromKeyValuesBlock( pKeyValues, "range", GetTypeName(), &m_pInputRange ) ) + if ( !CreateRangeFromKeyValuesBlock( pKeyValues, "range", this->GetTypeName(), &m_pInputRange ) ) return false; } } if ( m_pMapFunction == NULL ) { - if ( !CreateExpressionFromKeyValuesBlock< TMapOutput >( pKeyValues, "map", GetTypeName(), &m_pMapFunction ) ) + if ( !CreateExpressionFromKeyValuesBlock< TMapOutput >( pKeyValues, "map", this->GetTypeName(), &m_pMapFunction ) ) return false; } @@ -771,7 +771,7 @@ class CTilegenExpression_MapReduce : public ITilegenExpression< TMapOutput > { ITilegenExpression< TMapOutput > *pReduceFunction = NULL; // Create an empty instance of the binary function since we will never call Evaluate on it (just DirectEvaluate) - CreateExpressionFromKeyValuesBlock< TMapOutput >( pKeyValues, "reduce", GetTypeName(), &pReduceFunction, false, true ); + CreateExpressionFromKeyValuesBlock< TMapOutput >( pKeyValues, "reduce", this->GetTypeName(), &pReduceFunction, false, true ); m_pReduceFunction = static_cast< CTilegenExpression_Multi< TMapOutput > * >( pReduceFunction ); } @@ -855,7 +855,7 @@ class CTilegenExpression_CountRange : public CTilegenExpression_MapReduce< int, { public: CTilegenExpression_CountRange( ITilegenRange< TInput > *pRange = NULL ) : - CTilegenExpression_MapReduce( pRange, new CTilegenExpression_LiteralInt( 1 ), new CTilegenExpression_Add(), "$$unused" ) + CTilegenExpression_MapReduce< int, TInput >( pRange, new CTilegenExpression_LiteralInt( 1 ), new CTilegenExpression_Add(), "$$unused" ) { } }; diff --git a/src/public/UtlCachedFileData.h b/src/public/UtlCachedFileData.h index c8e48a2e9..e148e7cc8 100644 --- a/src/public/UtlCachedFileData.h +++ b/src/public/UtlCachedFileData.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -670,6 +670,22 @@ bool CUtlCachedFileData::Init() return true; } +class CSortedCacheFile +{ +public: + FileNameHandle_t handle; + int index; + + bool Less( const CSortedCacheFile &file0, const CSortedCacheFile &file1, void * ) + { + char name0[ 512 ]; + char name1[ 512 ]; + g_pFullFileSystem->String( file0.handle, name0, sizeof( name0 ) ); + g_pFullFileSystem->String( file1.handle, name1, sizeof( name1 ) ); + return Q_stricmp( name0, name1 ) < 0 ? true : false; + } +}; + template void CUtlCachedFileData::Save() { @@ -962,21 +978,6 @@ void CUtlCachedFileData::ForceRecheckDiskInfo() } } -class CSortedCacheFile -{ -public: - FileNameHandle_t handle; - int index; - - bool Less( const CSortedCacheFile &file0, const CSortedCacheFile &file1, void * ) - { - char name0[ 512 ]; - char name1[ 512 ]; - g_pFullFileSystem->String( file0.handle, name0, sizeof( name0 ) ); - g_pFullFileSystem->String( file1.handle, name1, sizeof( name1 ) ); - return Q_stricmp( name0, name1 ) < 0 ? true : false; - } -}; // Iterates all entries and causes rebuild on any existing items which are out of date template diff --git a/src/public/bitvec.h b/src/public/bitvec.h index 28748b9ad..743c9c2ae 100644 --- a/src/public/bitvec.h +++ b/src/public/bitvec.h @@ -744,7 +744,7 @@ inline void CBitVecT::Xor(const CBitVecT &xorStr, CBitVecT *out) const template inline void CBitVecT::Not(CBitVecT *out) const { - ValidateOperand( *out ); + this->ValidateOperand( *out ); uint32 * pDest = out->Base(); const uint32 *pOperand = this->Base(); @@ -852,7 +852,7 @@ inline void CBitVecT::Copy( const CBitVecT &other, int nBits this->Resize( nBits ); - ValidateOperand( other ); + this->ValidateOperand( other ); Assert( &other != this ); memcpy( this->Base(), other.Base(), this->GetNumDWords() * sizeof( uint32 ) ); diff --git a/src/public/fgdlib/wckeyvalues.h b/src/public/fgdlib/wckeyvalues.h index 63d117719..1ad6fde53 100644 --- a/src/public/fgdlib/wckeyvalues.h +++ b/src/public/fgdlib/wckeyvalues.h @@ -188,7 +188,7 @@ typedef WCKeyValuesT WCKeyValuesVector; template inline const char *WCKeyValuesT::GetKey(int nIndex) const { - return(m_KeyValues.Element(nIndex).szKey); + return(this->m_KeyValues.Element(nIndex).szKey); } @@ -200,7 +200,7 @@ inline const char *WCKeyValuesT::GetKey(int nIndex) const template inline MDkeyvalue &WCKeyValuesT::GetKeyValue(int nIndex) { - return(m_KeyValues.Element(nIndex)); + return(this->m_KeyValues.Element(nIndex)); } @@ -212,7 +212,7 @@ inline MDkeyvalue &WCKeyValuesT::GetKeyValue(int nIndex) template inline const MDkeyvalue& WCKeyValuesT::GetKeyValue(int nIndex) const { - return(m_KeyValues.Element(nIndex)); + return(this->m_KeyValues.Element(nIndex)); } @@ -223,7 +223,7 @@ inline const MDkeyvalue& WCKeyValuesT::GetKeyValue(int nIndex) const template inline const char *WCKeyValuesT::GetValue(int nIndex) const { - return(m_KeyValues.Element(nIndex).szValue); + return(this->m_KeyValues.Element(nIndex).szValue); } diff --git a/src/public/networkvar.h b/src/public/networkvar.h index dc10988ca..35d1dde2f 100644 --- a/src/public/networkvar.h +++ b/src/public/networkvar.h @@ -382,7 +382,7 @@ class CNetworkColor32Base : public CNetworkVarBase< Type, Changer > const Type& operator=( const Type &val ) { - return Set( val ); + return base::Set( val ); } const Type& operator=( const CNetworkColor32Base &val ) diff --git a/src/public/tier1/UtlSortVector.h b/src/public/tier1/UtlSortVector.h index 42c35958f..f00982538 100644 --- a/src/public/tier1/UtlSortVector.h +++ b/src/public/tier1/UtlSortVector.h @@ -177,7 +177,7 @@ void CUtlSortVector::QuickSort( LessFunc& less, int nLower, int nUp ctx.m_pLessContext = m_pLessContext; ctx.m_pLessFunc = &less; - qsort_s( Base(), Count(), sizeof(T), (QSortCompareFunc_t)&CUtlSortVector::CompareHelper, &ctx ); + qsort_s( this->Base(), this->Count(), sizeof(T), (QSortCompareFunc_t)&CUtlSortVector::CompareHelper, &ctx ); } #else typedef int (__cdecl *QSortCompareFunc_t)( const void *, const void *); diff --git a/src/public/tier1/strtools.h b/src/public/tier1/strtools.h index 45f61b985..98bdf4858 100644 --- a/src/public/tier1/strtools.h +++ b/src/public/tier1/strtools.h @@ -10,6 +10,7 @@ #define TIER1_STRTOOLS_H #include "tier0/basetypes.h" +#include #ifdef _WIN32 #pragma once diff --git a/src/public/tier1/utllinkedlist.h b/src/public/tier1/utllinkedlist.h index 4c28e8423..fdf1120d8 100644 --- a/src/public/tier1/utllinkedlist.h +++ b/src/public/tier1/utllinkedlist.h @@ -198,7 +198,7 @@ class CUtlFixedLinkedList : public CUtlLinkedList< T, intp, true, intp, CUtlFixe return false; #ifdef _DEBUG // it's safe to skip this here, since the only way to get indices after m_LastAlloc is to use MaxElementIndex - if ( Memory().IsIdxAfter( i, this->m_LastAlloc ) ) + if ( this->Memory().IsIdxAfter( i, this->m_LastAlloc ) ) { Assert( 0 ); return false; // don't read values that have been allocated, but not constructed diff --git a/src/public/tier1/utlobjectreference.h b/src/public/tier1/utlobjectreference.h index b69598819..19339f766 100644 --- a/src/public/tier1/utlobjectreference.h +++ b/src/public/tier1/utlobjectreference.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2006, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2006, Valve Corporation, All rights reserved. ======// // // $Revision: $ // $NoKeywords: $ @@ -200,9 +200,9 @@ class CUtlReferenceVector : public CUtlBlockVector< CUtlReference< T > > public: void RemoveAll() { - for ( int i = 0; i < Count(); i++ ) + for ( int i = 0; i < this->Count(); i++ ) { - Element( i ).KillRef(); + this->Element( i ).KillRef(); } CUtlBlockVector::RemoveAll(); @@ -210,16 +210,16 @@ class CUtlReferenceVector : public CUtlBlockVector< CUtlReference< T > > void FastRemove( int elem ) { - Assert( IsValidIndex(elem) ); + Assert( this->IsValidIndex(elem) ); - if (m_Size > 0) + if (this->m_Size > 0) { - if ( elem != m_Size -1 ) + if ( elem != this->m_Size -1 ) { - Element(elem).Set( Element(m_Size-1).GetObject() ); + this->Element(elem).Set( this->Element(this->m_Size-1).GetObject() ); } - Destruct( &Element(m_Size-1) ); - --m_Size; + Destruct( &this->Element(this->m_Size-1) ); + --this->m_Size; } } @@ -236,17 +236,17 @@ class CUtlReferenceVector : public CUtlBlockVector< CUtlReference< T > > void Remove( int elem ) { - Assert( IsValidIndex(elem) ); + Assert( this->IsValidIndex(elem) ); - if (m_Size > 0) + if (this->m_Size > 0) { - for ( int i = elem; i < ( m_Size - 1 ); i++ ) + for ( int i = elem; i < ( this->m_Size - 1 ); i++ ) { - Element( i ).Set( Element( i + 1 ).GetObject() ); + this->Element( i ).Set( this->Element( i + 1 ).GetObject() ); } - Destruct( &Element(m_Size-1) ); - --m_Size; + Destruct( &this->Element(this->m_Size-1) ); + --this->m_Size; } } diff --git a/src/public/tier1/utlvector.h b/src/public/tier1/utlvector.h index 18074851c..385ae5812 100644 --- a/src/public/tier1/utlvector.h +++ b/src/public/tier1/utlvector.h @@ -1,4 +1,4 @@ -//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======// +//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======// // // Purpose: // @@ -523,7 +523,7 @@ class CCopyableUtlVector : public CUtlVector< T, CUtlMemory > CCopyableUtlVector( T* pMemory, int numElements ) : BaseClass( pMemory, numElements ) {} CCopyableUtlVector( std::initializer_list init ) : BaseClass( init ) {} virtual ~CCopyableUtlVector() {} - CCopyableUtlVector( CCopyableUtlVector const& vec ) { CopyArray( vec.Base(), vec.Count() ); } + CCopyableUtlVector( CCopyableUtlVector const& vec ) { this->CopyArray( vec.Base(), vec.Count() ); } }; // TODO (Ilya): It seems like all the functions in CUtlVector are simple enough that they should be inlined. diff --git a/src/public/vscript/ivscript.h b/src/public/vscript/ivscript.h index b9de5aeec..39357580b 100644 --- a/src/public/vscript/ivscript.h +++ b/src/public/vscript/ivscript.h @@ -1,4 +1,4 @@ -//========== Copyright © 2008, Valve Corporation, All rights reserved. ======== +//========== Copyright © 2008, Valve Corporation, All rights reserved. ======== // // Purpose: VScript // @@ -431,7 +431,7 @@ struct ScriptVariant_t } } - bool AssignTo( char **pDest ) + bool AssignTo( const char **pDest ) { DevWarning( "No free conversion of string or vector script variant right now\n" ); // If want to support this, probably need to malloc string and require free on other side [3/24/2008 tom] @@ -996,9 +996,10 @@ class CScriptScopeT : public CDefScriptScopeBase bool FunctionExists( const char *pszFunction ) { + HSCRIPT hFunction = NULL; if ( GetVM() ) { - HSCRIPT hFunction = GetVM()->LookupFunction( pszFunction, m_hScope ); + hFunction = GetVM()->LookupFunction( pszFunction, m_hScope ); GetVM()->ReleaseFunction( hFunction ); } return ( hFunction != NULL ) ; diff --git a/src/responserules/runtime/response_types_internal.h b/src/responserules/runtime/response_types_internal.h index 2e46f3e01..8b0cab03b 100644 --- a/src/responserules/runtime/response_types_internal.h +++ b/src/responserules/runtime/response_types_internal.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Core types for the response rules -- criteria, responses, rules, and matchers. // @@ -343,6 +343,8 @@ namespace ResponseRules }; #pragma pack(pop) +extern const char *ResponseCopyString( const char *in ); + template class CResponseDict : public CUtlMap { From b9d1b06781062bcae6c350c965426472d0197e09 Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:26 +0200 Subject: [PATCH 03/13] C++14 to C++20: fix C2027 (incomplete types) KeyValues is a complete type where it is instantiated (Panel.h) and CSortedCacheFile is defined before its first use (UtlCachedFileData.h). --- src/public/tier1/utlsoacontainer.h | 15 +++++++++------ src/public/vgui_controls/Panel.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/public/tier1/utlsoacontainer.h b/src/public/tier1/utlsoacontainer.h index 7d3cd8954..782f12dfa 100644 --- a/src/public/tier1/utlsoacontainer.h +++ b/src/public/tier1/utlsoacontainer.h @@ -1,4 +1,4 @@ -//====== Copyright © 1996-2007, Valve Corporation, All rights reserved. =======// +//====== Copyright © 1996-2007, Valve Corporation, All rights reserved. =======// // // Purpose: // @@ -447,11 +447,7 @@ template class CSOAAttributeReferenceBinaryOp CSOAAttributeReference m_opA; CSOAAttributeReference m_opB; - CSOAAttributeReferenceBinaryOp( CSOAAttributeReference const &a, CSOAAttributeReference const & b ) - { - a.CopyTo( m_opA ); - b.CopyTo( m_opB ); - } + CSOAAttributeReferenceBinaryOp( CSOAAttributeReference const &a, CSOAAttributeReference const & b ); }; @@ -531,6 +527,13 @@ FORCEINLINE void CSOAAttributeReference::CopyTo( CSOAAttributeReference &other ) other.m_nAttributeID = m_nAttributeID; } +template +CSOAAttributeReferenceBinaryOp::CSOAAttributeReferenceBinaryOp( CSOAAttributeReference const &a, CSOAAttributeReference const &b ) +{ + a.CopyTo( m_opA ); + b.CopyTo( m_opB ); +} + FORCEINLINE CSOAAttributeReference CSOAContainer::operator[]( int nAttrIdx ) diff --git a/src/public/vgui_controls/Panel.h b/src/public/vgui_controls/Panel.h index e0c373d1d..dc19132af 100644 --- a/src/public/vgui_controls/Panel.h +++ b/src/public/vgui_controls/Panel.h @@ -26,6 +26,7 @@ #include "vgui_controls/PanelAnimationVar.h" #include "Color.h" #include "vstdlib/IKeyValuesSystem.h" +#include "tier1/KeyValues.h" #include "tier1/utlsymbol.h" #include "vgui_controls/BuildGroup.h" #include "dmxloader/dmxelement.h" From 4d1210f0b803a1b79961c8fbfeabc22c56e531d4 Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:27 +0200 Subject: [PATCH 04/13] C++14 to C++20: fix C2059/C2143 (concept is a C++20 keyword) concept became a keyword in C++20. Renamed 216 identifiers from concept to conceptName across the AI speech, passenger and response-rule code, leaving comments and string literals untouched. --- src/game/server/ai_behavior_lead.cpp | 8 +- src/game/server/ai_behavior_lead.h | 4 +- src/game/server/ai_behavior_passenger.cpp | 6 +- src/game/server/ai_behavior_passenger.h | 4 +- src/game/server/ai_expresserfollowup.cpp | 58 ++++++------ src/game/server/ai_playerally.cpp | 92 +++++++++---------- src/game/server/ai_playerally.h | 28 +++--- src/game/server/ai_speech.cpp | 78 ++++++++-------- src/game/server/ai_speech.h | 92 +++++++++---------- src/game/server/ai_speechqueue.cpp | 10 +- src/game/server/ai_speechqueue.h | 24 ++--- src/game/server/basemultiplayerplayer.cpp | 10 +- src/game/server/basemultiplayerplayer.h | 4 +- src/game/server/hl2/ai_behavior_actbusy.cpp | 8 +- src/game/server/hl2/npc_citizen17.h | 4 +- src/responserules/runtime/response_system.cpp | 4 +- 16 files changed, 217 insertions(+), 217 deletions(-) diff --git a/src/game/server/ai_behavior_lead.cpp b/src/game/server/ai_behavior_lead.cpp index c3813b44a..c67b0b974 100644 --- a/src/game/server/ai_behavior_lead.cpp +++ b/src/game/server/ai_behavior_lead.cpp @@ -991,7 +991,7 @@ void CAI_LeadBehavior::RunTask( const Task_t *pTask ) //------------------------------------- -bool CAI_LeadBehavior::Speak( AIConcept_t concept ) +bool CAI_LeadBehavior::Speak( AIConcept_t conceptName ) { CAI_Expresser *pExpresser = GetOuter()->GetExpresser(); if ( !pExpresser ) @@ -1002,7 +1002,7 @@ bool CAI_LeadBehavior::Speak( AIConcept_t concept ) return false; // If we haven't said the start speech, don't nag - bool bNag = ( FStrEq(concept,TLK_LEAD_COMINGBACK) || FStrEq(concept, TLK_LEAD_CATCHUP) || FStrEq(concept, TLK_LEAD_RETRIEVE) ); + bool bNag = ( FStrEq(conceptName,TLK_LEAD_COMINGBACK) || FStrEq(conceptName, TLK_LEAD_CATCHUP) || FStrEq(conceptName, TLK_LEAD_RETRIEVE) ); if ( !m_hasspokenstart && bNag ) return false; @@ -1013,7 +1013,7 @@ bool CAI_LeadBehavior::Speak( AIConcept_t concept ) // We ignore nag timers for this, because the response rules will control refire rates. CAI_PlayerAlly *pAlly = dynamic_cast(GetOuter()); if ( pAlly ) - return pAlly->SpeakIfAllowed( concept, GetConceptModifiers( concept ) ); + return pAlly->SpeakIfAllowed( conceptName, GetConceptModifiers( conceptName ) ); } // Don't spam Nags @@ -1026,7 +1026,7 @@ bool CAI_LeadBehavior::Speak( AIConcept_t concept ) } } - if ( pExpresser->Speak( concept, GetConceptModifiers( concept ) ) ) + if ( pExpresser->Speak( conceptName, GetConceptModifiers( conceptName ) ) ) { m_flSpeakNextNagTime = gpGlobals->curtime + LEAD_NAG_TIME; return true; diff --git a/src/game/server/ai_behavior_lead.h b/src/game/server/ai_behavior_lead.h index 7e7a49125..433704eba 100644 --- a/src/game/server/ai_behavior_lead.h +++ b/src/game/server/ai_behavior_lead.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -184,7 +184,7 @@ class CAI_LeadBehavior : public CAI_SimpleBehavior bool GetClosestPointOnRoute( const Vector &targetPos, Vector *pVecClosestPoint ); bool PlayerIsAheadOfMe( bool bForce = false ); - bool Speak( AIConcept_t concept ); + bool Speak( AIConcept_t conceptName ); bool IsSpeaking(); // -------------------------------- diff --git a/src/game/server/ai_behavior_passenger.cpp b/src/game/server/ai_behavior_passenger.cpp index f8f4d62d2..a785e2f3f 100644 --- a/src/game/server/ai_behavior_passenger.cpp +++ b/src/game/server/ai_behavior_passenger.cpp @@ -1,4 +1,4 @@ -//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= +//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= // // Purpose: Behavior for NPCs riding in cars (with boys) // @@ -1560,12 +1560,12 @@ void CAI_PassengerBehavior::SetTransitionSequence( int nSequence ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -bool CAI_PassengerBehavior::SpeakIfAllowed( AIConcept_t concept, const char *modifiers /*= NULL*/, bool bRespondingToPlayer /*= false*/, char *pszOutResponseChosen /*= NULL*/, size_t bufsize /*= 0*/ ) +bool CAI_PassengerBehavior::SpeakIfAllowed( AIConcept_t conceptName, const char *modifiers /*= NULL*/, bool bRespondingToPlayer /*= false*/, char *pszOutResponseChosen /*= NULL*/, size_t bufsize /*= 0*/ ) { // FIXME: Store this cast off? CAI_PlayerAlly *pAlly = dynamic_cast(GetOuter()); if ( pAlly != NULL ) - return pAlly->SpeakIfAllowed( concept, modifiers, bRespondingToPlayer, pszOutResponseChosen, bufsize ); + return pAlly->SpeakIfAllowed( conceptName, modifiers, bRespondingToPlayer, pszOutResponseChosen, bufsize ); return false; } diff --git a/src/game/server/ai_behavior_passenger.h b/src/game/server/ai_behavior_passenger.h index 2a83e0e8a..0eb709d19 100644 --- a/src/game/server/ai_behavior_passenger.h +++ b/src/game/server/ai_behavior_passenger.h @@ -1,4 +1,4 @@ -//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= +//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= // // Purpose: // @@ -149,7 +149,7 @@ class CAI_PassengerBehavior : public CAI_SimpleBehavior virtual int SelectTransitionSchedule( void ); - bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); + bool SpeakIfAllowed( AIConcept_t conceptName, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); bool CanExitVehicle( void ); void SetTransitionSequence( int nSequence ); diff --git a/src/game/server/ai_expresserfollowup.cpp b/src/game/server/ai_expresserfollowup.cpp index 3d98f4080..08d04941d 100644 --- a/src/game/server/ai_expresserfollowup.cpp +++ b/src/game/server/ai_expresserfollowup.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -102,9 +102,9 @@ static void DispatchComeback( CAI_ExpresserWithFollowup *pExpress, CBaseEntity * // Input : concept - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- -bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &conceptName, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { - AI_Response *result = SpeakFindResponse( concept, modifiers ); + AI_Response *result = SpeakFindResponse( conceptName, modifiers ); if ( !result ) { return false; @@ -151,14 +151,14 @@ static CBaseEntity *AscertainSpeechSubjectFromContext( AI_Response *response, AI } // TODO: Currently uses awful stricmp. Use symbols! Once I know which ones we want, that is. -static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &concept, AI_CriteriaSet &criteria, const char * RESTRICT szTarget, AI_Response * RESTRICT response = NULL ) +static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &conceptName, AI_CriteriaSet &criteria, const char * RESTRICT szTarget, AI_Response * RESTRICT response = NULL ) { if ( Q_stricmp(szTarget, "self") == 0 ) { - return CResponseQueue::CFollowupTargetSpec_t( kDRT_SPECIFIC, concept.GetSpeaker() ); + return CResponseQueue::CFollowupTargetSpec_t( kDRT_SPECIFIC, conceptName.GetSpeaker() ); } else if ( Q_stricmp(szTarget, "subject") == 0 ) { @@ -170,7 +170,7 @@ static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AICo } else if ( Q_stricmp(szTarget, "any") == 0 ) { - return CResponseQueue::CFollowupTargetSpec_t( kDRT_ANY, concept.GetSpeaker() ); + return CResponseQueue::CFollowupTargetSpec_t( kDRT_ANY, conceptName.GetSpeaker() ); } else if ( Q_stricmp(szTarget, "all") == 0 ) { @@ -189,20 +189,20 @@ static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AICo // TODO: Currently uses awful stricmp. Use symbols! Once I know which ones we want, that is. -static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &concept, AI_CriteriaSet &criteria, AI_Response * RESTRICT response, AI_ResponseFollowup * RESTRICT followup ) +static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AIConcept_t &conceptName, AI_CriteriaSet &criteria, AI_Response * RESTRICT response, AI_ResponseFollowup * RESTRICT followup ) { const char * RESTRICT szTarget = followup->followup_target; const CResponseQueue::CFollowupTargetSpec_t INVALID; // default: invalid result if ( szTarget == NULL ) return INVALID; else - return ResolveFollowupTargetToEntity( concept, criteria, szTarget, response ); + return ResolveFollowupTargetToEntity( conceptName, criteria, szTarget, response ); } ConVar chet_debug_idle( "chet_debug_idle", "0", FCVAR_NONE, "If set one, many debug prints to help track down the TLK_IDLE issue. Set two for super verbose info" ); // extern ConVar chet_debug_idle; -bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &conceptName, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { VPROF("CAI_Expresser::Speak"); if ( IsSpeechGloballySuppressed() ) @@ -210,12 +210,12 @@ bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifie return false; } - concept.SetSpeaker(GetOuter()); + conceptName.SetSpeaker(GetOuter()); AI_CriteriaSet criteria; - GatherCriteria(&criteria, concept, modifiers); + GatherCriteria(&criteria, conceptName, modifiers); GetOuter()->ModifyOrAppendDerivedCriteria(criteria); AI_Response result; - if ( !FindResponse( result, concept, &criteria ) ) + if ( !FindResponse( result, conceptName, &criteria ) ) { if (chet_debug_idle.GetBool()) { @@ -238,10 +238,10 @@ bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifie } } - SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)concept, gpGlobals->curtime ); + SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)conceptName, gpGlobals->curtime ); // Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), concept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" ); - bool spoke = SpeakDispatchResponse( concept, &result, &criteria, filter ); + bool spoke = SpeakDispatchResponse( conceptName, &result, &criteria, filter ); if ( pszOutResponseChosen ) { result.GetResponse( pszOutResponseChosen, bufsize ); @@ -273,16 +273,16 @@ static float GetSpeechDurationForResponse( const AI_Response * RESTRICT response // Purpose: Dispatches the result // Input : *response - //----------------------------------------------------------------------------- -bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter ) +bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &conceptName, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter ) { // This gives the chance for the other bot to respond. - if ( !concept.GetSpeaker().IsValid() ) + if ( !conceptName.GetSpeaker().IsValid() ) { - concept.SetSpeaker(GetOuter()); + conceptName.SetSpeaker(GetOuter()); } bool bInterrupted = IsSpeaking(); - bool bSuc = CAI_Expresser::SpeakDispatchResponse( concept, response, criteria, filter ); + bool bSuc = CAI_Expresser::SpeakDispatchResponse( conceptName, response, criteria, filter ); if (!bSuc) { return false; @@ -320,7 +320,7 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_ if ( fTimeToLastSpeech > 0 ) { DispatchFollowupThroughQueue( followup->followup_concept, followup->followup_contexts, - ResolveFollowupTargetToEntity( concept, *criteria, response, followup ), + ResolveFollowupTargetToEntity( conceptName, *criteria, response, followup ), fTimeToLastSpeech + followup->followup_delay, GetOuter() ); } else // error @@ -328,11 +328,11 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_ // old way, copied from "else" below m_pPostponedFollowup = followup; if ( criteria ) - m_followupTarget = ResolveFollowupTargetToEntity( concept, *criteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( conceptName, *criteria, response, m_pPostponedFollowup ); else { AI_CriteriaSet tmpCriteria; - m_followupTarget = ResolveFollowupTargetToEntity( concept, tmpCriteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( conceptName, tmpCriteria, response, m_pPostponedFollowup ); } } } @@ -346,14 +346,14 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_ // In this case we do not need to postpone the followup; we just throw it directly // into the queue. DispatchFollowupThroughQueue( followup->followup_concept, followup->followup_contexts, - ResolveFollowupTargetToEntity( concept, *criteria, response, followup ), + ResolveFollowupTargetToEntity( conceptName, *criteria, response, followup ), -followup->followup_delay, GetOuter() ); } else if ( response->GetType() == ResponseRules::RESPONSE_PRINT ) { // zero-duration responses dispatch immediately via the queue (must be the queue bec. // the m_pPostponedFollowup will never trigger) DispatchFollowupThroughQueue( followup->followup_concept, followup->followup_contexts, - ResolveFollowupTargetToEntity( concept, *criteria, response, followup ), + ResolveFollowupTargetToEntity( conceptName, *criteria, response, followup ), followup->followup_delay, GetOuter() ); } else @@ -363,11 +363,11 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_ // 5.13.08 egr m_pPostponedFollowup = followup; if ( criteria ) - m_followupTarget = ResolveFollowupTargetToEntity( concept, *criteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( conceptName, *criteria, response, m_pPostponedFollowup ); else { AI_CriteriaSet tmpCriteria; - m_followupTarget = ResolveFollowupTargetToEntity( concept, tmpCriteria, response, m_pPostponedFollowup ); + m_followupTarget = ResolveFollowupTargetToEntity( conceptName, tmpCriteria, response, m_pPostponedFollowup ); } } } @@ -381,7 +381,7 @@ bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_ // for "this many seconds after the beginning of the line" rather than "this may seconds after the end // of the line", eg to create a THEN rule when two characters talk over each other. // It's static to avoid accidental use of the postponed followup/target members. -void CAI_ExpresserWithFollowup::DispatchFollowupThroughQueue( const AIConcept_t &concept, +void CAI_ExpresserWithFollowup::DispatchFollowupThroughQueue( const AIConcept_t &conceptName, const char * RESTRICT criteriaStr, const CResponseQueue::CFollowupTargetSpec_t &target, float delay, @@ -394,7 +394,7 @@ void CAI_ExpresserWithFollowup::DispatchFollowupThroughQueue( const AIConcept_t criteria.AppendCriteria( "From", STRING( pOuter->GetEntityName() ) ); criteria.Merge( criteriaStr ); - g_ResponseQueueManager.GetQueue()->Add( concept, &criteria, gpGlobals->curtime + delay, target, pOuter ); + g_ResponseQueueManager.GetQueue()->Add( conceptName, &criteria, gpGlobals->curtime + delay, target, pOuter ); } //----------------------------------------------------------------------------- @@ -450,8 +450,8 @@ void CC_RR_ForceConcept_f( const CCommand &args ) criteria.Merge( criteriastring ); } - AIConcept_t concept( args[2] ); - QueueSpeak( concept, ResolveFollowupTargetToEntity( concept, criteria, args[1] ), criteria ); + AIConcept_t conceptName( args[2] ); + QueueSpeak( conceptName, ResolveFollowupTargetToEntity( conceptName, criteria, args[1] ), criteria ); } diff --git a/src/game/server/ai_playerally.cpp b/src/game/server/ai_playerally.cpp index 521a42800..ac12f98b0 100644 --- a/src/game/server/ai_playerally.cpp +++ b/src/game/server/ai_playerally.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -145,7 +145,7 @@ class CConceptInfoMap : public CUtlMap { { for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ ) { - Insert( g_ConceptInfos[i].concept, &g_ConceptInfos[i] ); + Insert( g_ConceptInfos[i].conceptName, &g_ConceptInfos[i] ); } } }; @@ -164,7 +164,7 @@ class CConceptInfoMap : public CUtlMap { for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ ) { - Insert( g_ConceptInfos[i].concept, &g_ConceptInfos[i] ); + Insert( g_ConceptInfos[i].conceptName, &g_ConceptInfos[i] ); } } }; @@ -189,7 +189,7 @@ void CAI_AllySpeechManager::Spawn() { Assert( g_ConceptInfoMap.Count() != 0 ); for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ ) - m_ConceptTimers.Insert( AllocPooledString( g_ConceptInfos[i].concept ), CSimpleSimTimer() ); + m_ConceptTimers.Insert( AllocPooledString( g_ConceptInfos[i].conceptName ), CSimpleSimTimer() ); } void CAI_AllySpeechManager::AddCustomConcept( const ConceptInfo_t &conceptInfo ) @@ -197,14 +197,14 @@ void CAI_AllySpeechManager::AddCustomConcept( const ConceptInfo_t &conceptInfo ) Assert( g_ConceptInfoMap.Count() != 0 ); Assert( m_ConceptTimers.Count() != 0 ); - if ( g_ConceptInfoMap.Find( conceptInfo.concept ) == g_ConceptInfoMap.InvalidIndex() ) + if ( g_ConceptInfoMap.Find( conceptInfo.conceptName ) == g_ConceptInfoMap.InvalidIndex() ) { - g_ConceptInfoMap.Insert( conceptInfo.concept, new ConceptInfo_t( conceptInfo ) ); + g_ConceptInfoMap.Insert( conceptInfo.conceptName, new ConceptInfo_t( conceptInfo ) ); } - if ( m_ConceptTimers.Find( AllocPooledString(conceptInfo.concept) ) == m_ConceptTimers.InvalidIndex() ) + if ( m_ConceptTimers.Find( AllocPooledString(conceptInfo.conceptName) ) == m_ConceptTimers.InvalidIndex() ) { - m_ConceptTimers.Insert( AllocPooledString( conceptInfo.concept ), CSimpleSimTimer() ); + m_ConceptTimers.Insert( AllocPooledString( conceptInfo.conceptName ), CSimpleSimTimer() ); } } @@ -213,16 +213,16 @@ ConceptCategoryInfo_t *CAI_AllySpeechManager::GetConceptCategoryInfo( ConceptCat return &g_ConceptCategoryInfos[category]; } -ConceptInfo_t *CAI_AllySpeechManager::GetConceptInfo( AIConcept_t concept ) +ConceptInfo_t *CAI_AllySpeechManager::GetConceptInfo( AIConcept_t conceptName ) { - int iResult = g_ConceptInfoMap.Find( concept ); + int iResult = g_ConceptInfoMap.Find( conceptName ); return ( iResult != g_ConceptInfoMap.InvalidIndex() ) ? g_ConceptInfoMap[iResult] : NULL; } -void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t concept, AI_Response *response ) +void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t conceptName, AI_Response *response ) { - ConceptInfo_t * pConceptInfo = GetConceptInfo( concept ); + ConceptInfo_t * pConceptInfo = GetConceptInfo( conceptName ); ConceptCategory_t category = ( pConceptInfo ) ? pConceptInfo->category : SPEECH_IDLE; ConceptCategoryInfo_t * pCategoryInfo = GetConceptCategoryInfo( category ); @@ -241,7 +241,7 @@ void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConce pPlayerAlly->FVisible( pTalker ) ) { // Tell this guy he's already said the concept to the player, too. - pTalker->GetExpresser()->SetSpokeConcept( concept, NULL, false ); + pTalker->GetExpresser()->SetSpokeConcept( conceptName, NULL, false ); } } } @@ -272,7 +272,7 @@ void CAI_AllySpeechManager::OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConce if ( pConceptInfo && pConceptInfo->minConceptDelay != -1 ) { Assert( pConceptInfo->maxConceptDelay != -1 ); - char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(concept) ); + char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(conceptName) ); if ( iConceptTimer != m_ConceptTimers.InvalidIndex() ) m_ConceptTimers[iConceptTimer].Set( pConceptInfo->minConceptDelay, pConceptInfo->minConceptDelay ); } @@ -292,9 +292,9 @@ bool CAI_AllySpeechManager::CategoryDelayExpired( ConceptCategory_t category ) return m_ConceptCategoryTimers[category].Expired(); } -bool CAI_AllySpeechManager::ConceptDelayExpired( AIConcept_t concept ) +bool CAI_AllySpeechManager::ConceptDelayExpired( AIConcept_t conceptName ) { - char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(concept) ); + char iConceptTimer = m_ConceptTimers.Find( MAKE_STRING(conceptName) ); if ( iConceptTimer != m_ConceptTimers.InvalidIndex() ) return m_ConceptTimers[iConceptTimer].Expired(); return true; @@ -575,7 +575,7 @@ void CAI_PlayerAlly::PrescheduleThink( void ) if ( SelectNonCombatSpeech( &selection ) ) { SetSpeechTarget( selection.hSpeechTarget ); - SpeakDispatchResponse( selection.concept.c_str(), &selection.response ); + SpeakDispatchResponse( selection.conceptName.c_str(), &selection.response ); m_flNextIdleSpeechTime = gpGlobals->curtime + RandomFloat( 20,30 ); } else @@ -613,16 +613,16 @@ int CAI_PlayerAlly::SelectSchedule( void ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ) +bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t conceptName, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ) { - if ( IsAllowedToSpeak( concept ) ) + if ( IsAllowedToSpeak( conceptName ) ) { AI_CriteriaSet criteria; - GatherCriteria(&criteria, concept, pszModifiers); + GatherCriteria(&criteria, conceptName, pszModifiers); - if ( FindResponse(pSelection->response, concept, &criteria) ) + if ( FindResponse(pSelection->response, conceptName, &criteria) ) { - pSelection->Set(concept, pTarget); + pSelection->Set(conceptName, pTarget); return true; } @@ -640,11 +640,11 @@ bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszM //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t concept, AI_Response *pResponse ) +void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t conceptName, AI_Response *pResponse ) { m_PendingResponse = *pResponse; // pResponse->Release(); - m_PendingConcept = concept; + m_PendingConcept = conceptName; m_TimePendingSet = gpGlobals->curtime; } @@ -725,7 +725,7 @@ bool CAI_PlayerAlly::SelectInterjection() if ( SelectIdleSpeech( &selection ) ) { SetSpeechTarget( selection.hSpeechTarget ); - SpeakDispatchResponse( selection.concept.c_str(), &selection.response, NULL ); + SpeakDispatchResponse( selection.conceptName.c_str(), &selection.response, NULL ); return true; } } @@ -770,14 +770,14 @@ bool CAI_PlayerAlly::SelectQuestionAndAnswerSpeech( AISpeechSelection_t *pSelect //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CAI_PlayerAlly::PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) +void CAI_PlayerAlly::PostSpeakDispatchResponse( AIConcept_t conceptName, AI_Response *response ) { #ifdef HL2_EPISODIC CAI_AllySpeechManager *pSpeechManager = GetAllySpeechManager(); - ConceptInfo_t *pConceptInfo = pSpeechManager->GetConceptInfo( concept ); + ConceptInfo_t *pConceptInfo = pSpeechManager->GetConceptInfo( conceptName ); if ( pConceptInfo && (pConceptInfo->flags & AICF_QUESTION) && GetSpeechTarget() ) { - bool bSaidHelloToNPC = !Q_strcmp(concept, "TLK_HELLO_NPC"); + bool bSaidHelloToNPC = !Q_strcmp(conceptName, "TLK_HELLO_NPC"); float duration = GetExpresser()->GetSemaphoreAvailableTime(this) - gpGlobals->curtime; @@ -785,11 +785,11 @@ void CAI_PlayerAlly::PostSpeakDispatchResponse( AIConcept_t concept, AI_Response { if ( bSaidHelloToNPC ) { - Warning("Q&A: '%s' said Hello to '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), concept.GetStringConcept() ); + Warning("Q&A: '%s' said Hello to '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), conceptName.GetStringConcept() ); } else { - Warning("Q&A: '%s' questioned '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), concept.GetStringConcept() ); + Warning("Q&A: '%s' questioned '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), conceptName.GetStringConcept() ); } NDebugOverlay::HorzArrow( GetAbsOrigin(), GetSpeechTarget()->GetAbsOrigin(), 8, 0, 255, 0, 64, true, duration ); } @@ -926,7 +926,7 @@ void CAI_PlayerAlly::AnswerQuestion( CAI_PlayerAlly *pQuestioner, int iQARandomN Assert( !selection.response.IsEmpty() ); SetSpeechTarget( selection.hSpeechTarget ); - SpeakDispatchResponse( selection.concept.c_str(), &selection.response, NULL ); + SpeakDispatchResponse( selection.conceptName.c_str(), &selection.response, NULL ); // Prevent idle speech for a while DeferAllIdleSpeech( random->RandomFloat( TALKER_DEFER_IDLE_SPEAK_MIN, TALKER_DEFER_IDLE_SPEAK_MAX ), GetSpeechTarget()->MyNPCPointer() ); @@ -978,7 +978,7 @@ int CAI_PlayerAlly::SelectNonCombatSpeechSchedule() { Assert( !selection.response.IsEmpty() ); SetSpeechTarget( selection.hSpeechTarget ); - SetPendingSpeech( selection.concept.c_str(), &selection.response ); + SetPendingSpeech( selection.conceptName.c_str(), &selection.response ); } } @@ -1556,10 +1556,10 @@ bool CAI_PlayerAlly::IsOkToSpeakInResponseToPlayer( void ) //----------------------------------------------------------------------------- // Purpose: Return true if I should speak based on the chance & the speech filter's modifier //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::ShouldSpeakRandom( AIConcept_t concept, int iChance ) +bool CAI_PlayerAlly::ShouldSpeakRandom( AIConcept_t conceptName, int iChance ) { CAI_AllySpeechManager * pSpeechManager = GetAllySpeechManager(); - ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( concept ); + ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( conceptName ); ConceptCategory_t category = ( pInfo ) ? pInfo->category : SPEECH_IDLE; if ( GetSpeechFilter() ) @@ -1585,10 +1585,10 @@ bool CAI_PlayerAlly::ShouldSpeakRandom( AIConcept_t concept, int iChance ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPlayer ) +bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t conceptName, bool bRespondingToPlayer ) { CAI_AllySpeechManager * pSpeechManager = GetAllySpeechManager(); - ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( concept ); + ConceptInfo_t * pInfo = pSpeechManager->GetConceptInfo( conceptName ); ConceptCategory_t category = ( pInfo ) ? pInfo->category : SPEECH_IDLE; if ( !IsOkToSpeak( category, bRespondingToPlayer ) ) @@ -1596,19 +1596,19 @@ bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPl if ( GetSpeechFilter() && GetSpeechFilter()->NeverSayHello() ) { - if ( CompareConcepts( concept, TLK_HELLO ) ) + if ( CompareConcepts( conceptName, TLK_HELLO ) ) return false; - if ( CompareConcepts( concept, TLK_HELLO_NPC ) ) + if ( CompareConcepts( conceptName, TLK_HELLO_NPC ) ) return false; } - if ( !pSpeechManager->ConceptDelayExpired( concept ) ) + if ( !pSpeechManager->ConceptDelayExpired( conceptName ) ) return false; - if ( ( pInfo && pInfo->flags & AICF_SPEAK_ONCE ) && GetExpresser()->SpokeConcept( concept ) ) + if ( ( pInfo && pInfo->flags & AICF_SPEAK_ONCE ) && GetExpresser()->SpokeConcept( conceptName ) ) return false; - if ( !GetExpresser()->CanSpeakConcept( concept ) ) + if ( !GetExpresser()->CanSpeakConcept( conceptName ) ) return false; return true; @@ -1616,11 +1616,11 @@ bool CAI_PlayerAlly::IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPl //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool CAI_PlayerAlly::SpeakIfAllowed( AIConcept_t concept, const char *modifiers, bool bRespondingToPlayer, char *pszOutResponseChosen, size_t bufsize ) +bool CAI_PlayerAlly::SpeakIfAllowed( AIConcept_t conceptName, const char *modifiers, bool bRespondingToPlayer, char *pszOutResponseChosen, size_t bufsize ) { - if ( IsAllowedToSpeak( concept, bRespondingToPlayer ) ) + if ( IsAllowedToSpeak( conceptName, bRespondingToPlayer ) ) { - return Speak( concept, modifiers, pszOutResponseChosen, bufsize ); + return Speak( conceptName, modifiers, pszOutResponseChosen, bufsize ); } return false; } @@ -1647,10 +1647,10 @@ void CAI_PlayerAlly::ModifyOrAppendCriteria( AI_CriteriaSet& set ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void CAI_PlayerAlly::OnSpokeConcept( AIConcept_t concept, AI_Response *response ) +void CAI_PlayerAlly::OnSpokeConcept( AIConcept_t conceptName, AI_Response *response ) { CAI_AllySpeechManager *pSpeechManager = GetAllySpeechManager(); - pSpeechManager->OnSpokeConcept( this, concept, response ); + pSpeechManager->OnSpokeConcept( this, conceptName, response ); if( response != NULL && (response->GetParams()->flags & AI_ResponseParams::RG_WEAPONDELAY) ) { diff --git a/src/game/server/ai_playerally.h b/src/game/server/ai_playerally.h index 2ab897a21..dc6028486 100644 --- a/src/game/server/ai_playerally.h +++ b/src/game/server/ai_playerally.h @@ -175,7 +175,7 @@ enum AIConceptFlags_t struct ConceptInfo_t { - AIConcept_t concept; + AIConcept_t conceptName; ConceptCategory_t category; float minGlobalCategoryDelay; float maxGlobalCategoryDelay; @@ -199,12 +199,12 @@ class CAI_AllySpeechManager : public CLogicalEntity void AddCustomConcept( const ConceptInfo_t &conceptInfo ); ConceptCategoryInfo_t *GetConceptCategoryInfo( ConceptCategory_t category ); - ConceptInfo_t *GetConceptInfo( AIConcept_t concept ); - void OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t concept, AI_Response *response ); + ConceptInfo_t *GetConceptInfo( AIConcept_t conceptName ); + void OnSpokeConcept( CAI_PlayerAlly *pPlayerAlly, AIConcept_t conceptName, AI_Response *response ); void SetCategoryDelay( ConceptCategory_t category, float minDelay, float maxDelay = 0.0 ); bool CategoryDelayExpired( ConceptCategory_t category ); - bool ConceptDelayExpired( AIConcept_t concept ); + bool ConceptDelayExpired( AIConcept_t conceptName ); private: @@ -249,7 +249,7 @@ struct AISpeechSelection_t void Set( AIConcept_t newConcept, AI_Response &nuResponse, CBaseEntity *pTarget = NULL ) { response = nuResponse; - concept = newConcept; + conceptName = newConcept; hSpeechTarget = pTarget; } @@ -257,11 +257,11 @@ struct AISpeechSelection_t void Set( AIConcept_t newConcept, CBaseEntity *pTarget ) { Assert( !response.IsEmpty() ); - concept = newConcept; + conceptName = newConcept; hSpeechTarget = pTarget; } - std::string concept; + std::string conceptName; AI_Response response; EHANDLE hSpeechTarget; }; @@ -341,14 +341,14 @@ class CAI_PlayerAlly : public CAI_BaseActor //--------------------------------- virtual bool SelectQuestionAndAnswerSpeech( AISpeechSelection_t *pSelection ); - virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ); + virtual void PostSpeakDispatchResponse( AIConcept_t conceptName, AI_Response *response ); bool SelectQuestionFriend( CBaseEntity *pFriend, AISpeechSelection_t *pSelection ); bool SelectAnswerFriend( CBaseEntity *pFriend, AISpeechSelection_t *pSelection, bool bRespondingToHello ); //--------------------------------- - bool SelectSpeechResponse( AIConcept_t concept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ); - void SetPendingSpeech( AIConcept_t concept, AI_Response *pResponse ); + bool SelectSpeechResponse( AIConcept_t conceptName, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection ); + void SetPendingSpeech( AIConcept_t conceptName, AI_Response *pResponse ); void ClearPendingSpeech(); bool HasPendingSpeech() { return !m_PendingConcept.empty(); } @@ -371,9 +371,9 @@ class CAI_PlayerAlly : public CAI_BaseActor bool IsOkToCombatSpeak( void ); virtual bool IsOkToSpeakInResponseToPlayer( void ); - bool ShouldSpeakRandom( AIConcept_t concept, int iChance ); - bool IsAllowedToSpeak( AIConcept_t concept, bool bRespondingToPlayer = false ); - virtual bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); + bool ShouldSpeakRandom( AIConcept_t conceptName, int iChance ); + bool IsAllowedToSpeak( AIConcept_t conceptName, bool bRespondingToPlayer = false ); + virtual bool SpeakIfAllowed( AIConcept_t conceptName, const char *modifiers = NULL, bool bRespondingToPlayer = false, char *pszOutResponseChosen = NULL, size_t bufsize = 0 ); void ModifyOrAppendCriteria( AI_CriteriaSet& set ); //--------------------------------- @@ -387,7 +387,7 @@ class CAI_PlayerAlly : public CAI_BaseActor //--------------------------------- - void OnSpokeConcept( AIConcept_t concept, AI_Response *response ); + void OnSpokeConcept( AIConcept_t conceptName, AI_Response *response ); void OnStartSpeaking(); // Inputs diff --git a/src/game/server/ai_speech.cpp b/src/game/server/ai_speech.cpp index 94172ae8e..452290cff 100644 --- a/src/game/server/ai_speech.cpp +++ b/src/game/server/ai_speech.cpp @@ -350,8 +350,8 @@ void CAI_Expresser::TestAllResponses() responses[i].GetResponse( response, sizeof( response ) ); Msg( "Response: %s\n", response ); - AIConcept_t concept; - SpeakDispatchResponse( concept, &responses[i], NULL ); + AIConcept_t conceptName; + SpeakDispatchResponse( conceptName, &responses[i], NULL ); } } } @@ -385,10 +385,10 @@ static void ModifyOrAppendGlobalCriteria( AI_CriteriaSet * RESTRICT outputSet ) } -void CAI_Expresser::GatherCriteria( AI_CriteriaSet * RESTRICT outputSet, const AIConcept_t &concept, const char * RESTRICT modifiers ) +void CAI_Expresser::GatherCriteria( AI_CriteriaSet * RESTRICT outputSet, const AIConcept_t &conceptName, const char * RESTRICT modifiers ) { // Always include the concept name - outputSet->AppendCriteria( "concept", concept, CONCEPT_WEIGHT ); + outputSet->AppendCriteria( "concept", conceptName, CONCEPT_WEIGHT ); #if 1 outputSet->Merge( modifiers ); @@ -438,7 +438,7 @@ void CAI_Expresser::GatherCriteria( AI_CriteriaSet * RESTRICT outputSet, const A // Output : AI_Response //----------------------------------------------------------------------------- // AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ ) -bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *criteria ) +bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &conceptName, AI_CriteriaSet *criteria ) { VPROF("CAI_Expresser::FindResponse"); IResponseSystem *rs = GetOuter()->GetResponseSystem(); @@ -457,7 +457,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept #if 0 // this is the old technique, where we always gathered criteria in this function AI_CriteriaSet set; // Always include the concept name - set.AppendCriteria( "concept", concept, CONCEPT_WEIGHT ); + set.AppendCriteria( "concept", conceptName, CONCEPT_WEIGHT ); // Always include any optional modifiers if ( modifiers != NULL ) @@ -495,7 +495,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept AI_CriteriaSet localCriteriaSet; // put it on the stack so we don't deal with new/delete if (criteria == NULL) { - GatherCriteria( &localCriteriaSet, concept, NULL ); + GatherCriteria( &localCriteriaSet, conceptName, NULL ); criteria = &localCriteriaSet; } #endif @@ -526,11 +526,11 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept char response[ 256 ]; outResponse.GetResponse( response, sizeof( response ) ); - Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, (const char*)concept, response ); + Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, (const char*)conceptName, response ); } else { - Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, (const char*)concept ); + Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, (const char*)conceptName ); } } } @@ -564,7 +564,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept // NULL - // Output : bool : true on success, false on fail //----------------------------------------------------------------------------- -AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t &concept, AI_CriteriaSet *criteria ) +AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t &conceptName, AI_CriteriaSet *criteria ) { Assert(response); @@ -578,7 +578,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t #if 0 AI_CriteriaSet set; // Always include the concept name - set.AppendCriteria( "concept", concept, CONCEPT_WEIGHT ); + set.AppendCriteria( "concept", conceptName, CONCEPT_WEIGHT ); // Always include any optional modifiers if ( modifiers != NULL ) @@ -638,11 +638,11 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t char response[ 256 ]; result->GetResponse( response, sizeof( response ) ); - Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, concept, response ); + Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, conceptName, response ); } else { - Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, concept ); + Warning( "RESPONSERULES: %s spoke '%s'. Found no matching response.\n", pszName, conceptName ); } } } @@ -669,7 +669,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t // Purpose: Dispatches the result // Input : *response - //----------------------------------------------------------------------------- -bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *result, AI_CriteriaSet *criteria, IRecipientFilter *filter /* = NULL */ ) +bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &conceptName, AI_Response *result, AI_CriteriaSet *criteria, IRecipientFilter *filter /* = NULL */ ) { char response[ 256 ]; result->GetResponse( response, sizeof( response ) ); @@ -680,14 +680,14 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *re soundlevel_t soundlevel = result->GetSoundLevel(); - if ( IsSpeaking() && concept[0] != 0 && result->GetType() != ResponseRules::RESPONSE_PRINT ) + if ( IsSpeaking() && conceptName[0] != 0 && result->GetType() != ResponseRules::RESPONSE_PRINT ) { const char *entityName = STRING( GetOuter()->GetEntityName() ); if ( GetOuter()->IsPlayer() ) { entityName = ToBasePlayer( GetOuter() )->GetPlayerName(); } - DevMsg( 2, "SpeakDispatchResponse: Entity ( %i/%s ) already speaking, forcing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)concept ); + DevMsg( 2, "SpeakDispatchResponse: Entity ( %i/%s ) already speaking, forcing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)conceptName ); // Tracker 15911: Can break the game if we stop an imported map placed lcs here, so only // cancel actor out of instanced scripted scenes. ywb @@ -696,7 +696,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *re if ( IsRunningScriptedScene( GetOuter() ) ) { - DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) refusing to speak due to scene entity, tossing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)concept ); + DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) refusing to speak due to scene entity, tossing '%s'\n", GetOuter()->entindex(), entityName ? entityName : "UNKNOWN", (const char*)conceptName ); return false; } } @@ -769,7 +769,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *re { Vector vPrintPos; GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos ); - NDebugOverlay::Text( vPrintPos, CFmtStr( "%s: %s", (const char*)concept, response ), true, 1.5 ); + NDebugOverlay::Text( vPrintPos, CFmtStr( "%s: %s", (const char*)conceptName, response ), true, 1.5 ); } if ( result->IsApplyContextToWorld() ) @@ -784,7 +784,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *re { GetOuter()->AddContext( result->GetContext() ); } - SetSpokeConcept( concept, result ); + SetSpokeConcept( conceptName, result ); } else { @@ -893,13 +893,13 @@ float CAI_Expresser::GetResponseDuration( AI_Response *result ) // Input : concept - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- -bool CAI_Expresser::Speak( AIConcept_t &concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +bool CAI_Expresser::Speak( AIConcept_t &conceptName, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { - concept.SetSpeaker(GetOuter()); + conceptName.SetSpeaker(GetOuter()); AI_CriteriaSet criteria; - GatherCriteria(&criteria, concept, modifiers); + GatherCriteria(&criteria, conceptName, modifiers); - return Speak( concept, &criteria, pszOutResponseChosen, bufsize, filter ); + return Speak( conceptName, &criteria, pszOutResponseChosen, bufsize, filter ); } @@ -907,7 +907,7 @@ bool CAI_Expresser::Speak( AIConcept_t &concept, const char *modifiers /*= NULL* //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -bool CAI_Expresser::Speak( AIConcept_t &concept, AI_CriteriaSet * RESTRICT criteria, char *pszOutResponseChosen , size_t bufsize , IRecipientFilter *filter ) +bool CAI_Expresser::Speak( AIConcept_t &conceptName, AI_CriteriaSet * RESTRICT criteria, char *pszOutResponseChosen , size_t bufsize , IRecipientFilter *filter ) { VPROF("CAI_Expresser::Speak"); if ( IsSpeechGloballySuppressed() ) @@ -917,15 +917,15 @@ bool CAI_Expresser::Speak( AIConcept_t &concept, AI_CriteriaSet * RESTRICT crite GetOuter()->ModifyOrAppendDerivedCriteria(*criteria); AI_Response result; - if ( !FindResponse( result, concept, criteria ) ) + if ( !FindResponse( result, conceptName, criteria ) ) { return false; } - SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)concept, gpGlobals->curtime ); + SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)conceptName, gpGlobals->curtime ); // Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), concept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" ); - bool spoke = SpeakDispatchResponse( concept, &result, criteria, filter ); + bool spoke = SpeakDispatchResponse( conceptName, &result, criteria, filter ); if ( pszOutResponseChosen ) { result.GetResponse( pszOutResponseChosen, bufsize ); @@ -1109,10 +1109,10 @@ bool CAI_Expresser::CanSpeakAfterMyself() } //------------------------------------- -bool CAI_Expresser::CanSpeakConcept( AIConcept_t concept ) +bool CAI_Expresser::CanSpeakConcept( AIConcept_t conceptName ) { // Not in history? - int iter = m_ConceptHistories.Find( concept ); + int iter = m_ConceptHistories.Find( conceptName ); if ( iter == m_ConceptHistories.InvalidIndex() ) { return true; @@ -1141,16 +1141,16 @@ bool CAI_Expresser::CanSpeakConcept( AIConcept_t concept ) //------------------------------------- -bool CAI_Expresser::SpokeConcept( AIConcept_t concept ) +bool CAI_Expresser::SpokeConcept( AIConcept_t conceptName ) { - return GetTimeSpokeConcept( concept ) != -1.f; + return GetTimeSpokeConcept( conceptName ) != -1.f; } //------------------------------------- -float CAI_Expresser::GetTimeSpokeConcept( AIConcept_t concept ) +float CAI_Expresser::GetTimeSpokeConcept( AIConcept_t conceptName ) { - int iter = m_ConceptHistories.Find( concept ); + int iter = m_ConceptHistories.Find( conceptName ); if ( iter == m_ConceptHistories.InvalidIndex() ) return -1; @@ -1160,14 +1160,14 @@ float CAI_Expresser::GetTimeSpokeConcept( AIConcept_t concept ) //------------------------------------- -void CAI_Expresser::SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback ) +void CAI_Expresser::SetSpokeConcept( AIConcept_t conceptName, AI_Response *response, bool bCallback ) { - int idx = m_ConceptHistories.Find( concept ); + int idx = m_ConceptHistories.Find( conceptName ); if ( idx == m_ConceptHistories.InvalidIndex() ) { ConceptHistory_t h; h.timeSpoken = gpGlobals->curtime; - idx = m_ConceptHistories.Insert( concept, h ); + idx = m_ConceptHistories.Insert( conceptName, h ); } ConceptHistory_t *slot = &m_ConceptHistories[ idx ]; @@ -1180,14 +1180,14 @@ void CAI_Expresser::SetSpokeConcept( AIConcept_t concept, AI_Response *response, } if ( bCallback ) - GetSink()->OnSpokeConcept( concept, response ); + GetSink()->OnSpokeConcept( conceptName, response ); } //------------------------------------- -void CAI_Expresser::ClearSpokeConcept( AIConcept_t concept ) +void CAI_Expresser::ClearSpokeConcept( AIConcept_t conceptName ) { - m_ConceptHistories.Remove( concept ); + m_ConceptHistories.Remove( conceptName ); } //------------------------------------- diff --git a/src/game/server/ai_speech.h b/src/game/server/ai_speech.h index e05fe30d1..712342071 100644 --- a/src/game/server/ai_speech.h +++ b/src/game/server/ai_speech.h @@ -123,7 +123,7 @@ inline bool CompareConcepts( AIConcept_t c1, AIConcept_t c2 ) class CAI_ExpresserSink { public: - virtual void OnSpokeConcept( AIConcept_t concept, AI_Response *response ) {}; + virtual void OnSpokeConcept( AIConcept_t conceptName, AI_Response *response ) {}; virtual void OnStartSpeaking() {} virtual bool UseSemaphore() { return true; } }; @@ -162,20 +162,20 @@ class CAI_Expresser : public ResponseRules::IResponseFilter // -------------------------------- - bool Speak( AIConcept_t &concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - bool Speak( AIConcept_t &concept, AI_CriteriaSet *criteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + bool Speak( AIConcept_t &conceptName, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + bool Speak( AIConcept_t &conceptName, AI_CriteriaSet *criteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); // Given modifiers (which are colon-delimited strings), fill out a criteria set including this // character's contexts and the ones in the modifier. This lets us hang on to them after a call // to SpeakFindResponse. - void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &concept, const char *modifiers ); + void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &conceptName, const char *modifiers ); // These two methods allow looking up a response and dispatching it to be two different steps // AI_Response *SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL ); // AI_Response *SpeakFindResponse( AIConcept_t &concept, AI_CriteriaSet *criteria ); // Find the appropriate response for the given concept. Return false if none found. // Fills out the response object that you provide. - bool FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *modifiers = NULL ); - virtual bool SpeakDispatchResponse( AIConcept_t &concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); + bool FindResponse( AI_Response &outResponse, AIConcept_t &conceptName, AI_CriteriaSet *modifiers = NULL ); + virtual bool SpeakDispatchResponse( AIConcept_t &conceptName, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); float GetResponseDuration( AI_Response *response ); virtual int SpeakRawSentence( const char *pszSentence, float delay, float volume = VOL_NORM, soundlevel_t soundlevel = SNDLVL_TALKING, CBaseEntity *pListener = NULL ); @@ -198,11 +198,11 @@ class CAI_Expresser : public ResponseRules::IResponseFilter // -------------------------------- - bool CanSpeakConcept( AIConcept_t concept ); - bool SpokeConcept( AIConcept_t concept ); - float GetTimeSpokeConcept( AIConcept_t concept ); // returns -1 if never - void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true ); - void ClearSpokeConcept( AIConcept_t concept ); + bool CanSpeakConcept( AIConcept_t conceptName ); + bool SpokeConcept( AIConcept_t conceptName ); + float GetTimeSpokeConcept( AIConcept_t conceptName ); // returns -1 if never + void SetSpokeConcept( AIConcept_t conceptName, AI_Response *response, bool bCallback = true ); + void ClearSpokeConcept( AIConcept_t conceptName ); // -------------------------------- @@ -290,21 +290,21 @@ class CAI_ExpresserHost : public BASE_NPC, protected CAI_ExpresserSink public: virtual void NoteSpeaking( float duration, float delay ); - virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - virtual bool Speak( AIConcept_t concept, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t conceptName, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t conceptName, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &concept, const char *modifiers ); + void GatherCriteria( AI_CriteriaSet *outputCritera, const AIConcept_t &conceptName, const char *modifiers ); // These two methods allow looking up a response and dispatching it to be two different steps // AI_Response * SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL ); // AI_Response *SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet *criteria ); // AI_Response *SpeakFindResponse( AIConcept_t concept ); // Find the appropriate response for the given concept. Return false if none found. // Fills out the response object that you provide. - bool FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *criteria = NULL ); + bool FindResponse( AI_Response &outResponse, AIConcept_t &conceptName, AI_CriteriaSet *criteria = NULL ); - bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria = NULL ); - virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; } + bool SpeakDispatchResponse( AIConcept_t conceptName, AI_Response *response, AI_CriteriaSet *criteria = NULL ); + virtual void PostSpeakDispatchResponse( AIConcept_t conceptName, AI_Response *response ) { return; } float GetResponseDuration( AI_Response *response ); float GetTimeSpeechComplete() const { return this->GetExpresser()->GetTimeSpeechComplete(); } @@ -313,9 +313,9 @@ class CAI_ExpresserHost : public BASE_NPC, protected CAI_ExpresserSink bool CanSpeak() { return this->GetExpresser()->CanSpeak(); } bool CanSpeakAfterMyself() { return this->GetExpresser()->CanSpeakAfterMyself(); } - void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true ) { this->GetExpresser()->SetSpokeConcept( concept, response, bCallback ); } - float GetTimeSpokeConcept( AIConcept_t concept ) { return this->GetExpresser()->GetTimeSpokeConcept( concept ); } - bool SpokeConcept( AIConcept_t concept ) { return this->GetExpresser()->SpokeConcept( concept ); } + void SetSpokeConcept( AIConcept_t conceptName, AI_Response *response, bool bCallback = true ) { this->GetExpresser()->SetSpokeConcept( conceptName, response, bCallback ); } + float GetTimeSpokeConcept( AIConcept_t conceptName ) { return this->GetExpresser()->GetTimeSpokeConcept( conceptName ); } + bool SpokeConcept( AIConcept_t conceptName ) { return this->GetExpresser()->SpokeConcept( conceptName ); } protected: int PlaySentence( const char *pszSentence, float delay, float volume = VOL_NORM, soundlevel_t soundlevel = SNDLVL_TALKING, CBaseEntity *pListener = NULL ); @@ -337,24 +337,24 @@ inline void CAI_ExpresserHost::NoteSpeaking( float duration, float del //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +inline bool CAI_ExpresserHost::Speak( AIConcept_t conceptName, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { AssertOnce( this->GetExpresser()->GetOuter() == this ); - return this->GetExpresser()->Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter ); + return this->GetExpresser()->Speak( conceptName, modifiers, pszOutResponseChosen, bufsize, filter ); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +inline bool CAI_ExpresserHost::Speak( AIConcept_t conceptName, AI_CriteriaSet *pCriteria, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { AssertOnce( this->GetExpresser()->GetOuter() == this ); CAI_Expresser * const RESTRICT pExpresser = this->GetExpresser(); - concept.SetSpeaker(this); + conceptName.SetSpeaker(this); // add in any local criteria to the one passed on the command line. - pExpresser->GatherCriteria( pCriteria, concept, NULL ); + pExpresser->GatherCriteria( pCriteria, conceptName, NULL ); // call the "I have aleady gathered criteria" version of Expresser::Speak - return pExpresser->Speak( concept, pCriteria, pszOutResponseChosen, bufsize, filter ); + return pExpresser->Speak( conceptName, pCriteria, pszOutResponseChosen, bufsize, filter ); } @@ -398,9 +398,9 @@ inline ResponseRules::IResponseSystem *CAI_ExpresserHost::GetResponseS //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline void CAI_ExpresserHost::GatherCriteria( AI_CriteriaSet *outputCriteria, const AIConcept_t &concept, const char *modifiers ) +inline void CAI_ExpresserHost::GatherCriteria( AI_CriteriaSet *outputCriteria, const AIConcept_t &conceptName, const char *modifiers ) { - return this->GetExpresser()->GatherCriteria( outputCriteria, concept, modifiers ); + return this->GetExpresser()->GatherCriteria( outputCriteria, conceptName, modifiers ); } @@ -408,9 +408,9 @@ inline void CAI_ExpresserHost::GatherCriteria( AI_CriteriaSet *outputC //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ ) +inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t conceptName, const char *modifiers /*= NULL*/ ) { - return this->GetExpresser()->SpeakFindResponse( concept, modifiers ); + return this->GetExpresser()->SpeakFindResponse( conceptName, modifiers ); } #endif @@ -418,9 +418,9 @@ inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet *criteria /*= NULL*/ ) +inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t conceptName, AI_CriteriaSet *criteria /*= NULL*/ ) { - return this->GetExpresser()->SpeakFindResponse( concept, criteria ); + return this->GetExpresser()->SpeakFindResponse( conceptName, criteria ); } @@ -429,11 +429,11 @@ inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t // class that generates a one off. //----------------------------------------------------------------------------- template -inline AI_Response * CAI_ExpresserHost::SpeakFindResponse( AIConcept_t concept ) +inline AI_Response * CAI_ExpresserHost::SpeakFindResponse( AIConcept_t conceptName ) { AI_CriteriaSet criteria; - GatherCriteria( &criteria, concept, NULL ); - return this->GetExpresser()->SpeakFindResponse( concept, &criteria ); + GatherCriteria( &criteria, conceptName, NULL ); + return this->GetExpresser()->SpeakFindResponse( conceptName, &criteria ); } #endif @@ -441,20 +441,20 @@ inline AI_Response * CAI_ExpresserHost::SpeakFindResponse( AIConcept_t //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *criteria ) +inline bool CAI_ExpresserHost::FindResponse( AI_Response &outResponse, AIConcept_t &conceptName, AI_CriteriaSet *criteria ) { - return this->GetExpresser()->FindResponse( outResponse, concept, criteria ); + return this->GetExpresser()->FindResponse( outResponse, conceptName, criteria ); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria ) +inline bool CAI_ExpresserHost::SpeakDispatchResponse( AIConcept_t conceptName, AI_Response *response, AI_CriteriaSet *criteria ) { - if ( this->GetExpresser()->SpeakDispatchResponse( concept, response, criteria ) ) + if ( this->GetExpresser()->SpeakDispatchResponse( conceptName, response, criteria ) ) { - PostSpeakDispatchResponse( concept, response ); + PostSpeakDispatchResponse( conceptName, response ); return true; } @@ -491,7 +491,7 @@ inline void CAI_ExpresserHost::DispatchResponse( const char *conceptNa template class CAI_ExpresserHostWithData : public CAI_ExpresserHost { - DECLARE_CLASS_NOFRIEND( CAI_ExpresserHostWithData, CAI_ExpresserHost ); + DECLARE_CLASS_NOFRIEND( CAI_ExpresserHostWithData, CAI_ExpresserHost ); public: CAI_ExpresserHostWithData( ) : m_pExpresser(NULL) {}; @@ -507,11 +507,11 @@ class CAI_ExpresserHostWithData : public CAI_ExpresserHost protected: EXPRESSER_TYPE *CreateExpresser( void ) { - AssertMsg1( m_pExpresser == NULL, "Tried to double-initialize expresser in %s\n", GetDebugName() ); + AssertMsg1( m_pExpresser == NULL, "Tried to double-initialize expresser in %s\n", this->GetDebugName() ); m_pExpresser = new EXPRESSER_TYPE(this); if ( !m_pExpresser) { - AssertMsg1( false, "Creating an expresser failed in %s\n", GetDebugName() ); + AssertMsg1( false, "Creating an expresser failed in %s\n", this->GetDebugName() ); return NULL; } @@ -601,15 +601,15 @@ class CAI_ExpresserWithFollowup : public CAI_Expresser CAI_ExpresserWithFollowup( CBaseFlex *pOuter = NULL ) : CAI_Expresser(pOuter), m_pPostponedFollowup(NULL) {}; - virtual bool Speak( AIConcept_t &concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - virtual bool SpeakDispatchResponse( AIConcept_t &concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t &conceptName, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool SpeakDispatchResponse( AIConcept_t &conceptName, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL ); virtual void SpeakDispatchFollowup( AI_ResponseFollowup &followup ); virtual void OnSpeechFinished(); typedef CAI_Expresser BaseClass; protected: - static void DispatchFollowupThroughQueue( const AIConcept_t &concept, + static void DispatchFollowupThroughQueue( const AIConcept_t &conceptName, const char *criteriaStr, const CResponseQueue::CFollowupTargetSpec_t &target, float delay, diff --git a/src/game/server/ai_speechqueue.cpp b/src/game/server/ai_speechqueue.cpp index 342f879e4..e804b9fc2 100644 --- a/src/game/server/ai_speechqueue.cpp +++ b/src/game/server/ai_speechqueue.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -28,7 +28,7 @@ CResponseQueue::CResponseQueue( int queueSize ) : m_Queue(queueSize), m_Expresse {}; /// Add a deferred response. -void CResponseQueue::Add( const AIConcept_t &concept, ///< concept to dispatch +void CResponseQueue::Add( const AIConcept_t &conceptName, ///< concept to dispatch const AI_CriteriaSet * RESTRICT contexts, float time, ///< when to dispatch it. You can specify a time of zero to mean "immediately." const CFollowupTargetSpec_t &targetspec, @@ -38,12 +38,12 @@ void CResponseQueue::Add( const AIConcept_t &concept, ///< concept to dispatch // Add a response. AssertMsg( m_Queue.Count() < AI_RESPONSE_QUEUE_SIZE, "AI Response queue overfilled." ); QueueType_t::IndexLocalType_t idx = m_Queue.AddToTail(); - m_Queue[idx].Init( concept, contexts, time, targetspec, pIssuer ); + m_Queue[idx].Init( conceptName, contexts, time, targetspec, pIssuer ); } /// Remove a deferred response matching the concept and issuer. -void CResponseQueue::Remove( const AIConcept_t &concept, ///< concept to dispatch +void CResponseQueue::Remove( const AIConcept_t &conceptName, ///< concept to dispatch CBaseEntity * const RESTRICT pIssuer ///< the entity issuing the response, if one exists. ) RESTRICT { @@ -54,7 +54,7 @@ void CResponseQueue::Remove( const AIConcept_t &concept, ///< concept to dispat CDeferredResponse &response = m_Queue[idx]; QueueType_t::IndexLocalType_t previdx = idx; // advance the index immediately because we may be deleting the "current" element idx = m_Queue.Next(idx); // is now the next index - if ( CompareConcepts( response.m_concept, concept ) && // if concepts match and + if ( CompareConcepts( response.m_concept, conceptName ) && // if concepts match and ( !pIssuer || ( response.m_hIssuer.Get() == pIssuer ) ) // issuer is null, or matches the one in the response ) { diff --git a/src/game/server/ai_speechqueue.h b/src/game/server/ai_speechqueue.h index 15101b70b..e6d25d392 100644 --- a/src/game/server/ai_speechqueue.h +++ b/src/game/server/ai_speechqueue.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: An event queue of AI concepts that dispatches them to appropriate characters. // @@ -73,7 +73,7 @@ class CResponseQueue */ CFollowupTargetSpec_t m_Target; - inline void Init( const AIConcept_t &concept, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ); + inline void Init( const AIConcept_t &conceptName, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ); inline bool IsQuashed() { return !m_Target.IsValid(); } void Quash(); ///< make this response invalid. }; @@ -85,7 +85,7 @@ class CResponseQueue CResponseQueue( int queueSize ); /// Add a deferred response. - void Add( const AIConcept_t &concept, ///< concept to dispatch + void Add( const AIConcept_t &conceptName, ///< concept to dispatch const AI_CriteriaSet * RESTRICT contexts, ///< the contexts that come with it (may be NULL) float time, ///< when to dispatch it. You can specify a time of zero to mean "immediately." const CFollowupTargetSpec_t &targetspec, /// All information necessary to target this response @@ -93,7 +93,7 @@ class CResponseQueue ); /// Remove all deferred responses matching the concept and issuer. - void Remove( const AIConcept_t &concept, ///< concept to dispatch + void Remove( const AIConcept_t &conceptName, ///< concept to dispatch CBaseEntity * const pIssuer = NULL ///< the entity issuing the response, if one exists. ); @@ -140,9 +140,9 @@ class CResponseQueue CUtlVector m_ExpresserTargets; // a list of legitimate expresser targets }; -inline void CResponseQueue::CDeferredResponse::Init(const AIConcept_t &concept, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ) +inline void CResponseQueue::CDeferredResponse::Init(const AIConcept_t &conceptName, const AI_CriteriaSet * RESTRICT contexts, float dtime, const CFollowupTargetSpec_t &target, CBaseEntity *pIssuer ) { - m_concept = concept; + m_concept = conceptName; m_fDispatchTime = dtime; /* m_iTargetType = targetType; @@ -205,32 +205,32 @@ extern CResponseQueueManager g_ResponseQueueManager; // Handy global helper funcs /// Automatically queue up speech to happen immediately -- calls straight through to response rules add -inline void QueueSpeak( const AIConcept_t &concept, ///< concept name to say +inline void QueueSpeak( const AIConcept_t &conceptName, ///< concept name to say const CResponseQueue::CFollowupTargetSpec_t& targetspec, ///< kDRT_ANY, kDRT_ALL, etc CBaseEntity *pIssuer = NULL ///< if specifying ANY or ALL, use this to specify the one you *don't* want to speak ) { - return g_ResponseQueueManager.GetQueue()->Add( concept, NULL, 0.0f, targetspec, pIssuer ); + return g_ResponseQueueManager.GetQueue()->Add( conceptName, NULL, 0.0f, targetspec, pIssuer ); } /// Automatically queue up speech to happen immediately -- calls straight through to response rules add -inline void QueueSpeak( const AIConcept_t &concept, ///< concept name to say +inline void QueueSpeak( const AIConcept_t &conceptName, ///< concept name to say const CResponseQueue::CFollowupTargetSpec_t& targetspec, ///< kDRT_ANY, kDRT_ALL, etc const AI_CriteriaSet &criteria, ///< criteria to pass in CBaseEntity *pIssuer = NULL ///< if specifying ANY or ALL, use this to specify the one you *don't* want to speak ) { - return g_ResponseQueueManager.GetQueue()->Add( concept, &criteria, 0.0f, targetspec, pIssuer ); + return g_ResponseQueueManager.GetQueue()->Add( conceptName, &criteria, 0.0f, targetspec, pIssuer ); } /// Automatically queue up speech to happen immediately -- calls straight through to response rules add -inline void QueueSpeak( const AIConcept_t &concept, ///< concept name to say +inline void QueueSpeak( const AIConcept_t &conceptName, ///< concept name to say const EHANDLE &target, ///< which entity shall speak float delay, ///< how far in the future to speak const AI_CriteriaSet &criteria, ///< criteria to pass in CBaseEntity *pIssuer = NULL ) { - return g_ResponseQueueManager.GetQueue()->Add( concept, &criteria, gpGlobals->curtime + delay, + return g_ResponseQueueManager.GetQueue()->Add( conceptName, &criteria, gpGlobals->curtime + delay, CResponseQueue::CFollowupTargetSpec_t(target), pIssuer ); } diff --git a/src/game/server/basemultiplayerplayer.cpp b/src/game/server/basemultiplayerplayer.cpp index 709965454..3c7b2902d 100644 --- a/src/game/server/basemultiplayerplayer.cpp +++ b/src/game/server/basemultiplayerplayer.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ +//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -71,13 +71,13 @@ void CBaseMultiplayerPlayer::ModifyOrAppendCriteria( AI_CriteriaSet& criteriaSet //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t concept, SpeechPriorityType priority, const char *modifiers, char *pszOutResponseChosen, size_t bufsize, IRecipientFilter *filter ) +bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t conceptName, SpeechPriorityType priority, const char *modifiers, char *pszOutResponseChosen, size_t bufsize, IRecipientFilter *filter ) { if ( !IsAlive() ) return false; //if ( IsAllowedToSpeak( concept, bRespondingToPlayer ) ) - return Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter ); + return Speak( conceptName, modifiers, pszOutResponseChosen, bufsize, filter ); } //----------------------------------------------------------------------------- @@ -86,8 +86,8 @@ bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t concept, SpeechPriority void CBaseMultiplayerPlayer::SpeakConcept( AI_Response &outResponse, int iConcept ) { m_iCurrentConcept = iConcept; - AIConcept_t concept( g_pszMPConcepts[iConcept] ); - FindResponse( outResponse, concept ); + AIConcept_t conceptName( g_pszMPConcepts[iConcept] ); + FindResponse( outResponse, conceptName ); } diff --git a/src/game/server/basemultiplayerplayer.h b/src/game/server/basemultiplayerplayer.h index 37ee8adad..add36845e 100644 --- a/src/game/server/basemultiplayerplayer.h +++ b/src/game/server/basemultiplayerplayer.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve LLC, All rights reserved. ============ +//========= Copyright © 1996-2005, Valve LLC, All rights reserved. ============ // //============================================================================= #ifndef BASEMULTIPLAYERPLAYER_H @@ -33,7 +33,7 @@ class CBaseMultiplayerPlayer : public CAI_ExpresserHost virtual void PostConstructor( const char *szClassname ); virtual void ModifyOrAppendCriteria( AI_CriteriaSet& criteriaSet ); - virtual bool SpeakIfAllowed( AIConcept_t concept, SpeechPriorityType priority, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool SpeakIfAllowed( AIConcept_t conceptName, SpeechPriorityType priority, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); void SpeakConcept( AI_Response &outresponse, int iConcept ); virtual bool SpeakConceptIfAllowed( int iConcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); diff --git a/src/game/server/hl2/ai_behavior_actbusy.cpp b/src/game/server/hl2/ai_behavior_actbusy.cpp index 8fb3fb1e8..c4f72efff 100644 --- a/src/game/server/hl2/ai_behavior_actbusy.cpp +++ b/src/game/server/hl2/ai_behavior_actbusy.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -1649,12 +1649,12 @@ void CAI_ActBusyBehavior::PlaySoundForActBusy( busyanimparts_t AnimPart ) CAI_Expresser *pExpresser = GetOuter()->GetExpresser(); if ( pExpresser ) { - AIConcept_t concept(STRING(pBusyAnim->iszSounds[AnimPart])); + AIConcept_t conceptName(STRING(pBusyAnim->iszSounds[AnimPart])); // Must be able to speak the concept - if ( !pExpresser->IsSpeaking() && pExpresser->CanSpeakConcept( concept ) ) + if ( !pExpresser->IsSpeaking() && pExpresser->CanSpeakConcept( conceptName ) ) { - pExpresser->Speak( concept ); + pExpresser->Speak( conceptName ); } } } diff --git a/src/game/server/hl2/npc_citizen17.h b/src/game/server/hl2/npc_citizen17.h index 838ef0763..4adfc6433 100644 --- a/src/game/server/hl2/npc_citizen17.h +++ b/src/game/server/hl2/npc_citizen17.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: The downtrodden citizens of City 17. Timid when unarmed, they will // rise up against their Combine oppressors when given a weapon. @@ -194,7 +194,7 @@ class CNPC_Citizen : public CNPC_PlayerCompanion void SetSquad( CAI_Squad *pSquad ); void AddInsignia(); void RemoveInsignia(); - bool SpeakCommandResponse( AIConcept_t concept, const char *modifiers = NULL ); + bool SpeakCommandResponse( AIConcept_t conceptName, const char *modifiers = NULL ); //--------------------------------- // Scanner interaction diff --git a/src/responserules/runtime/response_system.cpp b/src/responserules/runtime/response_system.cpp index b9270aaa9..936263bb0 100644 --- a/src/responserules/runtime/response_system.cpp +++ b/src/responserules/runtime/response_system.cpp @@ -2634,8 +2634,8 @@ static void CC_RR_Debug_ResponseConcept_Exclude( const CCommand &args ) { Msg( "\t'%s' is not a known concept (adding it anyway)\n", args[i] ); } - CRR_Concept concept( args[i] ); - CResponseSystem::m_DebugExcludeList.AddToTail( concept ); + CRR_Concept conceptName( args[i] ); + CResponseSystem::m_DebugExcludeList.AddToTail( conceptName ); } } } From 68ef8309149e18dc1ae082160eeb02e9a3e77236 Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:27 +0200 Subject: [PATCH 05/13] C++14 to C++20: fix C2059/C2143/C2447/C2988/C3837 (clamp macro) The clamp macro in mathlib.h was expanded inside and broke it. The macro is gone; the C++ clamp template in tier0/basetypes.h is the only clamp and takes the two bound types separately with an explicit result conversion. The macro branch left there is the C one (#else of #ifdef __cplusplus). --- src/public/mathlib/mathlib.h | 9 ++------- src/public/tier0/basetypes.h | 8 ++++---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/public/mathlib/mathlib.h b/src/public/mathlib/mathlib.h index 1895b09f3..6a757b4ba 100644 --- a/src/public/mathlib/mathlib.h +++ b/src/public/mathlib/mathlib.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -629,11 +629,6 @@ template FORCEINLINE T AVG(T a, T b) // XYZ macro, for printf type functions - ex printf("%f %f %f",XYZ(myvector)); #define XYZ(v) (v).x,(v).y,(v).z -// -// Returns a clamped value in the range [min, max]. -// -#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) - inline float Sign( float x ) { return fsel( x, 1.0f, -1.0f ); // x >= 0 ? 1.0f : -1.0f @@ -2202,7 +2197,7 @@ inline bool CloseEnough( const Vector &a, const Vector &b, float epsilon = EQUAL // Fast compare // maxUlps is the maximum error in terms of Units in the Last Place. This // specifies how big an error we are willing to accept in terms of the value -// of the least significant digit of the floating point number’s +// of the least significant digit of the floating point number’s // representation. maxUlps can also be interpreted in terms of how many // representable floats we are willing to accept between A and B. // This function will allow maxUlps-1 floats between A and B. diff --git a/src/public/tier0/basetypes.h b/src/public/tier0/basetypes.h index fb25e7416..ad82e651c 100644 --- a/src/public/tier0/basetypes.h +++ b/src/public/tier0/basetypes.h @@ -113,13 +113,13 @@ FORCEINLINE float fpmax( float a, float b ) #ifdef __cplusplus -template< class T, class Y > -inline T clamp( T const &val, Y const &minVal, Y const &maxVal ) +template< class T, class MIN, class MAX > +inline T clamp( T const &val, MIN const &minVal, MAX const &maxVal ) { if( val < minVal ) - return minVal; + return T( minVal ); else if( val > maxVal ) - return maxVal; + return T( maxVal ); else return val; } From 1c7b147916c3b4243a790d7421ab697d1e6bf73e Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:28 +0200 Subject: [PATCH 06/13] C++14 to C++20: fix C2440/C2664 (strict string literals) The datatable API is const-correct now (dt_recv, dt_send, dt_utlvector_recv, dt_utlvector_send, ClientClass, ServerClass, recvproxy, sendproxy), which fixes the RECVINFO/SENDINFO macro call sites without touching the tables. The remaining literal sites were fixed by making the local const or by const-correcting the in-repo signature; explicit casts are kept only at engine boundaries. --- src/common/language.cpp | 8 ++-- src/fgdlib/gamedata.cpp | 2 +- src/fgdlib/gdvar.cpp | 4 +- src/fgdlib/inputoutput.cpp | 4 +- src/game/client/c_baseanimating.cpp | 4 +- src/game/client/c_baseanimating.h | 4 +- src/game/client/c_baseentity.h | 6 +-- src/game/client/c_baseflex.cpp | 4 +- src/game/client/c_baseflex.h | 4 +- src/game/client/c_baselesson.cpp | 4 +- src/game/client/c_baseplayer.cpp | 2 +- src/game/client/c_baseplayer.h | 4 +- src/game/client/clientshadowmgr.cpp | 16 +++---- src/game/client/entity_client_tools.cpp | 8 ++-- .../client/game_controls/SpectatorGUI.cpp | 4 +- src/game/client/hud.cpp | 2 +- src/game/client/hud.h | 2 +- src/game/client/physpropclientside.cpp | 4 +- src/game/client/physpropclientside.h | 4 +- src/game/client/recvproxy.cpp | 12 ++--- src/game/client/recvproxy.h | 12 ++--- src/game/client/swarm/c_asw_door.cpp | 2 +- src/game/client/swarm/c_asw_door.h | 2 +- src/game/client/swarm/c_asw_marine.cpp | 2 +- src/game/client/swarm/c_asw_steamstats.cpp | 4 +- .../createmultiplayergameserverpage.cpp | 8 ++-- .../swarm/gameui/optionssubkeyboard.cpp | 4 +- .../swarm/gameui/optionssubmultiplayer.cpp | 10 ++-- src/game/client/swarm/gameui/scriptobject.cpp | 4 +- src/game/client/swarm/gameui/scriptobject.h | 4 +- .../client/swarm/gameui/swarm/vaddons.cpp | 10 ++-- .../swarm/gameui/swarm/vhybridbutton.cpp | 6 +-- .../swarm/gameui/swarm/vmultiplayer.cpp | 4 +- src/game/client/swarm/vgui/objectivepanel.cpp | 2 +- .../client/swarm/vgui/objectivetitlepanel.cpp | 4 +- src/game/client/text_message.cpp | 4 +- src/game/server/globalstate.cpp | 2 +- src/game/server/hl2/npc_basescanner.h | 4 +- src/game/server/hl2/npc_bullseye.cpp | 4 +- src/game/server/netpropmanager.cpp | 2 +- src/game/server/sendproxy.cpp | 14 +++--- src/game/server/sendproxy.h | 14 +++--- src/game/server/skyboxswapper.cpp | 2 +- src/game/server/swarm/asw_env_explosion.cpp | 4 +- src/game/server/textstatsmgr.cpp | 4 +- src/game/server/textstatsmgr.h | 4 +- src/game/server/util.cpp | 4 +- src/game/server/vehicle_baseserver.cpp | 4 +- src/game/server/vehicle_sounds.h | 4 +- src/game/server/vscript_server.cpp | 2 +- src/game/shared/baseentity_shared.cpp | 2 +- src/game/shared/gamemovement.cpp | 2 +- src/game/shared/props_shared.cpp | 4 +- src/game/shared/swarm/asw_marine_shared.cpp | 2 +- src/public/VGuiMatSurface/IMatSystemSurface.h | 10 ++-- .../VGuiMatSurface/IMatSystemSurfaceV5.h | 10 ++-- src/public/client_class.h | 4 +- src/public/dt_recv.cpp | 26 +++++----- src/public/dt_recv.h | 30 ++++++------ src/public/dt_send.cpp | 32 ++++++------- src/public/dt_send.h | 48 +++++++++---------- src/public/dt_utlvector_recv.cpp | 6 +-- src/public/dt_utlvector_recv.h | 4 +- src/public/dt_utlvector_send.cpp | 6 +-- src/public/dt_utlvector_send.h | 4 +- src/public/fgdlib/gdvar.h | 2 +- src/public/fgdlib/inputoutput.h | 2 +- src/public/keyframe/keyframe.cpp | 16 +++---- src/public/server_class.h | 6 +-- src/public/studio.cpp | 4 +- src/public/tier1/interpolatedvar.h | 6 +-- 71 files changed, 241 insertions(+), 237 deletions(-) diff --git a/src/common/language.cpp b/src/common/language.cpp index f1378e47f..716054e2e 100644 --- a/src/common/language.cpp +++ b/src/common/language.cpp @@ -1,4 +1,4 @@ -//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. ======= +//====== Copyright © 1996-2004, Valve Corporation, All rights reserved. ======= // // Purpose: languages definition // @@ -14,9 +14,9 @@ struct Language_t { - char *m_pchName; - char *m_pchShortName; - char *m_pchVGUILocalizationName; + const char *m_pchName; + const char *m_pchShortName; + const char *m_pchVGUILocalizationName; ELanguage m_ELanguage; }; diff --git a/src/fgdlib/gamedata.cpp b/src/fgdlib/gamedata.cpp index 81f522ba4..279cbc535 100644 --- a/src/fgdlib/gamedata.cpp +++ b/src/fgdlib/gamedata.cpp @@ -87,7 +87,7 @@ static bool DoGetToken(TokenReader &tr, char **ppszStore, int nSize, trtoken_t t // We didn't get the expected token type but no expected // string was specified. // - char *pszTokenName; + const char *pszTokenName; switch (ttexpecting) { case IDENT: diff --git a/src/fgdlib/gdvar.cpp b/src/fgdlib/gdvar.cpp index 4a0511a5e..5e69c55af 100644 --- a/src/fgdlib/gdvar.cpp +++ b/src/fgdlib/gdvar.cpp @@ -14,7 +14,7 @@ typedef struct { GDIV_TYPE eType; // The enumeration of this type. - char *pszName; // The name of this type. + const char *pszName; // The name of this type. trtoken_t eStoreAs; // How this type is stored (STRING, INTEGER, etc). } TypeMap_t; @@ -64,7 +64,7 @@ static TypeMap_t TypeMap[] = }; -char *GDinputvariable::m_pszEmpty = ""; +const char *GDinputvariable::m_pszEmpty = ""; //----------------------------------------------------------------------------- diff --git a/src/fgdlib/inputoutput.cpp b/src/fgdlib/inputoutput.cpp index 6c0d65f17..742cb182a 100644 --- a/src/fgdlib/inputoutput.cpp +++ b/src/fgdlib/inputoutput.cpp @@ -15,11 +15,11 @@ typedef struct { InputOutputType_t eType; // The enumeration of this type. - char *pszName; // The name of this type. + const char *pszName; // The name of this type. } TypeMap_t; -char *CClassInputOutputBase::g_pszEmpty = ""; +const char *CClassInputOutputBase::g_pszEmpty = ""; //----------------------------------------------------------------------------- diff --git a/src/game/client/c_baseanimating.cpp b/src/game/client/c_baseanimating.cpp index 52f195b3b..b0c835180 100644 --- a/src/game/client/c_baseanimating.cpp +++ b/src/game/client/c_baseanimating.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -367,7 +367,7 @@ void C_ClientRagdoll::OnRestore( void ) RagdollMoved(); } -void C_ClientRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void C_ClientRagdoll::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { VPROF( "C_ClientRagdoll::ImpactTrace" ); diff --git a/src/game/client/c_baseanimating.h b/src/game/client/c_baseanimating.h index d82ae85f9..c048038cd 100644 --- a/src/game/client/c_baseanimating.h +++ b/src/game/client/c_baseanimating.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -685,7 +685,7 @@ class C_ClientRagdoll : public C_BaseAnimating, public IPVSNotify virtual void Release( void ); virtual void SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightCount, float *pFlexWeights, float *pFlexDelayedWeights ); - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); void ClientThink( void ); void ReleaseRagdoll( void ) { m_bReleaseRagdoll = true; } bool ShouldSavePhysics( void ) { return true; } diff --git a/src/game/client/c_baseentity.h b/src/game/client/c_baseentity.h index 64e477210..b305a404e 100644 --- a/src/game/client/c_baseentity.h +++ b/src/game/client/c_baseentity.h @@ -630,7 +630,7 @@ class C_BaseEntity : public IClientEntity // ID Target handling virtual bool IsValidIDTarget( void ) { return false; } - virtual char *GetIDString( void ) { return ""; }; + virtual const char *GetIDString( void ) { return ""; }; // See CSoundEmitterSystem void EmitSound( const char *soundname, float soundtime = 0.0f, float *duration = NULL ); // Override for doing the general case of CPASAttenuationFilter( this ), and EmitSound( filter, entindex(), etc. ); @@ -899,7 +899,7 @@ class C_BaseEntity : public IClientEntity virtual char const * DamageDecal( int bitsDamageType, int gameMaterial ); virtual void DecalTrace( trace_t *pTrace, char const *decalName ); - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); virtual bool ShouldPredict( void ) { return false; }; // interface function pointers @@ -1255,7 +1255,7 @@ class C_BaseEntity : public IClientEntity #ifdef _DEBUG void FunctionCheck( void *pFunction, const char *name ); - ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name ) + ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name ) { //COMPILE_TIME_ASSERT( sizeof(func) == 4 ); m_pfnTouch = func; diff --git a/src/game/client/c_baseflex.cpp b/src/game/client/c_baseflex.cpp index cb7c2791b..660c9d62a 100644 --- a/src/game/client/c_baseflex.cpp +++ b/src/game/client/c_baseflex.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -1384,7 +1384,7 @@ int C_BaseFlex::g_numflexcontrollers; char * C_BaseFlex::g_flexcontroller[MAXSTUDIOFLEXCTRL*4]; float C_BaseFlex::s_pGlobalFlexWeight[MAXSTUDIOFLEXCTRL*4]; -int C_BaseFlex::AddGlobalFlexController( char *szName ) +int C_BaseFlex::AddGlobalFlexController( const char *szName ) { int i; for (i = 0; i < g_numflexcontrollers; i++) diff --git a/src/game/client/c_baseflex.h b/src/game/client/c_baseflex.h index 4fe3d7dcf..dee873ede 100644 --- a/src/game/client/c_baseflex.h +++ b/src/game/client/c_baseflex.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -92,7 +92,7 @@ class C_BaseFlex : public C_BaseAnimatingOverlay int m_blinktoggle; - static int AddGlobalFlexController( char *szName ); + static int AddGlobalFlexController( const char *szName ); static char const *GetGlobalFlexControllerName( int idx ); // bah, this should be unified with all prev/current stuff. diff --git a/src/game/client/c_baselesson.cpp b/src/game/client/c_baselesson.cpp index ffeed5dc9..e05325d6b 100644 --- a/src/game/client/c_baselesson.cpp +++ b/src/game/client/c_baselesson.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============// // // Purpose: Client handler implementations for instruction players how to play // @@ -1695,7 +1695,7 @@ void CScriptedIconLesson::InitElementsFromKeys( CUtlVector< LessonElement_t > *p pchToken = strtok( szSubKeyName, " " ); _fieldtypes paramType = LessonParamTypeFromString( pchToken ); - char *pchParam = ""; + const char *pchParam = ""; if ( paramType != FIELD_VOID ) { diff --git a/src/game/client/c_baseplayer.cpp b/src/game/client/c_baseplayer.cpp index c76c879a3..c6ae6dac6 100644 --- a/src/game/client/c_baseplayer.cpp +++ b/src/game/client/c_baseplayer.cpp @@ -2170,7 +2170,7 @@ void C_BasePlayer::PlayPlayerJingle() } // Stuff for prediction -void C_BasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeat) +void C_BasePlayer::SetSuitUpdate(const char *name, int fgroup, int iNoRepeat) { // FIXME: Do something here? } diff --git a/src/game/client/c_baseplayer.h b/src/game/client/c_baseplayer.h index 3d4cec161..9b04e6233 100644 --- a/src/game/client/c_baseplayer.h +++ b/src/game/client/c_baseplayer.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: Client-side CBasePlayer. // @@ -126,7 +126,7 @@ class C_BasePlayer : public C_BaseCombatCharacter virtual void Weapon_DropPrimary( void ) {} virtual Vector GetAutoaimVector( float flScale ); - void SetSuitUpdate(char *name, int fgroup, int iNoRepeat); + void SetSuitUpdate(const char *name, int fgroup, int iNoRepeat); // Input handling virtual bool CreateMove( float flInputSampleTime, CUserCmd *pCmd ); diff --git a/src/game/client/clientshadowmgr.cpp b/src/game/client/clientshadowmgr.cpp index 31134b7e4..803d9a182 100644 --- a/src/game/client/clientshadowmgr.cpp +++ b/src/game/client/clientshadowmgr.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -290,12 +290,12 @@ void CTextureAllocator::InitRenderTargets( void ) { #if !defined( _X360 ) // don't need depth buffer for shadows - m_TexturePage.InitRenderTarget( TEXTURE_PAGE_SIZE, TEXTURE_PAGE_SIZE, RT_SIZE_NO_CHANGE, IMAGE_FORMAT_ARGB8888, MATERIAL_RT_DEPTH_NONE, false, "_rt_Shadows" ); + m_TexturePage.InitRenderTarget( TEXTURE_PAGE_SIZE, TEXTURE_PAGE_SIZE, RT_SIZE_NO_CHANGE, IMAGE_FORMAT_ARGB8888, MATERIAL_RT_DEPTH_NONE, false, const_cast( "_rt_Shadows" ) ); #else // unfortunate explicit management required for this render target // 32bpp edram is only largest shadow fragment, but resolved to actual shadow atlas // because full-res 1024x1024 shadow buffer is too large for EDRAM - m_TexturePage.InitRenderTargetTexture( TEXTURE_PAGE_SIZE, TEXTURE_PAGE_SIZE, RT_SIZE_NO_CHANGE, IMAGE_FORMAT_ARGB8888, MATERIAL_RT_DEPTH_NONE, false, "_rt_Shadows" ); + m_TexturePage.InitRenderTargetTexture( TEXTURE_PAGE_SIZE, TEXTURE_PAGE_SIZE, RT_SIZE_NO_CHANGE, IMAGE_FORMAT_ARGB8888, MATERIAL_RT_DEPTH_NONE, false, const_cast( "_rt_Shadows" ) ); #ifdef RTT_TEXTURE_SIZE_640 // use 4x multisampling for smoother shadows @@ -1055,7 +1055,7 @@ class CClientShadowMgr : public IClientShadowMgr // Initialize, shutdown render-to-texture shadows void InitDepthTextureShadows(); void ShutdownDepthTextureShadows(); - friend static void RDMaxDepthTextureShadowsChanged( IConVar *, const char *, float ); + friend void RDMaxDepthTextureShadowsChanged( IConVar *, const char *, float ); // Initialize, shutdown render-to-texture shadows void InitRenderToTextureShadows(); @@ -1667,10 +1667,10 @@ void CClientShadowMgr::InitDepthTextureShadows() #if defined( _X360 ) // For the 360, we'll be rendering depth directly into the dummy depth and Resolve()ing to the depth texture. // only need the dummy surface, don't care about color results - m_DummyColorTexture.InitRenderTargetTexture( 1, 1, RT_SIZE_OFFSCREEN, IMAGE_FORMAT_BGR565, MATERIAL_RT_DEPTH_SHARED, false, "_rt_ShadowDummy" ); + m_DummyColorTexture.InitRenderTargetTexture( 1, 1, RT_SIZE_OFFSCREEN, IMAGE_FORMAT_BGR565, MATERIAL_RT_DEPTH_SHARED, false, const_cast( "_rt_ShadowDummy" ) ); m_DummyColorTexture.InitRenderTargetSurface( m_nDepthTextureResolution, m_nDepthTextureResolution, IMAGE_FORMAT_BGR565, false ); #else - m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" ); + m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, const_cast( "_rt_ShadowDummy" ) ); #endif // Create some number of depth-stencil textures @@ -1808,9 +1808,9 @@ void CClientShadowMgr::InitDeferredShadows() if ( r_shadow_deferred_downsample.GetBool() ) { #if defined( _X360 ) - m_downSampledNormals.InitRenderTargetTexture( DEFERRED_SHADOW_BUFFER_WIDTH, DEFERRED_SHADOW_BUFFER_HEIGHT, RT_SIZE_OFFSCREEN, IMAGE_FORMAT_ARGB8888, MATERIAL_RT_DEPTH_SEPARATE, false, "_rt_DownsampledNormals" ); + m_downSampledNormals.InitRenderTargetTexture( DEFERRED_SHADOW_BUFFER_WIDTH, DEFERRED_SHADOW_BUFFER_HEIGHT, RT_SIZE_OFFSCREEN, IMAGE_FORMAT_ARGB8888, MATERIAL_RT_DEPTH_SEPARATE, false, const_cast( "_rt_DownsampledNormals" ) ); m_downSampledNormals.InitRenderTargetSurface( DEFERRED_SHADOW_BUFFER_WIDTH, DEFERRED_SHADOW_BUFFER_HEIGHT, IMAGE_FORMAT_ARGB8888, true ); - m_downSampledDepth.InitRenderTargetTexture( DEFERRED_SHADOW_BUFFER_WIDTH, DEFERRED_SHADOW_BUFFER_HEIGHT, RT_SIZE_OFFSCREEN, IMAGE_FORMAT_D24FS8, MATERIAL_RT_DEPTH_NONE, false, "_rt_DownsampledDepth" ); + m_downSampledDepth.InitRenderTargetTexture( DEFERRED_SHADOW_BUFFER_WIDTH, DEFERRED_SHADOW_BUFFER_HEIGHT, RT_SIZE_OFFSCREEN, IMAGE_FORMAT_D24FS8, MATERIAL_RT_DEPTH_NONE, false, const_cast( "_rt_DownsampledDepth" ) ); #endif } } diff --git a/src/game/client/entity_client_tools.cpp b/src/game/client/entity_client_tools.cpp index 80e5dca64..f182c06c2 100644 --- a/src/game/client/entity_client_tools.cpp +++ b/src/game/client/entity_client_tools.cpp @@ -1,4 +1,4 @@ -//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= +//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= // // Purpose: // @@ -887,9 +887,10 @@ void CClientTools::ReloadParticleDefintions( const char *pFileName, const void * ////////////// // Find any systems that depend on any system in the buffer // slow, but necessary if we want live reloads to work - and doesn't happen too often + CUtlBuffer bufConfig( pBufData, nLen, CUtlBuffer::READ_ONLY ); CUtlVector systemNamesToReload; - g_pParticleSystemMgr->GetParticleSystemsInBuffer( CUtlBuffer(pBufData, nLen, CUtlBuffer::READ_ONLY), &systemNamesToReload ); + g_pParticleSystemMgr->GetParticleSystemsInBuffer( bufConfig, &systemNamesToReload ); CUtlVector toReplaceEffects; CUtlVector toReplaceNames; @@ -929,7 +930,8 @@ void CClientTools::ReloadParticleDefintions( const char *pFileName, const void * ////////////// // Load the data and stomp the old definitions - g_pParticleSystemMgr->ReadParticleConfigFile( CUtlBuffer(pBufData, nLen, CUtlBuffer::READ_ONLY), true ); + CUtlBuffer bufLoadConfig( pBufData, nLen, CUtlBuffer::READ_ONLY ); + g_pParticleSystemMgr->ReadParticleConfigFile( bufLoadConfig, true ); ////////////// // Now replace all of the systems with their new versions diff --git a/src/game/client/game_controls/SpectatorGUI.cpp b/src/game/client/game_controls/SpectatorGUI.cpp index de80a6b29..3bc539141 100644 --- a/src/game/client/game_controls/SpectatorGUI.cpp +++ b/src/game/client/game_controls/SpectatorGUI.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -52,7 +52,7 @@ ConVar spec_scoreboard( "spec_scoreboard", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE CSpectatorGUI *g_pSpectatorGUI = NULL; -static char *s_SpectatorModes[] = { "#Spec_Mode0", "#Spec_Mode1", "#Spec_Mode2", "#Spec_Mode3", "#Spec_Mode4", "#Spec_Mode5", "" }; +static const char *s_SpectatorModes[] = { "#Spec_Mode0", "#Spec_Mode1", "#Spec_Mode2", "#Spec_Mode3", "#Spec_Mode4", "#Spec_Mode5", "" }; using namespace vgui; diff --git a/src/game/client/hud.cpp b/src/game/client/hud.cpp index 317778c5a..221028bbe 100644 --- a/src/game/client/hud.cpp +++ b/src/game/client/hud.cpp @@ -35,7 +35,7 @@ static CClassMemoryPool< CHudTexture > g_HudTextureMemoryPool( 128 ); //----------------------------------------------------------------------------- // Purpose: Parses the weapon txt files to get the sprites needed. //----------------------------------------------------------------------------- -void LoadHudTextures( CUtlDict< CHudTexture *, int >& list, char *szFilenameWithoutExtension, const unsigned char *pICEKey ) +void LoadHudTextures( CUtlDict< CHudTexture *, int >& list, const char *szFilenameWithoutExtension, const unsigned char *pICEKey ) { KeyValues *pTemp, *pTextureSection; diff --git a/src/game/client/hud.h b/src/game/client/hud.h index f70db252f..a6612ccd8 100644 --- a/src/game/client/hud.h +++ b/src/game/client/hud.h @@ -251,7 +251,7 @@ CHudIcons &HudIcons(); //----------------------------------------------------------------------------- extern vgui::HFont g_hFontTrebuchet24; -void LoadHudTextures( CUtlDict< CHudTexture *, int >& list, char *szFilenameWithoutExtension, const unsigned char *pICEKey ); +void LoadHudTextures( CUtlDict< CHudTexture *, int >& list, const char *szFilenameWithoutExtension, const unsigned char *pICEKey ); void GetHudSize( int& w, int &h ); diff --git a/src/game/client/physpropclientside.cpp b/src/game/client/physpropclientside.cpp index 67fc50aaf..49603e46a 100644 --- a/src/game/client/physpropclientside.cpp +++ b/src/game/client/physpropclientside.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -509,7 +509,7 @@ void C_PhysPropClientside::Clone( Vector &velocity ) } } -void C_PhysPropClientside::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void C_PhysPropClientside::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { VPROF( "C_PhysPropClientside::ImpactTrace" ); IPhysicsObject *pPhysicsObject = VPhysicsGetObject(); diff --git a/src/game/client/physpropclientside.h b/src/game/client/physpropclientside.h index 070a3913b..55286d2ef 100644 --- a/src/game/client/physpropclientside.h +++ b/src/game/client/physpropclientside.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -30,7 +30,7 @@ class C_PhysPropClientside : public C_BreakableProp, public IBreakableWithPropDa virtual CollideType_t GetCollideType( void ) { return ENTITY_SHOULD_RESPOND; } virtual void StartTouch( C_BaseEntity *pOther ); virtual void HitSurface( C_BaseEntity *pOther ); - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); virtual bool IsClientCreated( void ) const { return true; } virtual int GetMultiplayerPhysicsMode() { return m_iPhysicsMode; } virtual float GetMass(); diff --git a/src/game/client/recvproxy.cpp b/src/game/client/recvproxy.cpp index 8bde844ca..9b400b417 100644 --- a/src/game/client/recvproxy.cpp +++ b/src/game/client/recvproxy.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: implements various common send proxies // @@ -24,7 +24,7 @@ void RecvProxy_ShortSubOne( const CRecvProxyData *pData, void *pStruct, void *pO *pInt = pData->m_Value.m_Int - 1; } -RecvProp RecvPropIntWithMinusOneFlag( char *pVarName, int offset, int sizeofVar, RecvVarProxyFn proxyFn ) +RecvProp RecvPropIntWithMinusOneFlag( const char *pVarName, int offset, int sizeofVar, RecvVarProxyFn proxyFn ) { return RecvPropInt( pVarName, offset, sizeofVar, 0, proxyFn ); } @@ -60,7 +60,7 @@ void RecvProxy_IntToEHandle( const CRecvProxyData *pData, void *pStruct, void *p } RecvProp RecvPropEHandle( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, RecvVarProxyFn proxyFn ) @@ -70,7 +70,7 @@ RecvProp RecvPropEHandle( RecvProp RecvPropBool( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ) { @@ -136,7 +136,7 @@ static void RecvProxy_Time( const CRecvProxyData *pData, void *pStruct, void *pO // Output : RecvProp //----------------------------------------------------------------------------- RecvProp RecvPropTime( - char *pVarName, + const char *pVarName, int offset, int sizeofVar/*=SIZEOF_IGNORE*/ ) { @@ -171,7 +171,7 @@ static void RecvProxy_IntToPredictableId( const CRecvProxyData *pData, void *pSt // Output : RecvProp //----------------------------------------------------------------------------- RecvProp RecvPropPredictableId( - char *pVarName, + const char *pVarName, int offset, int sizeofVar/*=SIZEOF_IGNORE*/ ) { diff --git a/src/game/client/recvproxy.h b/src/game/client/recvproxy.h index 9a4899001..db41e1e93 100644 --- a/src/game/client/recvproxy.h +++ b/src/game/client/recvproxy.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: implements various common send proxies // @@ -24,30 +24,30 @@ void RecvProxy_ShortSubOne( const CRecvProxyData *pData, void *pStruct, void *pO void RecvProxy_InterpolationAmountChanged( const CRecvProxyData *pData, void *pStruct, void *pOut ); RecvProp RecvPropTime( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE ); #if !defined( NO_ENTITY_PREDICTION ) && defined( USE_PREDICTABLEID ) RecvProp RecvPropPredictableId( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE ); #endif RecvProp RecvPropEHandle( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, RecvVarProxyFn proxyFn=RecvProxy_IntToEHandle ); RecvProp RecvPropBool( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ); RecvProp RecvPropIntWithMinusOneFlag( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, RecvVarProxyFn proxyFn=RecvProxy_IntSubOne ); diff --git a/src/game/client/swarm/c_asw_door.cpp b/src/game/client/swarm/c_asw_door.cpp index 504f3f4e1..caab9d6e7 100644 --- a/src/game/client/swarm/c_asw_door.cpp +++ b/src/game/client/swarm/c_asw_door.cpp @@ -280,7 +280,7 @@ void C_ASW_Door::OnDataChanged( DataUpdateType_t type ) } } -void C_ASW_Door::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void C_ASW_Door::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { Assert( pTrace->m_pEnt ); diff --git a/src/game/client/swarm/c_asw_door.h b/src/game/client/swarm/c_asw_door.h index 359ae9387..2e08fb9fc 100644 --- a/src/game/client/swarm/c_asw_door.h +++ b/src/game/client/swarm/c_asw_door.h @@ -23,7 +23,7 @@ class C_ASW_Door : public C_BasePropDoor virtual void OnDataChanged( DataUpdateType_t type ); Class_T Classify( void ) { return (Class_T) CLASS_ASW_DOOR; } - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); Vector GetWeldFacingPoint( C_BaseEntity* pOther ); // the point a marine should look to weld this door Vector GetSparkNormal( C_BaseEntity* pOther ); // the angle sparks should shoot out when welding diff --git a/src/game/client/swarm/c_asw_marine.cpp b/src/game/client/swarm/c_asw_marine.cpp index 4e9b69c6d..22bd170bb 100644 --- a/src/game/client/swarm/c_asw_marine.cpp +++ b/src/game/client/swarm/c_asw_marine.cpp @@ -2536,7 +2536,7 @@ void C_ASW_Marine::RemoveBackpack() } } -void C_ASW_Marine::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void C_ASW_Marine::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { // do nothing // effects re handled in TraceAttack in the shared file diff --git a/src/game/client/swarm/c_asw_steamstats.cpp b/src/game/client/swarm/c_asw_steamstats.cpp index 164753290..b888bc004 100644 --- a/src/game/client/swarm/c_asw_steamstats.cpp +++ b/src/game/client/swarm/c_asw_steamstats.cpp @@ -1214,7 +1214,7 @@ bool DifficultyStats_t::FetchDifficultyStats( CSteamID playerSteamID, int iDiffi return false; bool bOK = true; - char* szDifficulty = NULL; + const char* szDifficulty = NULL; switch( iDifficulty ) { @@ -1273,7 +1273,7 @@ void DifficultyStats_t::PrepStatsForSend( CASW_Player *pPlayer ) m_fGamesSuccessPercent = m_iGamesSuccess / (float)m_iGamesTotal * 100.0f; } } - char* szDifficulty = NULL; + const char* szDifficulty = NULL; int iDifficulty = ASWGameRules()->GetSkillLevel(); switch( iDifficulty ) diff --git a/src/game/client/swarm/gameui/createmultiplayergameserverpage.cpp b/src/game/client/swarm/gameui/createmultiplayergameserverpage.cpp index 83d8b38c7..dc06838ca 100644 --- a/src/game/client/swarm/gameui/createmultiplayergameserverpage.cpp +++ b/src/game/client/swarm/gameui/createmultiplayergameserverpage.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -143,6 +143,8 @@ void CCreateMultiplayerGameServerPage::LoadMaps( const char *pszPathID ) while ( pszFilename ) { char mapname[256]; + const char *str; + char *ext; // FindFirst ignores the pszPathID, so check it here // TODO: this doesn't find maps in fallback dirs @@ -154,7 +156,7 @@ void CCreateMultiplayerGameServerPage::LoadMaps( const char *pszPathID ) // remove the text 'maps/' and '.bsp' from the file name to get the map name - const char *str = Q_strstr( pszFilename, "maps" ); + str = Q_strstr( pszFilename, "maps" ); if ( str ) { Q_strncpy( mapname, str + 5, sizeof(mapname) - 1 ); // maps + \\ = 5 @@ -163,7 +165,7 @@ void CCreateMultiplayerGameServerPage::LoadMaps( const char *pszPathID ) { Q_strncpy( mapname, pszFilename, sizeof(mapname) - 1 ); } - char *ext = Q_strstr( mapname, ".bsp" ); + ext = Q_strstr( mapname, ".bsp" ); if ( ext ) { *ext = 0; diff --git a/src/game/client/swarm/gameui/optionssubkeyboard.cpp b/src/game/client/swarm/gameui/optionssubkeyboard.cpp index 05d705dfe..75758b1fd 100644 --- a/src/game/client/swarm/gameui/optionssubkeyboard.cpp +++ b/src/game/client/swarm/gameui/optionssubkeyboard.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -197,7 +197,7 @@ static char *UTIL_CopyString( const char *in ) return out; } -char *UTIL_va(char *format, ...) +char *UTIL_va(const char *format, ...) { va_list argptr; static char string[4][1024]; diff --git a/src/game/client/swarm/gameui/optionssubmultiplayer.cpp b/src/game/client/swarm/gameui/optionssubmultiplayer.cpp index 3e49179a2..8d0eb321d 100644 --- a/src/game/client/swarm/gameui/optionssubmultiplayer.cpp +++ b/src/game/client/swarm/gameui/optionssubmultiplayer.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -76,7 +76,7 @@ void UpdateLogoWAD( void *hdib, int r, int g, int b ); struct ColorItem_t { - char *name; + const char *name; int r, g, b; }; @@ -1739,9 +1739,9 @@ ConversionErrorType COptionsSubMultiplayer::ConvertTGAToVTF(const char *tgaPath) char *vtfParams[4]; // the 0th entry is skipped cause normally thats the program name. - vtfParams[0] = ""; - vtfParams[1] = "-quiet"; - vtfParams[2] = "-dontusegamedir"; + vtfParams[0] = (char *)""; + vtfParams[1] = (char *)"-quiet"; + vtfParams[2] = (char *)"-dontusegamedir"; vtfParams[3] = (char *)tgaPath; // call vtex to do the conversion. diff --git a/src/game/client/swarm/gameui/scriptobject.cpp b/src/game/client/swarm/gameui/scriptobject.cpp index 173c31de7..7c428d046 100644 --- a/src/game/client/swarm/gameui/scriptobject.cpp +++ b/src/game/client/swarm/gameui/scriptobject.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -860,7 +860,7 @@ bool CDescription::ReadFromBuffer( const char **pBuffer ) return true; } -bool CDescription::InitFromFile( char *pszFileName ) +bool CDescription::InitFromFile( const char *pszFileName ) { // Load file into memory diff --git a/src/game/client/swarm/gameui/scriptobject.h b/src/game/client/swarm/gameui/scriptobject.h index ad9977d25..bf7785e10 100644 --- a/src/game/client/swarm/gameui/scriptobject.h +++ b/src/game/client/swarm/gameui/scriptobject.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -90,7 +90,7 @@ abstract_class CDescription virtual ~CDescription(); bool ReadFromBuffer( const char **pBuffer ); - bool InitFromFile( char *pszFileName ); + bool InitFromFile( const char *pszFileName ); void TransferCurrentValues( const char *pszConfigFile ); void AddObject( CScriptObject *pItem ); diff --git a/src/game/client/swarm/gameui/swarm/vaddons.cpp b/src/game/client/swarm/gameui/swarm/vaddons.cpp index 62aa2df01..18832093e 100644 --- a/src/game/client/swarm/gameui/swarm/vaddons.cpp +++ b/src/game/client/swarm/gameui/swarm/vaddons.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -505,7 +505,7 @@ void Addons::Activate() m_GplAddons->RemoveAllPanelItems(); m_addonInfoList.RemoveAll(); - m_pAddonList ? m_pAddonList->deleteThis() : NULL; + if ( m_pAddonList ) { m_pAddonList->deleteThis(); } // // Get the list of addons @@ -1205,9 +1205,9 @@ Addons::ConversionErrorType Addons::ConvertTGAToVTF( const char *tgaPath ) char *vtfParams[4]; // the 0th entry is skipped cause normally thats the program name. - vtfParams[0] = ""; - vtfParams[1] = "-quiet"; - vtfParams[2] = "-dontusegamedir"; + vtfParams[0] = (char *)""; + vtfParams[1] = (char *)"-quiet"; + vtfParams[2] = (char *)"-dontusegamedir"; vtfParams[3] = ( char * )tgaPath; // call vtex to do the conversion. diff --git a/src/game/client/swarm/gameui/swarm/vhybridbutton.cpp b/src/game/client/swarm/gameui/swarm/vhybridbutton.cpp index dd3790edf..b78c9b797 100644 --- a/src/game/client/swarm/gameui/swarm/vhybridbutton.cpp +++ b/src/game/client/swarm/gameui/swarm/vhybridbutton.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -45,7 +45,7 @@ void Demo_DisableButton( Button *pButton ) pHybridButton->SetEnabled( false ); char szTooltip[512]; - wchar_t *wUnicode = g_pVGuiLocalize->Find( "#L4D360UI_MainMenu_DemoVersion" ); + const wchar_t *wUnicode = g_pVGuiLocalize->Find( "#L4D360UI_MainMenu_DemoVersion" ); if ( !wUnicode ) wUnicode = L""; @@ -64,7 +64,7 @@ void Dlc1_DisableButton( Button *pButton ) pHybridButton->SetEnabled( false ); char szTooltip[512]; - wchar_t *wUnicode = g_pVGuiLocalize->Find( "#L4D360UI_DLC1_NotInstalled" ); + const wchar_t *wUnicode = g_pVGuiLocalize->Find( "#L4D360UI_DLC1_NotInstalled" ); if ( !wUnicode ) wUnicode = L""; diff --git a/src/game/client/swarm/gameui/swarm/vmultiplayer.cpp b/src/game/client/swarm/gameui/swarm/vmultiplayer.cpp index 03a5617ac..98822b973 100644 --- a/src/game/client/swarm/gameui/swarm/vmultiplayer.cpp +++ b/src/game/client/swarm/gameui/swarm/vmultiplayer.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -520,7 +520,7 @@ void Multiplayer::OnCommand(const char *command) } else { - char *pchCustomPath = ( ( m_nSpraypaint[ iLogo ].m_bCustom ) ? ( MULTIPLAYER_CUSTOM_SPRAY_FOLDER ) : ( "" ) ); + const char *pchCustomPath = ( ( m_nSpraypaint[ iLogo ].m_bCustom ) ? ( MULTIPLAYER_CUSTOM_SPRAY_FOLDER ) : ( "" ) ); char rootFilename[MAX_PATH]; Q_snprintf( rootFilename, sizeof(rootFilename), MULTIPLAYER_SPRAY_FOLDER "%s%s.vtf", pchCustomPath, m_nSpraypaint[ iLogo ].m_szFilename ); diff --git a/src/game/client/swarm/vgui/objectivepanel.cpp b/src/game/client/swarm/vgui/objectivepanel.cpp index 51b7bb0fc..4371c7a9f 100644 --- a/src/game/client/swarm/vgui/objectivepanel.cpp +++ b/src/game/client/swarm/vgui/objectivepanel.cpp @@ -16,7 +16,7 @@ ObjectivePanel::ObjectivePanel(Panel *parent, const char *name) : Panel(parent, m_ObjectiveImagePanel->SetShouldScaleImage(true); // create the blank objective text - note, label isn't actually a child of this class! - wchar_t *text = L""; + const wchar_t *text = L""; m_ObjectiveLabel = new vgui::WrappedLabel(this, "ObjectivePanelLabel", text); m_ObjectiveLabel->SetContentAlignment(vgui::Label::a_northwest); diff --git a/src/game/client/swarm/vgui/objectivetitlepanel.cpp b/src/game/client/swarm/vgui/objectivetitlepanel.cpp index 1a9947f01..411ebcf62 100644 --- a/src/game/client/swarm/vgui/objectivetitlepanel.cpp +++ b/src/game/client/swarm/vgui/objectivetitlepanel.cpp @@ -31,7 +31,7 @@ ObjectiveTitlePanel::ObjectiveTitlePanel( Panel *parent, const char *name ) : Pa m_ObjectiveImagePanel->SetMouseInputEnabled( false ); // create the blank objective text - note, label isn't actually a child of this class! - wchar_t *text = L""; + const wchar_t *text = L""; m_ObjectiveLabel = new vgui::Label( this, "ObjectiveTitlePanelLabel", text ); m_ObjectiveLabel->SetContentAlignment( vgui::Label::a_northwest ); m_ObjectiveLabel->SetMouseInputEnabled( false ); @@ -143,7 +143,7 @@ void ObjectiveTitlePanel::UpdateElements() wchar_t wnumber[8]; g_pVGuiLocalize->ConvertANSIToUnicode( buffer, wnumber, sizeof( wnumber ) ); - wchar_t *pLocal = g_pVGuiLocalize->Find( "#asw_objective_titlef" ); + const wchar_t *pLocal = g_pVGuiLocalize->Find( "#asw_objective_titlef" ); if ( !pLocal ) pLocal = L""; g_pVGuiLocalize->ConstructString( buffer2, sizeof( buffer2 ), diff --git a/src/game/client/text_message.cpp b/src/game/client/text_message.cpp index 27672b859..6e470d873 100644 --- a/src/game/client/text_message.cpp +++ b/src/game/client/text_message.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -121,7 +121,7 @@ char *CHudTextMessage::BufferedLocaliseTextString( const char *msg ) char *CHudTextMessage::LookupString( const char *msg, int *msg_dest ) { if ( !msg ) - return ""; + return (char *)""; // '#' character indicates this is a reference to a string in titles.txt, and not the string itself if ( msg[0] == '#' ) diff --git a/src/game/server/globalstate.cpp b/src/game/server/globalstate.cpp index ec6b96428..60395fd1d 100644 --- a/src/game/server/globalstate.cpp +++ b/src/game/server/globalstate.cpp @@ -235,7 +235,7 @@ CON_COMMAND_F(dump_globals, "Dump all global entities/states", FCVAR_CHEAT) //#ifdef _DEBUG void CGlobalState::DumpGlobals( void ) { - static char *estates[] = { "Off", "On", "Dead" }; + static const char *estates[] = { "Off", "On", "Dead" }; Msg( "-- Globals --\n" ); for ( int i = 0; i < m_list.Count(); i++ ) diff --git a/src/game/server/hl2/npc_basescanner.h b/src/game/server/hl2/npc_basescanner.h index b3f10d703..94bf8322f 100644 --- a/src/game/server/hl2/npc_basescanner.h +++ b/src/game/server/hl2/npc_basescanner.h @@ -97,7 +97,7 @@ class CNPC_BaseScanner : public CAI_BasePhysicsFlyingBot void DeathSound( const CTakeDamageInfo &info ); void AlertSound( void ); void PainSound( const CTakeDamageInfo &info ); - virtual char *GetScannerSoundPrefix( void ) { return ""; } + virtual const char *GetScannerSoundPrefix( void ) { return ""; } void ScannerEmitSound( const char *pszSoundName ); int MeleeAttack1Conditions ( float flDot, float flDist ); @@ -121,7 +121,7 @@ class CNPC_BaseScanner : public CAI_BasePhysicsFlyingBot void InputSetDistanceOverride( inputdata_t &inputdata ); protected: - virtual char *GetEngineSound( void ) { return NULL; } + virtual const char *GetEngineSound( void ) { return NULL; } void PlayFlySound(void); void SetBanking( float flInterval ); diff --git a/src/game/server/hl2/npc_bullseye.cpp b/src/game/server/hl2/npc_bullseye.cpp index e5aa58f72..0ddb5f1bc 100644 --- a/src/game/server/hl2/npc_bullseye.cpp +++ b/src/game/server/hl2/npc_bullseye.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Bullseyes act as targets for other NPC's to attack and to trigger // events @@ -278,7 +278,7 @@ void CNPC_Bullseye::DecalTrace( trace_t *pOldTrace, char const *decalName ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CNPC_Bullseye::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void CNPC_Bullseye::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { // Get direction of original trace Vector vTraceDir = pTrace->endpos - pTrace->startpos; diff --git a/src/game/server/netpropmanager.cpp b/src/game/server/netpropmanager.cpp index a9fe9982c..6ba2c3462 100644 --- a/src/game/server/netpropmanager.cpp +++ b/src/game/server/netpropmanager.cpp @@ -17,7 +17,7 @@ extern void SendProxy_StringT_To_String( const SendProp *pProp, const void *pStruct, const void *pVarData, DVariant *pOut, int iElement, int objectID ); -extern char *s_ElementNames[MAX_ARRAY_ELEMENTS]; +extern const char *s_ElementNames[MAX_ARRAY_ELEMENTS]; extern ISaveRestoreOps* ActivityDataOps(); //----------------------------------------------------------------------------- diff --git a/src/game/server/sendproxy.cpp b/src/game/server/sendproxy.cpp index 3f9d2eb2b..f6678d520 100644 --- a/src/game/server/sendproxy.cpp +++ b/src/game/server/sendproxy.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: implements various common send proxies // @@ -51,7 +51,7 @@ void SendProxy_ShortAddOne( const SendProp *pProp, const void *pStruct, const vo } SendProp SendPropBool( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ) { @@ -61,7 +61,7 @@ SendProp SendPropBool( SendProp SendPropEHandle( - char *pVarName, + const char *pVarName, int offset, int flags, int sizeofVar, @@ -70,7 +70,7 @@ SendProp SendPropEHandle( return SendPropInt( pVarName, offset, sizeofVar, NUM_NETWORKED_EHANDLE_BITS, SPROP_UNSIGNED|flags, proxyFn ); } -SendProp SendPropIntWithMinusOneFlag( char *pVarName, int offset, int sizeofVar, int nBits, SendVarProxyFn proxyFn ) +SendProp SendPropIntWithMinusOneFlag( const char *pVarName, int offset, int sizeofVar, int nBits, SendVarProxyFn proxyFn ) { return SendPropInt( pVarName, offset, sizeofVar, nBits, SPROP_UNSIGNED, proxyFn ); } @@ -129,7 +129,7 @@ static void SendProxy_Time( const SendProp *pProp, const void *pStruct, const vo // Output : SendProp //----------------------------------------------------------------------------- SendProp SendPropTime( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ) { @@ -171,7 +171,7 @@ static void SendProxy_PredictableIdToInt( const SendProp *pProp, const void *pSt // Output : SendProp //----------------------------------------------------------------------------- SendProp SendPropPredictableId( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ) { @@ -187,7 +187,7 @@ void SendProxy_StringT_To_String( const SendProp *pProp, const void *pStruct, co } -SendProp SendPropStringT( char *pVarName, int offset, int sizeofVar ) +SendProp SendPropStringT( const char *pVarName, int offset, int sizeofVar ) { // Make sure it's the right type. Assert( sizeofVar == sizeof( string_t ) ); diff --git a/src/game/server/sendproxy.h b/src/game/server/sendproxy.h index 60bfb3ad0..3b8540d56 100644 --- a/src/game/server/sendproxy.h +++ b/src/game/server/sendproxy.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: implements various common send proxies // @@ -20,31 +20,31 @@ void SendProxy_IntAddOne( const SendProp *pProp, const void *pStruct, const void void SendProxy_ShortAddOne( const SendProp *pProp, const void *pStruct, const void *pVarData, DVariant *pOut, int iElement, int objectID ); SendProp SendPropBool( - char *pVarName, + const char *pVarName, int offset, int sizeofVar ); SendProp SendPropEHandle( - char *pVarName, + const char *pVarName, int offset, int flags = 0, int sizeofVar=SIZEOF_IGNORE, SendVarProxyFn proxyFn=SendProxy_EHandleToInt ); SendProp SendPropTime( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE ); #if !defined( NO_ENTITY_PREDICTION ) && defined( USE_PREDICTABLEID ) SendProp SendPropPredictableId( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE ); #endif SendProp SendPropIntWithMinusOneFlag( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int bits=-1, @@ -52,7 +52,7 @@ SendProp SendPropIntWithMinusOneFlag( // Send a string_t as a string property. -SendProp SendPropStringT( char *pVarName, int offset, int sizeofVar ); +SendProp SendPropStringT( const char *pVarName, int offset, int sizeofVar ); //----------------------------------------------------------------------------- // Purpose: Proxy that only sends data to team members diff --git a/src/game/server/skyboxswapper.cpp b/src/game/server/skyboxswapper.cpp index 4caac47d1..df400e5e5 100644 --- a/src/game/server/skyboxswapper.cpp +++ b/src/game/server/skyboxswapper.cpp @@ -57,7 +57,7 @@ void CSkyboxSwapper::Precache( void ) } char name[ MAX_PATH ]; - char *skyboxsuffix[ 6 ] = { "rt", "bk", "lf", "ft", "up", "dn" }; + const char *skyboxsuffix[ 6 ] = { "rt", "bk", "lf", "ft", "up", "dn" }; for ( int i = 0; i < 6; i++ ) { Q_snprintf( name, sizeof( name ), "skybox/%s%s", m_iszSkyboxName.ToCStr(), skyboxsuffix[i] ); diff --git a/src/game/server/swarm/asw_env_explosion.cpp b/src/game/server/swarm/asw_env_explosion.cpp index c0a24c0df..890316d0b 100644 --- a/src/game/server/swarm/asw_env_explosion.cpp +++ b/src/game/server/swarm/asw_env_explosion.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Implements an explosion entity and a support spark shower entity. // @@ -243,7 +243,7 @@ void ASWExplosionCreate( const Vector ¢er, const QAngle &angles, CASWEnvExplosion *pExplosion = (CASWEnvExplosion*)CBaseEntity::Create( "asw_env_explosion", center, angles, pOwner ); Q_snprintf( buf,sizeof(buf), "%3d", magnitude ); - char *szKeyName = "iDamage"; + const char *szKeyName = "iDamage"; char *szValue = buf; pExplosion->KeyValue( szKeyName, szValue ); diff --git a/src/game/server/textstatsmgr.cpp b/src/game/server/textstatsmgr.cpp index b51fa2646..f1138a840 100644 --- a/src/game/server/textstatsmgr.cpp +++ b/src/game/server/textstatsmgr.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -58,7 +58,7 @@ char *CTextStatsMgr::GetStatsFilename( void ) return m_szStatFilename; } -void CTextStatsMgr::SetStatsFilename( char *sFilename ) +void CTextStatsMgr::SetStatsFilename( const char *sFilename ) { Assert( sFilename && sFilename[0] ); diff --git a/src/game/server/textstatsmgr.h b/src/game/server/textstatsmgr.h index ce2178196..517dd1682 100644 --- a/src/game/server/textstatsmgr.h +++ b/src/game/server/textstatsmgr.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -34,7 +34,7 @@ class CTextStatsMgr char *GetStatsFilename( void ); // Set the filename to write stats to, if none is specified when writing - void SetStatsFilename( char *sFilename ); + void SetStatsFilename( const char *sFilename ); private: char m_szStatFilename[ MAX_PATH ]; diff --git a/src/game/server/util.cpp b/src/game/server/util.cpp index cb621525f..49116eb44 100644 --- a/src/game/server/util.cpp +++ b/src/game/server/util.cpp @@ -1474,7 +1474,7 @@ Vector UTIL_RandomBloodVector( void ) // Input : // Output : //------------------------------------------------------------------------------ -void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { CBaseEntity *pEntity = pTrace->m_pEnt; @@ -1853,7 +1853,7 @@ void UTIL_PrecacheOther( const char *szClassname, const char *modelName ) // UTIL_LogPrintf - Prints a logged message to console. // Preceded by LOG: ( timestamp ) < message > //========================================================= -void UTIL_LogPrintf( char *fmt, ... ) +void UTIL_LogPrintf( const char *fmt, ... ) { if ( !g_bIsLogging ) return; diff --git a/src/game/server/vehicle_baseserver.cpp b/src/game/server/vehicle_baseserver.cpp index fe33291fa..a30b818e6 100644 --- a/src/game/server/vehicle_baseserver.cpp +++ b/src/game/server/vehicle_baseserver.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -2591,7 +2591,7 @@ vehiclesound g_iSoundsToStopOnExit[] = VS_ENGINE2_STOP, }; -char *vehiclesound_parsenames[VS_NUM_SOUNDS] = +const char *vehiclesound_parsenames[VS_NUM_SOUNDS] = { "skid_lowfriction", "skid_normalfriction", diff --git a/src/game/server/vehicle_sounds.h b/src/game/server/vehicle_sounds.h index fc8beac9a..41a99d636 100644 --- a/src/game/server/vehicle_sounds.h +++ b/src/game/server/vehicle_sounds.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -30,7 +30,7 @@ enum vehiclesound VS_NUM_SOUNDS, }; -extern char *vehiclesound_parsenames[VS_NUM_SOUNDS]; +extern const char *vehiclesound_parsenames[VS_NUM_SOUNDS]; // This is a list of vehiclesounds to automatically stop when the vehicle's driver exits the vehicle #define NUM_SOUNDS_TO_STOP_ON_EXIT 4 diff --git a/src/game/server/vscript_server.cpp b/src/game/server/vscript_server.cpp index a013a3553..e97bad0d8 100644 --- a/src/game/server/vscript_server.cpp +++ b/src/game/server/vscript_server.cpp @@ -47,7 +47,7 @@ extern ScriptClassDesc_t * GetScriptDesc( CBaseEntity * ); #endif // VMPROFILE static ConVar sv_mapspawn_nut_exec( "sv_mapspawn_nut_exec", "0", FCVAR_NONE, "If set to 1, server will execute scripts/vscripts/mapspawn.nut file" ); -extern char *s_ElementNames[MAX_ARRAY_ELEMENTS]; +extern const char *s_ElementNames[MAX_ARRAY_ELEMENTS]; constexpr int CLAMP_COLOR(int value) { diff --git a/src/game/shared/baseentity_shared.cpp b/src/game/shared/baseentity_shared.cpp index de8191571..4192c13e2 100644 --- a/src/game/shared/baseentity_shared.cpp +++ b/src/game/shared/baseentity_shared.cpp @@ -741,7 +741,7 @@ void CBaseEntity::DecalTrace( trace_t *pTrace, char const *decalName ) //----------------------------------------------------------------------------- // Purpose: Base handling for impacts against entities //----------------------------------------------------------------------------- -void CBaseEntity::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void CBaseEntity::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { VPROF( "CBaseEntity::ImpactTrace" ); Assert( pTrace->m_pEnt ); diff --git a/src/game/shared/gamemovement.cpp b/src/game/shared/gamemovement.cpp index e61ee1cc4..4c4563c3c 100644 --- a/src/game/shared/gamemovement.cpp +++ b/src/game/shared/gamemovement.cpp @@ -604,7 +604,7 @@ void COM_Log( char *pszFile, char *fmt, ...) va_list argptr; char string[1024]; FileHandle_t fp; - char *pfilename; + const char *pfilename; if ( !pszFile ) { diff --git a/src/game/shared/props_shared.cpp b/src/game/shared/props_shared.cpp index 33eee92d7..7d0e447ca 100644 --- a/src/game/shared/props_shared.cpp +++ b/src/game/shared/props_shared.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: static_prop - don't move, don't animate, don't do anything. // physics_prop - move, take damage, but don't animate @@ -705,7 +705,7 @@ const char *GetMassEquivalent(float flMass) static struct { float flMass; - char *sz; + const char *sz; } masstext[] = { { 5e-6, "snowflake" }, diff --git a/src/game/shared/swarm/asw_marine_shared.cpp b/src/game/shared/swarm/asw_marine_shared.cpp index 0a60b1ce1..828a047cd 100644 --- a/src/game/shared/swarm/asw_marine_shared.cpp +++ b/src/game/shared/swarm/asw_marine_shared.cpp @@ -467,7 +467,7 @@ int CASW_Marine::GetAllAmmoCount( void ) } // include ammo in weapons this marine is carrying -int CASW_Marine::GetTotalAmmoCount( char *szName ) +int CASW_Marine::GetTotalAmmoCount( const char *szName ) { return GetTotalAmmoCount( GetAmmoDef()->Index(szName) ); } diff --git a/src/public/VGuiMatSurface/IMatSystemSurface.h b/src/public/VGuiMatSurface/IMatSystemSurface.h index 59d654570..4491825b7 100644 --- a/src/public/VGuiMatSurface/IMatSystemSurface.h +++ b/src/public/VGuiMatSurface/IMatSystemSurface.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: An extra interface implemented by the material system // implementation of vgui::ISurface @@ -77,14 +77,14 @@ class IMatSystemSurface : public vgui::ISurface // Some drawing methods that cannot be accomplished under Win32 virtual void DrawColoredCircle( int centerx, int centery, float radius, int r, int g, int b, int a ) = 0; - virtual void DrawColoredText( vgui::HFont font, int x, int y, int r, int g, int b, int a, char *fmt, ... ) = 0; + virtual void DrawColoredText( vgui::HFont font, int x, int y, int r, int g, int b, int a, const char *fmt, ... ) = 0; // Draws text with current font at position and wordwrapped to the rect using color values specified - virtual void DrawColoredTextRect( vgui::HFont font, int x, int y, int w, int h, int r, int g, int b, int a, char *fmt, ... ) = 0; - virtual void DrawTextHeight( vgui::HFont font, int w, int& h, char *fmt, ... ) = 0; + virtual void DrawColoredTextRect( vgui::HFont font, int x, int y, int w, int h, int r, int g, int b, int a, const char *fmt, ... ) = 0; + virtual void DrawTextHeight( vgui::HFont font, int w, int& h, const char *fmt, ... ) = 0; // Returns the length of the text string in pixels - virtual int DrawTextLen( vgui::HFont font, char *fmt, ... ) = 0; + virtual int DrawTextLen( vgui::HFont font, const char *fmt, ... ) = 0; // Draws a panel in 3D space. Assumes view + projection are already set up // Also assumes the (x,y) coordinates of the panels are defined in 640xN coords diff --git a/src/public/VGuiMatSurface/IMatSystemSurfaceV5.h b/src/public/VGuiMatSurface/IMatSystemSurfaceV5.h index 9b8da47ad..ff7f214bf 100644 --- a/src/public/VGuiMatSurface/IMatSystemSurfaceV5.h +++ b/src/public/VGuiMatSurface/IMatSystemSurfaceV5.h @@ -1,4 +1,4 @@ -//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= +//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= // // Purpose: // @@ -56,14 +56,14 @@ namespace MatSystemSurfaceV5 // Some drawing methods that cannot be accomplished under Win32 virtual void DrawColoredCircle( int centerx, int centery, float radius, int r, int g, int b, int a ) = 0; - virtual int DrawColoredText( vgui::HFont font, int x, int y, int r, int g, int b, int a, char *fmt, ... ) = 0; + virtual int DrawColoredText( vgui::HFont font, int x, int y, int r, int g, int b, int a, const char *fmt, ... ) = 0; // Draws text with current font at position and wordwrapped to the rect using color values specified - virtual void DrawColoredTextRect( vgui::HFont font, int x, int y, int w, int h, int r, int g, int b, int a, char *fmt, ... ) = 0; - virtual void DrawTextHeight( vgui::HFont font, int w, int& h, char *fmt, ... ) = 0; + virtual void DrawColoredTextRect( vgui::HFont font, int x, int y, int w, int h, int r, int g, int b, int a, const char *fmt, ... ) = 0; + virtual void DrawTextHeight( vgui::HFont font, int w, int& h, const char *fmt, ... ) = 0; // Returns the length of the text string in pixels - virtual int DrawTextLen( vgui::HFont font, char *fmt, ... ) = 0; + virtual int DrawTextLen( vgui::HFont font, const char *fmt, ... ) = 0; // Draws a panel in 3D space. Assumes view + projection are already set up // Also assumes the (x,y) coordinates of the panels are defined in 640xN coords diff --git a/src/public/client_class.h b/src/public/client_class.h index 07296b37c..0f3985922 100644 --- a/src/public/client_class.h +++ b/src/public/client_class.h @@ -49,7 +49,7 @@ typedef IClientNetworkable* (*CreateEventFn)(); class ClientClass { public: - ClientClass( char *pNetworkName, CreateClientClassFn createFn, CreateEventFn createEventFn, RecvTable *pRecvTable ) + ClientClass( const char *pNetworkName, CreateClientClassFn createFn, CreateEventFn createEventFn, RecvTable *pRecvTable ) { m_pNetworkName = pNetworkName; m_pCreateFn = createFn; @@ -69,7 +69,7 @@ class ClientClass public: CreateClientClassFn m_pCreateFn; CreateEventFn m_pCreateEventFn; // Only called for event objects. - char *m_pNetworkName; + const char *m_pNetworkName; RecvTable *m_pRecvTable; ClientClass *m_pNext; int m_ClassID; // Managed by the engine. diff --git a/src/public/dt_recv.cpp b/src/public/dt_recv.cpp index d7c94dab7..2bd86bb11 100644 --- a/src/public/dt_recv.cpp +++ b/src/public/dt_recv.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -14,7 +14,7 @@ #if !defined(_STATIC_LINKED) || defined(CLIENT_DLL) -char *s_ClientElementNames[MAX_ARRAY_ELEMENTS] = +const char *s_ClientElementNames[MAX_ARRAY_ELEMENTS] = { "000", "001", "002", "003", "004", "005", "006", "007", "008", "009", "010", "011", "012", "013", "014", "015", "016", "017", "018", "019", @@ -163,7 +163,7 @@ RecvTable::RecvTable() Construct( NULL, 0, NULL ); } -RecvTable::RecvTable(RecvProp *pProps, int nProps, char *pNetTableName) +RecvTable::RecvTable(RecvProp *pProps, int nProps, const char *pNetTableName) { Construct( pProps, nProps, pNetTableName ); } @@ -172,7 +172,7 @@ RecvTable::~RecvTable() { } -void RecvTable::Construct( RecvProp *pProps, int nProps, char *pNetTableName ) +void RecvTable::Construct( RecvProp *pProps, int nProps, const char *pNetTableName ) { m_pProps = pProps; m_nProps = nProps; @@ -188,7 +188,7 @@ void RecvTable::Construct( RecvProp *pProps, int nProps, char *pNetTableName ) // ---------------------------------------------------------------------- // RecvProp RecvPropFloat( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int flags, @@ -214,7 +214,7 @@ RecvProp RecvPropFloat( } RecvProp RecvPropVector( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int flags, @@ -240,7 +240,7 @@ RecvProp RecvPropVector( } RecvProp RecvPropVectorXY( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int flags, @@ -268,7 +268,7 @@ RecvProp RecvPropVectorXY( #if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! RecvProp RecvPropQuaternion( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags, @@ -295,7 +295,7 @@ RecvProp RecvPropQuaternion( #endif RecvProp RecvPropInt( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int flags, @@ -340,7 +340,7 @@ RecvProp RecvPropInt( } RecvProp RecvPropString( - char *pVarName, + const char *pVarName, int offset, int bufferSize, int flags, @@ -360,7 +360,7 @@ RecvProp RecvPropString( } RecvProp RecvPropDataTable( - char *pVarName, + const char *pVarName, int offset, int flags, RecvTable *pTable, @@ -380,7 +380,7 @@ RecvProp RecvPropDataTable( } RecvProp RecvPropArray3( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int elements, @@ -419,7 +419,7 @@ RecvProp RecvPropArray3( RecvProp InternalRecvPropArray( const int elementCount, const int elementStride, - char *pName, + const char *pName, ArrayLengthRecvProxyFn proxy ) { diff --git a/src/public/dt_recv.h b/src/public/dt_recv.h index 783889820..2a7c00110 100644 --- a/src/public/dt_recv.h +++ b/src/public/dt_recv.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -135,7 +135,7 @@ class RecvProp public: - char *m_pVarName; + const char *m_pVarName; SendPropType m_RecvType; int m_Flags; int m_StringBufferSize; @@ -174,10 +174,10 @@ class RecvTable typedef RecvProp PropType; RecvTable(); - RecvTable( RecvProp *pProps, int nProps, char *pNetTableName ); + RecvTable( RecvProp *pProps, int nProps, const char *pNetTableName ); ~RecvTable(); - void Construct( RecvProp *pProps, int nProps, char *pNetTableName ); + void Construct( RecvProp *pProps, int nProps, const char *pNetTableName ); int GetNumProps(); RecvProp* GetProp( int i ); @@ -203,7 +203,7 @@ class RecvTable // will have their own decoders that include props for all their children). CRecvDecoder *m_pDecoder; - char *m_pNetTableName; // The name matched between client and server. + const char *m_pNetTableName; // The name matched between client and server. private: @@ -270,7 +270,7 @@ inline bool RecvTable::IsInMainList() const template <> int ClientClassInit(tableName::ignored *) \ { \ typedef className currentRecvDTClass; \ - char *pRecvTableName = #tableName; \ + const char *pRecvTableName = #tableName; \ RecvTable &RecvTable = tableName::g_RecvTable; \ static RecvProp RecvProps[] = { \ RecvPropInt("should_never_see_this", 0, sizeof(int)), // It adds a dummy property at the start so you can define "empty" SendTables. @@ -313,7 +313,7 @@ void DataTableRecvProxy_PointerDataTable(const RecvProp *pProp, void **pOut, voi RecvProp RecvPropFloat( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags=0, @@ -321,7 +321,7 @@ RecvProp RecvPropFloat( ); RecvProp RecvPropVector( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags=0, @@ -329,7 +329,7 @@ RecvProp RecvPropVector( ); RecvProp RecvPropVectorXY( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags=0, @@ -342,7 +342,7 @@ RecvProp RecvPropVectorXY( #if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! RecvProp RecvPropQuaternion( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags=0, @@ -351,7 +351,7 @@ RecvProp RecvPropQuaternion( #endif RecvProp RecvPropInt( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by RECVINFO macro, but set to SIZEOF_IGNORE if you don't want to bother. int flags=0, @@ -359,7 +359,7 @@ RecvProp RecvPropInt( ); RecvProp RecvPropString( - char *pVarName, + const char *pVarName, int offset, int bufferSize, int flags=0, @@ -367,7 +367,7 @@ RecvProp RecvPropString( ); RecvProp RecvPropDataTable( - char *pVarName, + const char *pVarName, int offset, int flags, RecvTable *pTable, @@ -375,7 +375,7 @@ RecvProp RecvPropDataTable( ); RecvProp RecvPropArray3( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int elements, @@ -389,7 +389,7 @@ RecvProp RecvPropArray3( RecvProp InternalRecvPropArray( const int elementCount, const int elementStride, - char *pName, + const char *pName, ArrayLengthRecvProxyFn proxy ); diff --git a/src/public/dt_send.cpp b/src/public/dt_send.cpp index da0ad10c3..ec5ed9624 100644 --- a/src/public/dt_send.cpp +++ b/src/public/dt_send.cpp @@ -27,7 +27,7 @@ void SendProxy_UInt16ToInt32( const SendProp *pProp, const void *pStruct, const void SendProxy_UInt32ToInt32( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID); void SendProxy_UInt64ToInt64( const SendProp *pProp, const void *pStruct, const void *pData, DVariant *pOut, int iElement, int objectID); -char *s_ElementNames[MAX_ARRAY_ELEMENTS] = +const char *s_ElementNames[MAX_ARRAY_ELEMENTS] = { "000", "001", "002", "003", "004", "005", "006", "007", "008", "009", "010", "011", "012", "013", "014", "015", "016", "017", "018", "019", @@ -340,7 +340,7 @@ float AssignRangeMultiplier( int nBits, double range ) SendProp SendPropFloat( - char *pVarName, + const char *pVarName, // Variable name. int offset, // Offset into container structure. int sizeofVar, @@ -395,7 +395,7 @@ SendProp SendPropFloat( } SendProp SendPropVector( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, // Number of bits to use when encoding. @@ -433,7 +433,7 @@ SendProp SendPropVector( } SendProp SendPropVectorXY( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, // Number of bits to use when encoding. @@ -472,7 +472,7 @@ SendProp SendPropVectorXY( #if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! SendProp SendPropQuaternion( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, // Number of bits to use when encoding. @@ -511,7 +511,7 @@ SendProp SendPropQuaternion( #endif SendProp SendPropAngle( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, @@ -561,7 +561,7 @@ SendProp SendPropAngle( SendProp SendPropQAngles( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, @@ -611,7 +611,7 @@ SendProp SendPropQAngles( } SendProp SendPropInt( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int nBits, @@ -684,7 +684,7 @@ SendProp SendPropInt( } SendProp SendPropString( - char *pVarName, + const char *pVarName, int offset, int bufferLen, int flags, @@ -707,7 +707,7 @@ SendProp SendPropString( } SendProp SendPropArray3( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int elements, @@ -754,7 +754,7 @@ SendProp SendPropArray3( } SendProp SendPropDataTable( - char *pVarName, + const char *pVarName, int offset, SendTable *pTable, SendTableProxyFn varProxy, @@ -788,7 +788,7 @@ SendProp SendPropDataTable( SendProp InternalSendPropArray( const int elementCount, const int elementStride, - char *pName, + const char *pName, ArrayLengthSendProxyFn arrayLengthFn, byte priority ) @@ -810,8 +810,8 @@ SendProp InternalSendPropArray( SendProp SendPropExclude( - char *pDataTableName, // Data table name (given to BEGIN_SEND_TABLE and BEGIN_RECV_TABLE). - char *pPropName // Name of the property to exclude. + const char *pDataTableName, // Data table name (given to BEGIN_SEND_TABLE and BEGIN_RECV_TABLE). + const char *pPropName // Name of the property to exclude. ) { SendProp ret; @@ -884,7 +884,7 @@ SendTable::SendTable() } -SendTable::SendTable(SendProp *pProps, int nProps, char *pNetTableName) +SendTable::SendTable(SendProp *pProps, int nProps, const char *pNetTableName) { Construct( pProps, nProps, pNetTableName ); } @@ -896,7 +896,7 @@ SendTable::~SendTable() } -void SendTable::Construct( SendProp *pProps, int nProps, char *pNetTableName ) +void SendTable::Construct( SendProp *pProps, int nProps, const char *pNetTableName ) { m_pProps = pProps; m_nProps = nProps; diff --git a/src/public/dt_send.h b/src/public/dt_send.h index 2570e53b8..746367616 100644 --- a/src/public/dt_send.h +++ b/src/public/dt_send.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -194,7 +194,7 @@ class SendProp // If it's one of the numbered "000", "001", etc properties in an array, then // these can be used to get its array property name for debugging. const char* GetParentArrayPropName() const; - void SetParentArrayPropName( char *pArrayPropName ); + void SetParentArrayPropName( const char *pArrayPropName ); const char* GetName() const; @@ -249,10 +249,10 @@ class SendProp int m_nElements; // Number of elements in the array (or 1 if it's not an array). int m_ElementStride; // Pointer distance between array elements. - char *m_pExcludeDTName; // If this is an exclude prop, then this is the name of the datatable to exclude a prop from. - char *m_pParentArrayPropName; + const char *m_pExcludeDTName; // If this is an exclude prop, then this is the name of the datatable to exclude a prop from. + const char *m_pParentArrayPropName; - char *m_pVarName; + const char *m_pVarName; float m_fHighLowMul; byte m_priority; @@ -327,7 +327,7 @@ inline const char* SendProp::GetParentArrayPropName() const return m_pParentArrayPropName; } -inline void SendProp::SetParentArrayPropName( char *pArrayPropName ) +inline void SendProp::SetParentArrayPropName( const char *pArrayPropName ) { Assert( !m_pParentArrayPropName ); m_pParentArrayPropName = pArrayPropName; @@ -442,10 +442,10 @@ class SendTable typedef SendProp PropType; SendTable(); - SendTable( SendProp *pProps, int nProps, char *pNetTableName ); + SendTable( SendProp *pProps, int nProps, const char *pNetTableName ); ~SendTable(); - void Construct( SendProp *pProps, int nProps, char *pNetTableName ); + void Construct( SendProp *pProps, int nProps, const char *pNetTableName ); const char* GetName() const; @@ -468,7 +468,7 @@ class SendTable SendProp *m_pProps; int m_nProps; - char *m_pNetTableName; // The name matched between client and server. + const char *m_pNetTableName; // The name matched between client and server. // The engine hooks the SendTable here. CSendTablePrecalc *m_pPrecalc; @@ -565,7 +565,7 @@ inline void SendTable::SetHasPropsEncodedAgainstTickcount( bool bState ) template <> int ServerClassInit(tableName::ignored *) \ { \ typedef className currentSendDTClass; \ - static char *g_pSendTableName = #tableName; \ + static const char *g_pSendTableName = #tableName; \ SendTable &sendTable = tableName::g_SendTable; \ static SendProp g_SendProps[] = { \ SendPropInt("should_never_see_this", 0, sizeof(int)), // It adds a dummy property at the start so you can define "empty" SendTables. @@ -636,7 +636,7 @@ void* SendProxy_DataTablePtrToDataTable( const SendProp *pProp, const void *pStr // Use these functions to setup your data tables. // ------------------------------------------------------------------------ // SendProp SendPropFloat( - char *pVarName, // Variable name. + const char *pVarName, // Variable name. int offset, // Offset into container structure. int sizeofVar=SIZEOF_IGNORE, int nBits=32, // Number of bits to use when encoding. @@ -648,7 +648,7 @@ SendProp SendPropFloat( ); SendProp SendPropVector( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, int nBits=32, // Number of bits (for each floating-point component) to use when encoding. @@ -660,7 +660,7 @@ SendProp SendPropVector( ); SendProp SendPropVectorXY( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, int nBits=32, // Number of bits (for each floating-point component) to use when encoding. @@ -673,7 +673,7 @@ SendProp SendPropVectorXY( #if 0 // We can't ship this since it changes the size of DTVariant to be 20 bytes instead of 16 and that breaks MODs!!! SendProp SendPropQuaternion( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, int nBits=32, // Number of bits (for each floating-point component) to use when encoding. @@ -686,7 +686,7 @@ SendProp SendPropQuaternion( #endif SendProp SendPropAngle( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, int nBits=32, @@ -696,7 +696,7 @@ SendProp SendPropAngle( ); SendProp SendPropQAngles( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, int nBits=32, @@ -706,7 +706,7 @@ SendProp SendPropQAngles( ); SendProp SendPropInt( - char *pVarName, + const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE, // Handled by SENDINFO macro. int nBits=-1, // Set to -1 to automatically pick (max) number of bits based on size of element. @@ -717,11 +717,11 @@ SendProp SendPropInt( inline SendProp SendPropModelIndex( const char *pVarName, int offset, int sizeofVar=SIZEOF_IGNORE ) { - return SendPropInt( (char *)pVarName, offset, sizeofVar, SP_MODEL_INDEX_BITS, 0 ); + return SendPropInt( pVarName, offset, sizeofVar, SP_MODEL_INDEX_BITS, 0 ); } SendProp SendPropString( - char *pVarName, + const char *pVarName, int offset, int bufferLen, int flags=0, @@ -731,7 +731,7 @@ SendProp SendPropString( // The data table encoder looks at DVariant::m_pData. SendProp SendPropDataTable( - char *pVarName, + const char *pVarName, int offset, SendTable *pTable, SendTableProxyFn varProxy=SendProxy_DataTableToDataTable, @@ -739,7 +739,7 @@ SendProp SendPropDataTable( ); SendProp SendPropArray3( - char *pVarName, + const char *pVarName, int offset, int sizeofVar, int elements, @@ -783,7 +783,7 @@ SendProp SendPropArray3( SendProp InternalSendPropArray( const int elementCount, const int elementStride, - char *pName, + const char *pName, ArrayLengthSendProxyFn proxy, byte priority = SENDPROP_DEFAULT_PRIORITY ); @@ -835,8 +835,8 @@ SendProp InternalSendPropArray( // Use these to create properties that exclude other properties. This is useful if you want to use most of // a base class's datatable data, but you want to override some of its variables. SendProp SendPropExclude( - char *pDataTableName, // Data table name (given to BEGIN_SEND_TABLE and BEGIN_RECV_TABLE). - char *pPropName // Name of the property to exclude. + const char *pDataTableName, // Data table name (given to BEGIN_SEND_TABLE and BEGIN_RECV_TABLE). + const char *pPropName // Name of the property to exclude. ); diff --git a/src/public/dt_utlvector_recv.cpp b/src/public/dt_utlvector_recv.cpp index 2ecc2487f..b15b8d3f1 100644 --- a/src/public/dt_utlvector_recv.cpp +++ b/src/public/dt_utlvector_recv.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -11,7 +11,7 @@ #include "tier0/memdbgon.h" -extern char *s_ClientElementNames[MAX_ARRAY_ELEMENTS]; +extern const char *s_ClientElementNames[MAX_ARRAY_ELEMENTS]; class CRecvPropExtra_UtlVector @@ -78,7 +78,7 @@ void DataTableRecvProxy_LengthProxy( const RecvProp *pProp, void **pOut, void *p RecvProp RecvPropUtlVector( - char *pVarName, // Use RECVINFO_UTLVECTOR to generate these 4. + const char *pVarName, // Use RECVINFO_UTLVECTOR to generate these 4. int offset, // Used to generate pData in the function specified in varProxy. int sizeofVar, // The size of each element in the utlvector. ResizeUtlVectorFn fn, diff --git a/src/public/dt_utlvector_recv.h b/src/public/dt_utlvector_recv.h index 5252466b4..1bf88397d 100644 --- a/src/public/dt_utlvector_recv.h +++ b/src/public/dt_utlvector_recv.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Player for HL1. // @@ -45,7 +45,7 @@ // RecvPropUtlVector( RECVINFO_UTLVECTOR( m_FloatArray ), 16, RecvPropFloat(NULL,0,0) ) // RecvProp RecvPropUtlVector( - char *pVarName, // Use RECVINFO_UTLVECTOR to generate these first 5 parameters. + const char *pVarName, // Use RECVINFO_UTLVECTOR to generate these first 5 parameters. int offset, int sizeofVar, ResizeUtlVectorFn fn, diff --git a/src/public/dt_utlvector_send.cpp b/src/public/dt_utlvector_send.cpp index 47fe9f4ca..7aa81d276 100644 --- a/src/public/dt_utlvector_send.cpp +++ b/src/public/dt_utlvector_send.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -11,7 +11,7 @@ #include "tier0/memdbgon.h" -extern char *s_ElementNames[MAX_ARRAY_ELEMENTS]; +extern const char *s_ElementNames[MAX_ARRAY_ELEMENTS]; // This gets associated with SendProps inside a utlvector and stores extra data needed to make it work. class CSendPropExtra_UtlVector @@ -134,7 +134,7 @@ void* SendProxy_LengthTable( const SendProp *pProp, const void *pStructBase, con // Note: you have to be DILIGENT about calling NetworkStateChanged whenever an element in your CUtlVector changes // since CUtlVector doesn't do this automatically. SendProp SendPropUtlVector( - char *pVarName, // Use SENDINFO_UTLVECTOR to generate these 4. + const char *pVarName, // Use SENDINFO_UTLVECTOR to generate these 4. int offset, // Used to generate pData in the function specified in varProxy. int sizeofVar, // The size of each element in the utlvector. EnsureCapacityFn ensureFn, // This is the value returned for elements out of the array's current range. diff --git a/src/public/dt_utlvector_send.h b/src/public/dt_utlvector_send.h index 9094039c1..b167b0e2a 100644 --- a/src/public/dt_utlvector_send.h +++ b/src/public/dt_utlvector_send.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Player for HL1. // @@ -43,7 +43,7 @@ // ) // SendProp SendPropUtlVector( - char *pVarName, // Use SENDINFO_UTLVECTOR to generate these first 4 parameters. + const char *pVarName, // Use SENDINFO_UTLVECTOR to generate these first 4 parameters. int offset, int sizeofVar, EnsureCapacityFn ensureFn, diff --git a/src/public/fgdlib/gdvar.h b/src/public/fgdlib/gdvar.h index 80a0df464..8c2fcb4b8 100644 --- a/src/public/fgdlib/gdvar.h +++ b/src/public/fgdlib/gdvar.h @@ -137,7 +137,7 @@ class GDinputvariable // for choices/flags: CUtlVector m_Items; - static char *m_pszEmpty; + static const char *m_pszEmpty; char m_szName[MAX_IDENT]; char m_szLongName[MAX_STRING]; diff --git a/src/public/fgdlib/inputoutput.h b/src/public/fgdlib/inputoutput.h index bd9a358d9..143236c48 100644 --- a/src/public/fgdlib/inputoutput.h +++ b/src/public/fgdlib/inputoutput.h @@ -54,7 +54,7 @@ class CClassInputOutputBase protected: - static char *g_pszEmpty; + static const char *g_pszEmpty; char m_szName[MAX_IO_NAME_LEN]; InputOutputType_t m_eType; diff --git a/src/public/keyframe/keyframe.cpp b/src/public/keyframe/keyframe.cpp index cbb529abf..58dd966d9 100644 --- a/src/public/keyframe/keyframe.cpp +++ b/src/public/keyframe/keyframe.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -94,9 +94,9 @@ float TimeModifierFunc_TimeSquared( float time ) TimeModifier_t g_TimeModifiers[] = { - { "Linear", TimeModifierFunc_Linear }, - { "Accel/Deaccel (cosine)", TimeModifierFunc_Cosine }, - { "Accel (time*time)", TimeModifierFunc_TimeSquared }, + { (char *)"Linear", TimeModifierFunc_Linear }, + { (char *)"Accel/Deaccel (cosine)", TimeModifierFunc_Cosine }, + { (char *)"Accel (time*time)", TimeModifierFunc_TimeSquared }, }; int Motion_GetNumberOfTimeModifiers( void ) @@ -173,7 +173,7 @@ void CPositionInterpolator_Linear::Release() void CPositionInterpolator_Linear::GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ) { - *outName = "Linear"; + *outName = (char *)"Linear"; *outMinKeyReq = 0; *outMaxKeyReq = 1; } @@ -220,7 +220,7 @@ void CPositionInterpolator_CatmullRom::Release() void CPositionInterpolator_CatmullRom::GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ) { - *outName = "Catmull-Rom Spline"; + *outName = (char *)"Catmull-Rom Spline"; *outMinKeyReq = -1; *outMaxKeyReq = 2; } @@ -321,7 +321,7 @@ void CPositionInterpolator_Rope::Release() void CPositionInterpolator_Rope::GetDetails( char **outName, int *outMinKeyReq, int *outMaxKeyReq ) { - *outName = "Rope"; + *outName = (char *)"Rope"; *outMinKeyReq = 0; *outMaxKeyReq = 1; } @@ -450,7 +450,7 @@ void RotationInterpolatorFunc_Linear( float time, Quaternion &outRot ) RotationInterpolator_t g_RotationInterpolators[] = { - { "Linear", RotationInterpolatorFunc_Linear, 0, 1 }, + { (char *)"Linear", RotationInterpolatorFunc_Linear, 0, 1 }, }; int Motion_GetNumberOfRotationInterpolators( void ) diff --git a/src/public/server_class.h b/src/public/server_class.h index 5e40d9ba7..37ee38948 100644 --- a/src/public/server_class.h +++ b/src/public/server_class.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -27,7 +27,7 @@ extern ServerClass *g_pServerClassHead; class ServerClass { public: - ServerClass( char *pNetworkName, SendTable *pTable ) + ServerClass( const char *pNetworkName, SendTable *pTable ) { m_pNetworkName = pNetworkName; m_pTable = pTable; @@ -71,7 +71,7 @@ class ServerClass public: - char *m_pNetworkName; + const char *m_pNetworkName; SendTable *m_pTable; ServerClass *m_pNext; int m_ClassID; // Managed by the engine. diff --git a/src/public/studio.cpp b/src/public/studio.cpp index 427c6d585..70ab566e4 100644 --- a/src/public/studio.cpp +++ b/src/public/studio.cpp @@ -533,7 +533,7 @@ char *studiohdr_t::pszNodeName( int iNode ) Assert( pVModel ); if ( pVModel->m_node.Count() <= iNode-1 ) - return "Invalid node"; + return (char *)"Invalid node"; return pVModel->m_group[ pVModel->m_node[iNode-1].group ].GetStudioHdr()->pszLocalNodeName( pVModel->m_node[iNode-1].index ); } @@ -1163,7 +1163,7 @@ char *CStudioHdr::pszNodeName( int iNode ) } if ( m_pVModel->m_node.Count() <= iNode-1 ) - return "Invalid node"; + return (char *)"Invalid node"; const studiohdr_t *pStudioHdr = GroupStudioHdr( m_pVModel->m_node[iNode-1].group ); diff --git a/src/public/tier1/interpolatedvar.h b/src/public/tier1/interpolatedvar.h index 6f0e1be26..ad3706fb2 100644 --- a/src/public/tier1/interpolatedvar.h +++ b/src/public/tier1/interpolatedvar.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -1537,7 +1537,7 @@ class CInterpolatedVarArray : public CInterpolatedVarArrayBase CInterpolatedVarArray( const char *pDebugName = "no debug name" ) : CInterpolatedVarArrayBase( pDebugName ) { - SetMaxCount( 0.0f, COUNT ); + this->SetMaxCount( 0.0f, COUNT ); } }; @@ -1553,7 +1553,7 @@ class CInterpolatedVar : public CInterpolatedVarArrayBase< Type, false > CInterpolatedVar( const char *pDebugName = NULL ) : CInterpolatedVarArrayBase< Type, false >(pDebugName) { - SetMaxCount( 0.0f, 1 ); + this->SetMaxCount( 0.0f, 1 ); } }; From a6cfd1fba4f662a0035a467684ec4bbe56d2b357 Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:28 +0200 Subject: [PATCH 07/13] C++14 to C++20: fix C2440 (false is not a null pointer constant) false is not a null pointer constant in conformance mode: chunkfile.cpp returns NULL, and the GetLocalTeam() result is compared against NULL instead of being used as a bool-to-pointer conversion. --- src/game/client/clientmode_shared.cpp | 2 +- src/public/chunkfile.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/client/clientmode_shared.cpp b/src/game/client/clientmode_shared.cpp index e563c3172..ecb5a61ab 100644 --- a/src/game/client/clientmode_shared.cpp +++ b/src/game/client/clientmode_shared.cpp @@ -1124,7 +1124,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event ) } } - if ( team == 0 && GetLocalTeam() > 0 ) + if ( team == 0 && GetLocalTeam() != NULL ) { bValidTeam = false; } diff --git a/src/public/chunkfile.cpp b/src/public/chunkfile.cpp index 326bf0786..20f6057be 100644 --- a/src/public/chunkfile.cpp +++ b/src/public/chunkfile.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Implements an interface for reading and writing heirarchical // text files of key value pairs. The format of the file is as follows: @@ -151,7 +151,7 @@ ChunkHandler_t CChunkHandlerMap::GetHandler(const char *pszChunkName, void **ppD pNode = pNode->pNext; } - return(false); + return(NULL); } From 428986098f47f8c197af71df22a05e419cea441a Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:29 +0200 Subject: [PATCH 08/13] C++14 to C++20: fix C2555/C2556/C2373/C2672 (char * virtuals) The string-returning virtuals are const char * now (GetEngineSound, GetScannerSoundPrefix, GetDeathNoticeName, GetFixedCameraEntityName and the particle definition members) in the headers and in their definitions, which removes the casts their callers needed. --- src/game/client/c_effects.h | 8 ++++---- src/game/server/hl2/npc_scanner.cpp | 4 ++-- src/game/server/hl2/npc_scanner.h | 4 ++-- src/game/server/hltvdirector.h | 2 +- src/game/server/replaydirector.h | 2 +- src/game/shared/basecombatweapon_shared.cpp | 2 +- src/game/shared/basecombatweapon_shared.h | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/game/client/c_effects.h b/src/game/client/c_effects.h index 9c42d7023..de79877a0 100644 --- a/src/game/client/c_effects.h +++ b/src/game/client/c_effects.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -192,9 +192,9 @@ class CClient_Precipitation : public C_BaseEntity AshSplit_t m_Ash[ MAX_SPLITSCREEN_PLAYERS ]; float m_flParticleInnerDist; //The distance at which to start drawing the inner system - char *m_pParticleInnerNearDef; //Name of the first inner system - char *m_pParticleInnerFarDef; //Name of the second inner system - char *m_pParticleOuterDef; //Name of the outer system + const char *m_pParticleInnerNearDef; //Name of the first inner system + const char *m_pParticleInnerFarDef; //Name of the second inner system + const char *m_pParticleOuterDef; //Name of the outer system HPARTICLEFFECT m_pParticlePrecipInnerNear[ MAX_SPLITSCREEN_PLAYERS ]; HPARTICLEFFECT m_pParticlePrecipInnerFar[ MAX_SPLITSCREEN_PLAYERS ]; HPARTICLEFFECT m_pParticlePrecipOuter[ MAX_SPLITSCREEN_PLAYERS ]; diff --git a/src/game/server/hl2/npc_scanner.cpp b/src/game/server/hl2/npc_scanner.cpp index b8b07abc2..eb3e1dd7a 100644 --- a/src/game/server/hl2/npc_scanner.cpp +++ b/src/game/server/hl2/npc_scanner.cpp @@ -507,7 +507,7 @@ void CNPC_CScanner::HandleAnimEvent( animevent_t *pEvent ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -char *CNPC_CScanner::GetEngineSound( void ) +const char *CNPC_CScanner::GetEngineSound( void ) { if( m_bIsClawScanner ) return "NPC_SScanner.FlyLoop"; @@ -2259,7 +2259,7 @@ void CNPC_CScanner::StartTask( const Task_t *pTask ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -char *CNPC_CScanner::GetScannerSoundPrefix( void ) +const char *CNPC_CScanner::GetScannerSoundPrefix( void ) { if( m_bIsClawScanner ) return "NPC_SScanner"; diff --git a/src/game/server/hl2/npc_scanner.h b/src/game/server/hl2/npc_scanner.h index ed49277b9..8b47793b4 100644 --- a/src/game/server/hl2/npc_scanner.h +++ b/src/game/server/hl2/npc_scanner.h @@ -49,7 +49,7 @@ class CNPC_CScanner : public CNPC_BaseScanner void Precache(void); void RunTask( const Task_t *pTask ); int SelectSchedule(void); - virtual char *GetScannerSoundPrefix( void ); + virtual const char *GetScannerSoundPrefix( void ); void Spawn(void); void Activate(); void StartTask( const Task_t *pTask ); @@ -74,7 +74,7 @@ class CNPC_CScanner : public CNPC_BaseScanner void Event_Killed( const CTakeDamageInfo &info ); - char *GetEngineSound( void ); + const char *GetEngineSound( void ); virtual float MinGroundDist(void); virtual void AdjustScannerVelocity( void ); diff --git a/src/game/server/hltvdirector.h b/src/game/server/hltvdirector.h index 25f1dbd93..deb1b5fb4 100644 --- a/src/game/server/hltvdirector.h +++ b/src/game/server/hltvdirector.h @@ -67,7 +67,7 @@ class CHLTVDirector : public CGameEventListener, public CBaseGameSystemPerFrame, virtual void Shutdown(); virtual void FrameUpdatePostEntityThink(); virtual void LevelInitPostEntity(); - virtual char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } + virtual const char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } bool SetCameraMan( int iPlayerIndex ); int GetCameraMan() { return m_iCameraManIndex; } diff --git a/src/game/server/replaydirector.h b/src/game/server/replaydirector.h index 09ead00e5..bb68616c4 100644 --- a/src/game/server/replaydirector.h +++ b/src/game/server/replaydirector.h @@ -67,7 +67,7 @@ class CReplayDirector : public CGameEventListener, public CBaseGameSystemPerFram virtual void Shutdown(); virtual void FrameUpdatePostEntityThink(); virtual void LevelInitPostEntity(); - virtual char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } + virtual const char *GetFixedCameraEntityName( void ) { return "point_viewcontrol"; } bool SetCameraMan( int iPlayerIndex ); int GetCameraMan() { return m_iCameraManIndex; } diff --git a/src/game/shared/basecombatweapon_shared.cpp b/src/game/shared/basecombatweapon_shared.cpp index a627435d1..2c839250a 100644 --- a/src/game/shared/basecombatweapon_shared.cpp +++ b/src/game/shared/basecombatweapon_shared.cpp @@ -1968,7 +1968,7 @@ void CBaseCombatWeapon::AddViewKick( void ) //----------------------------------------------------------------------------- // Purpose: Get the string to print death notices with //----------------------------------------------------------------------------- -char *CBaseCombatWeapon::GetDeathNoticeName( void ) +const char *CBaseCombatWeapon::GetDeathNoticeName( void ) { #if !defined( CLIENT_DLL ) return (char*)STRING( m_iszName ); diff --git a/src/game/shared/basecombatweapon_shared.h b/src/game/shared/basecombatweapon_shared.h index b47cc1f6f..ad9ba51e1 100644 --- a/src/game/shared/basecombatweapon_shared.h +++ b/src/game/shared/basecombatweapon_shared.h @@ -283,7 +283,7 @@ class CBaseCombatWeapon : public BASECOMBATWEAPON_DERIVED_FROM virtual void AddViewKick( void ); // Add in the view kick for the weapon - virtual char *GetDeathNoticeName( void ); // Get the string to print death notices with + virtual const char *GetDeathNoticeName( void ); // Get the string to print death notices with CBaseCombatCharacter *GetOwner() const; void SetOwner( CBaseCombatCharacter *owner ); From 2a723d08568acaa78bad251ad1ad0f2c348f5bbe Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:29 +0200 Subject: [PATCH 09/13] C++14 to C++20: fix C2216 (friend static) friend static is not a valid declaration: the console command handlers in rd_workshop.h are static at namespace scope only. --- src/game/shared/swarm/rd_workshop.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/shared/swarm/rd_workshop.h b/src/game/shared/swarm/rd_workshop.h index 917286f32..2a6beb9a1 100644 --- a/src/game/shared/swarm/rd_workshop.h +++ b/src/game/shared/swarm/rd_workshop.h @@ -314,11 +314,11 @@ class CReactiveDropWorkshop : public CAutoGameSystem void UpdateWorkshopItemQueryResultCallback( SteamUGCQueryCompleted_t *pResult, bool bIOFailure ); CCallResult m_CreateItemResultCallbackCurated; void CreateItemResultCallbackCurated( CreateItemResult_t *pResult, bool bIOFailure ); - friend static void ugc_create(const CCommand & args); - friend static void ugc_curated_create(const CCommand & args); - friend static void ugc_update(const CCommand & args); - friend static void ugc_updatetags(const CCommand & args); - friend static void _ugc_update_progress(const CCommand & args); + friend void ugc_create(const CCommand & args); + friend void ugc_curated_create(const CCommand & args); + friend void ugc_update(const CCommand & args); + friend void ugc_updatetags(const CCommand & args); + friend void _ugc_update_progress(const CCommand & args); void CheckPublishedAddonConsistency(); friend class CFixWorkshopKeyValueNames; From 3937eb0129e6b7069b1d80687bb7857d1ec17bd0 Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:30 +0200 Subject: [PATCH 10/13] C++14 to C++20: fix C2664/C2665 (temporaries and non-const refs) Temporaries cannot bind to non-const references. Instead of keeping a local at every call site, the in-repo callees take const Vector& / const QAngle& (Tracer_Draw, CSnowFallManager::FindSnowVolumes, SetMoveTarget, the three MeleeAttack helpers, FX_MicroExplosion), and asw_broadcast_camera uses VectorLength() for the length it actually needs. The engine-side particle interfaces consume the CUtlBuffer they are given, so their call sites keep a local. --- src/game/client/c_effects.cpp | 22 +++++++++---------- src/game/client/c_tracer.cpp | 6 ++--- src/game/client/c_tracer.h | 6 ++--- src/game/client/cdll_util.cpp | 4 ++-- src/game/client/cdll_util.h | 2 +- src/game/client/clientsideeffects_test.cpp | 4 ++-- src/game/client/fx.h | 6 ++--- src/game/client/fx_sparks.cpp | 2 +- src/game/client/swarm/c_asw_marine.h | 4 ++-- src/game/server/CommentarySystem.cpp | 2 +- src/game/server/ai_basenpc.cpp | 2 +- src/game/server/ai_basenpc.h | 4 ++-- src/game/server/baseentity.cpp | 2 +- src/game/server/baseentity.h | 8 +++---- src/game/server/buttons.cpp | 4 ++-- src/game/server/episodic/npc_hunter.cpp | 2 +- src/game/server/func_break.cpp | 2 +- src/game/server/gameinterface.cpp | 4 ++-- src/game/server/hl2/npc_bullseye.h | 4 ++-- src/game/server/player.cpp | 2 +- src/game/server/player.h | 4 ++-- src/game/server/sceneentity.cpp | 10 ++++----- .../server/swarm/asw_broadcast_camera.cpp | 2 +- src/game/server/swarm/asw_drone_advanced.cpp | 2 +- src/game/server/swarm/asw_drone_advanced.h | 2 +- src/game/server/swarm/asw_marine.cpp | 4 ++-- src/game/server/swarm/asw_marine.h | 2 +- src/game/server/swarm/asw_shieldbug.cpp | 2 +- src/game/server/swarm/asw_shieldbug.h | 2 +- src/game/server/swarm/asw_simple_alien.cpp | 4 ++-- src/game/server/swarm/asw_simple_alien.h | 4 ++-- src/game/server/util.h | 4 ++-- src/game/shared/SoundEmitterSystem.cpp | 6 ++--- src/game/shared/swarm/rd_inventory_shared.cpp | 2 +- src/game/shared/swarm/rd_lobby_utils.cpp | 2 +- .../shared/swarm/rd_vgui_vscript_shared.cpp | 2 +- src/game/shared/usercmd.cpp | 14 ++++++------ src/game/shared/util_shared.cpp | 2 +- 38 files changed, 81 insertions(+), 81 deletions(-) diff --git a/src/game/client/c_effects.cpp b/src/game/client/c_effects.cpp index c5a10491f..aa51c268d 100644 --- a/src/game/client/c_effects.cpp +++ b/src/game/client/c_effects.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -986,7 +986,7 @@ void CClient_Precipitation::CreateParticlePrecip( void ) { FOR_EACH_VALID_SPLITSCREEN_PLAYER( hh ) { - if ( m_pParticlePrecipOuter[hh] != NULL ) + if ( m_pParticlePrecipOuter[hh].IsValid() ) { DestroyInnerParticlePrecip( hh ); DestroyOuterParticlePrecip( hh ); @@ -1106,7 +1106,7 @@ void CClient_Precipitation::UpdateParticlePrecip( C_BasePlayer *pPlayer, int nSl //debugoverlay->AddBoxOverlay(vOffsetPosFar, Vector( -5, -5, -5 ), Vector( 5, 5, 5 ), QAngle( 0, 0, 0 ), 0, 0, 255, 32, 0.2f ); // Update if we've already got systems, otherwise, create them. - if ( m_pParticlePrecipInnerNear[nSlot] != NULL && m_pParticlePrecipInnerFar[nSlot] != NULL && m_pParticlePrecipOuter[nSlot] != NULL ) + if ( m_pParticlePrecipInnerNear[nSlot].IsValid() && m_pParticlePrecipInnerFar[nSlot].IsValid() && m_pParticlePrecipOuter[nSlot].IsValid() ) { m_pParticlePrecipOuter[nSlot]->SetControlPoint( 1, vOffsetPos ); m_pParticlePrecipInnerNear[nSlot]->SetControlPoint( 1, vOffsetPosNear ); @@ -1124,12 +1124,12 @@ void CClient_Precipitation::UpdateParticlePrecip( C_BasePlayer *pPlayer, int nSl if ( !bInside && SubFloat( FindLowestSIMD3( Result.HitDistance ), 0 ) >= m_flParticleInnerDist ) { // Kill the inner rain if it's previously been in use - if ( m_pParticlePrecipInnerNear[nSlot] != NULL ) + if ( m_pParticlePrecipInnerNear[nSlot].IsValid() ) { DestroyInnerParticlePrecip( nSlot ); } // Update if we've already got systems, otherwise, create them. - if ( m_pParticlePrecipOuter[nSlot] != NULL ) + if ( m_pParticlePrecipOuter[nSlot].IsValid() ) { m_pParticlePrecipOuter[nSlot]->SetControlPoint( 1, vOffsetPos ); m_pParticlePrecipOuter[nSlot]->SetControlPoint( 3, vDensity ); @@ -1142,7 +1142,7 @@ void CClient_Precipitation::UpdateParticlePrecip( C_BasePlayer *pPlayer, int nSl else //We're close enough to use the near effect. { // Update if we've already got systems, otherwise, create them. - if ( m_pParticlePrecipInnerNear[nSlot] != NULL && m_pParticlePrecipInnerFar[nSlot] != NULL && m_pParticlePrecipOuter[nSlot] != NULL ) + if ( m_pParticlePrecipInnerNear[nSlot].IsValid() && m_pParticlePrecipInnerFar[nSlot].IsValid() && m_pParticlePrecipOuter[nSlot].IsValid() ) { m_pParticlePrecipOuter[nSlot]->SetControlPoint( 1, vOffsetPos ); m_pParticlePrecipInnerNear[nSlot]->SetControlPoint( 1, vOffsetPosNear ); @@ -1274,12 +1274,12 @@ void CClient_Precipitation::InitializeParticlePrecip( void ) void CClient_Precipitation::DestroyInnerParticlePrecip( int nSlot ) { - if ( m_pParticlePrecipInnerFar[nSlot] != NULL ) + if ( m_pParticlePrecipInnerFar[nSlot].IsValid() ) { m_pParticlePrecipInnerFar[nSlot]->StopEmission(); m_pParticlePrecipInnerFar[nSlot] = NULL; } - if ( m_pParticlePrecipInnerNear[nSlot] != NULL ) + if ( m_pParticlePrecipInnerNear[nSlot].IsValid() ) { m_pParticlePrecipInnerNear[nSlot]->StopEmission(); m_pParticlePrecipInnerNear[nSlot] = NULL; @@ -1288,7 +1288,7 @@ void CClient_Precipitation::DestroyInnerParticlePrecip( int nSlot ) void CClient_Precipitation::DestroyOuterParticlePrecip( int nSlot ) { - if ( m_pParticlePrecipOuter[nSlot] != NULL ) + if ( m_pParticlePrecipOuter[nSlot].IsValid() ) { m_pParticlePrecipOuter[nSlot]->StopEmission(); m_pParticlePrecipOuter[nSlot] = NULL; @@ -2020,7 +2020,7 @@ class CSnowFallManager : public C_BaseEntity void CreateSnowFallParticle( const Vector &vecParticleSpawn, int iBBox, C_BasePlayer *pLocalPlayer ); int StandingInSnowVolume( Vector &vecPoint ); - void FindSnowVolumes( Vector &vecCenter, float flRadius, Vector &vecEyePos, Vector &vecForward ); + void FindSnowVolumes( Vector &vecCenter, float flRadius, const Vector &vecEyePos, Vector &vecForward ); void UpdateBounds( const Vector &vecSnowMin, const Vector &vecSnowMax ); @@ -2225,7 +2225,7 @@ int CSnowFallManager::StandingInSnowVolume( Vector &vecPoint ) // Input : &vecCenter - // flRadius - //----------------------------------------------------------------------------- -void CSnowFallManager::FindSnowVolumes( Vector &vecCenter, float flRadius, Vector &vecEyePos, Vector &vecForward ) +void CSnowFallManager::FindSnowVolumes( Vector &vecCenter, float flRadius, const Vector &vecEyePos, Vector &vecForward ) { // Reset. m_nActiveSnowCount = 0; diff --git a/src/game/client/c_tracer.cpp b/src/game/client/c_tracer.cpp index 772c84a40..07d239063 100644 --- a/src/game/client/c_tracer.cpp +++ b/src/game/client/c_tracer.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -89,7 +89,7 @@ bool Tracer_ComputeVerts( const Vector &start, const Vector &delta, float width, } -void Tracer_Draw( CMeshBuilder *pMeshBuilder, Vector& start, Vector& delta, float width, float* color, float startV, float endV ) +void Tracer_Draw( CMeshBuilder *pMeshBuilder, const Vector& start, const Vector& delta, float width, float* color, float startV, float endV ) { // Clip the tracer Vector verts[4]; @@ -143,7 +143,7 @@ void Tracer_Draw( CMeshBuilder *pMeshBuilder, Vector& start, Vector& delta, floa //----------------------------------------------------------------------------- // draw a tracer. //----------------------------------------------------------------------------- -void Tracer_Draw( ParticleDraw* pDraw, Vector& start, Vector& delta, float width, float* color, float startV, float endV ) +void Tracer_Draw( ParticleDraw* pDraw, const Vector& start, const Vector& delta, float width, float* color, float startV, float endV ) { if( !pDraw->GetMeshBuilder() ) return; diff --git a/src/game/client/c_tracer.h b/src/game/client/c_tracer.h index 48deb6b5f..30c192b53 100644 --- a/src/game/client/c_tracer.h +++ b/src/game/client/c_tracer.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -23,10 +23,10 @@ class CMeshBuilder; // [in] float : The tracer width (CAMERA space) // [in] float* : r, g, b, a (0 - 1) //----------------------------------------------------------------------------- -void Tracer_Draw( ParticleDraw* pDraw, Vector& start, Vector& delta, +void Tracer_Draw( ParticleDraw* pDraw, const Vector& start, const Vector& delta, float width, float* color, float startV = 0.0, float endV = 1.0 ); -void Tracer_Draw( CMeshBuilder *pMeshBuilder, Vector& start, Vector& delta, float width, float* color, float startV = 0.0, float endV = 1.0 ); +void Tracer_Draw( CMeshBuilder *pMeshBuilder, const Vector& start, const Vector& delta, float width, float* color, float startV = 0.0, float endV = 1.0 ); //----------------------------------------------------------------------------- diff --git a/src/game/client/cdll_util.cpp b/src/game/client/cdll_util.cpp index b42b26ba3..d712b54c3 100644 --- a/src/game/client/cdll_util.cpp +++ b/src/game/client/cdll_util.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -348,7 +348,7 @@ void UTIL_Tracer( const Vector &vecStart, const Vector &vecEnd, int iEntIndex, i // Input : // Output : //------------------------------------------------------------------------------ -void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { C_BaseEntity *pEntity = pTrace->m_pEnt; diff --git a/src/game/client/cdll_util.h b/src/game/client/cdll_util.h index d67b53a40..cf22083bf 100644 --- a/src/game/client/cdll_util.h +++ b/src/game/client/cdll_util.h @@ -60,7 +60,7 @@ int UTIL_ComputeStringWidth( vgui::HFont& font, const wchar_t *str ); float UTIL_AngleDiff( float destAngle, float srcAngle ); void UTIL_Bubbles( const Vector& mins, const Vector& maxs, int count ); void UTIL_Smoke( const Vector &origin, const float scale, const float framerate ); -void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName = NULL ); +void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName = NULL ); int UTIL_PrecacheDecal( const char *name, bool preload = false ); void UTIL_EmitAmbientSound( C_BaseEntity *entity, const Vector &vecOrigin, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch ); void UTIL_SetOrigin( C_BaseEntity *entity, const Vector &vecOrigin ); diff --git a/src/game/client/clientsideeffects_test.cpp b/src/game/client/clientsideeffects_test.cpp index e615fb14d..648ec9f00 100644 --- a/src/game/client/clientsideeffects_test.cpp +++ b/src/game/client/clientsideeffects_test.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -281,7 +281,7 @@ void FX_TracerSound( const Vector &start, const Vector &end, int iTracerType ) CLocalPlayerFilter filter; enginesound->EmitSound( filter, SOUND_FROM_WORLD, CHAN_STATIC, params.soundname, - params.volume, SNDLVL_TO_ATTN(params.soundlevel), 0, params.pitch, &start, &shotDir, false); + params.volume, SNDLVL_TO_ATTN(params.soundlevel), 0, params.pitch, &start, &shotDir, NULL, false); } // FIXME: This has a bad behavior when both bullet + strider shots are whizzing by at the same time diff --git a/src/game/client/fx.h b/src/game/client/fx.h index 50ec90ccd..1802ee70c 100644 --- a/src/game/client/fx.h +++ b/src/game/client/fx.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -56,7 +56,7 @@ void FX_BugBlood( Vector &pos, Vector &dir, Vector &vWorldMins, Vector &vWorldMa void FX_Blood( Vector &pos, Vector &dir, float r, float g, float b, float a ); void FX_CreateImpactDust( Vector &origin, Vector &normal ); void FX_EnergySplash( const Vector &pos, const Vector &normal, int nFlags = FX_ENERGYSPLASH_DEFAULT ); -void FX_MicroExplosion( Vector &position, Vector &normal ); +void FX_MicroExplosion( const Vector &position, const Vector &normal ); void FX_Explosion( Vector& origin, Vector& normal, char materialType ); void FX_ConcussiveExplosion( Vector& origin, Vector& normal ); void FX_DustImpact( const Vector &origin, trace_t *tr, int iScale ); @@ -84,7 +84,7 @@ class CTeslaInfo Vector m_vPos; QAngle m_vAngles; int m_nEntIndex; - char *m_pszSpriteName; + const char *m_pszSpriteName; float m_flBeamWidth; int m_nBeams; Vector m_vColor; diff --git a/src/game/client/fx_sparks.cpp b/src/game/client/fx_sparks.cpp index 3102606bc..bf33bc8d3 100644 --- a/src/game/client/fx_sparks.cpp +++ b/src/game/client/fx_sparks.cpp @@ -950,7 +950,7 @@ void FX_EnergySplash( const Vector &pos, const Vector &normal, int nFlags ) #define MICRO_EXPLOSION_GRAVITY 0.0f #define MICRO_EXPLOSION_DAMPEN 0.4f -void FX_MicroExplosion( Vector &position, Vector &normal ) +void FX_MicroExplosion( const Vector &position, const Vector &normal ) { VPROF_BUDGET( "FX_MicroExplosion", VPROF_BUDGETGROUP_PARTICLE_RENDERING ); Vector offset = position + ( normal * 2.0f ); diff --git a/src/game/client/swarm/c_asw_marine.h b/src/game/client/swarm/c_asw_marine.h index 6940104c2..259b0a7bb 100644 --- a/src/game/client/swarm/c_asw_marine.h +++ b/src/game/client/swarm/c_asw_marine.h @@ -94,7 +94,7 @@ class C_ASW_Marine : public C_ASW_VPhysics_NPC, public IASWPlayerAnimStateHelper // ammo int GetAllAmmoCount( void ); int GetTotalAmmoCount(int iAmmoIndex); - int GetTotalAmmoCount(char *szName); + int GetTotalAmmoCount(const char *szName); int GetWeaponAmmoCount(int iAmmoIndex); int GetWeaponAmmoCount(char *szName); int GetNumberOfWeaponsUsingAmmo(int iAmmoType); @@ -271,7 +271,7 @@ class C_ASW_Marine : public C_ASW_VPhysics_NPC, public IASWPlayerAnimStateHelper virtual bool TestHitboxes( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr ); CNetworkVar(float, m_fInfestedTime); // how many seconds of infestation we have left CNetworkVar(float, m_fInfestedStartTime); // when the marine first got infested - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); virtual C_ClientRagdoll* CreateClientRagdoll( bool bRestoring = false ); virtual C_BaseAnimating* BecomeRagdollOnClient(); virtual void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ); diff --git a/src/game/server/CommentarySystem.cpp b/src/game/server/CommentarySystem.cpp index 3339a2277..8c796c9da 100644 --- a/src/game/server/CommentarySystem.cpp +++ b/src/game/server/CommentarySystem.cpp @@ -1102,7 +1102,7 @@ bool IsListeningToCommentary( void ) void CPointCommentaryNode::Spawn( void ) { // No model specified? - char *szModel = (char *)STRING( GetModelName() ); + const char *szModel = STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/extras/info_speech.mdl"; diff --git a/src/game/server/ai_basenpc.cpp b/src/game/server/ai_basenpc.cpp index 66f5cf568..12108622e 100644 --- a/src/game/server/ai_basenpc.cpp +++ b/src/game/server/ai_basenpc.cpp @@ -1189,7 +1189,7 @@ void CAI_BaseNPC::DecalTrace( trace_t *pTrace, char const *decalName ) //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -void CAI_BaseNPC::ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ) +void CAI_BaseNPC::ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ) { if ( m_fNoDamageDecal ) { diff --git a/src/game/server/ai_basenpc.h b/src/game/server/ai_basenpc.h index 5b2fd6915..d31a0a175 100644 --- a/src/game/server/ai_basenpc.h +++ b/src/game/server/ai_basenpc.h @@ -1826,7 +1826,7 @@ class CAI_BaseNPC : public CBaseCombatCharacter, virtual float GetHitgroupDamageMultiplier( int iHitGroup, const CTakeDamageInfo &info ); void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ); void DecalTrace( trace_t *pTrace, char const *decalName ); - void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); virtual bool PlayerInSpread( const Vector &sourcePos, const Vector &targetPos, float flSpread, float maxDistOffCenter, bool ignoreHatedPlayers = true ); CBaseEntity * PlayerInRange( const Vector &vecLocation, float flDist ); bool PointInSpread( CBaseCombatCharacter *pCheckEntity, const Vector &sourcePos, const Vector &targetPos, const Vector &testPoint, float flSpread, float maxDistOffCenter ); @@ -2449,7 +2449,7 @@ typedef CHandle AIHANDLE; #define DEFINE_SCHEDULE( id, text ) \ scheduleIds.PushBack( #id, id ); \ - char * g_psz##id = \ + const char * g_psz##id = \ "\n Schedule" \ "\n " #id \ text \ diff --git a/src/game/server/baseentity.cpp b/src/game/server/baseentity.cpp index c8aef63c8..1918ad152 100644 --- a/src/game/server/baseentity.cpp +++ b/src/game/server/baseentity.cpp @@ -5325,7 +5325,7 @@ void CBaseEntity::PrecacheSoundHelper( const char *pName ) return; } - if ( UTL_INVAL_SYMBOL == g_ModelSoundsSymbolHelper.Find( pName ) ) + if ( !g_ModelSoundsSymbolHelper.Find( pName ).IsValid() ) { g_ModelSoundsSymbolHelper.AddString( pName ); diff --git a/src/game/server/baseentity.h b/src/game/server/baseentity.h index b2b14bdaf..1c73919e7 100644 --- a/src/game/server/baseentity.h +++ b/src/game/server/baseentity.h @@ -893,7 +893,7 @@ class CBaseEntity : public IServerEntity bool IsWorld() const { extern CWorld *g_WorldEntity; return (void *)this == (void *)g_WorldEntity; } virtual char const *DamageDecal( int bitsDamageType, int gameMaterial ); virtual void DecalTrace( trace_t *pTrace, char const *decalName ); - virtual void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName = NULL ); + virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName = NULL ); void AddPoints( int score, bool bAllowNegativeScore ); void AddPointsToTeam( int score, bool bAllowNegativeScore ); @@ -1052,7 +1052,7 @@ class CBaseEntity : public IServerEntity #ifdef _DEBUG void FunctionCheck( void *pFunction, const char *name ); - ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name ) + ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name ) { #ifdef GNUC COMPILE_TIME_ASSERT( sizeof(func) == 8 ); @@ -1063,7 +1063,7 @@ class CBaseEntity : public IServerEntity FunctionCheck( *(reinterpret_cast(&m_pfnTouch)), name ); return func; } - USEPTR UseSet( USEPTR func, char *name ) + USEPTR UseSet( USEPTR func, const char *name ) { #ifdef GNUC COMPILE_TIME_ASSERT( sizeof(func) == 8 ); @@ -1074,7 +1074,7 @@ class CBaseEntity : public IServerEntity FunctionCheck( *(reinterpret_cast(&m_pfnUse)), name ); return func; } - ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, char *name ) + ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, const char *name ) { #ifdef GNUC COMPILE_TIME_ASSERT( sizeof(func) == 8 ); diff --git a/src/game/server/buttons.cpp b/src/game/server/buttons.cpp index e70968ac5..149268373 100644 --- a/src/game/server/buttons.cpp +++ b/src/game/server/buttons.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ==== +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ==== // // Purpose: Implements buttons. // @@ -804,7 +804,7 @@ int CBaseButton::DrawDebugTextOverlays() if (m_debugOverlays & OVERLAY_TEXT_BIT) { - static char *pszStates[] = + static const char *pszStates[] = { "Pressed", "Unpressed", diff --git a/src/game/server/episodic/npc_hunter.cpp b/src/game/server/episodic/npc_hunter.cpp index c5006db48..14ca8c8e1 100644 --- a/src/game/server/episodic/npc_hunter.cpp +++ b/src/game/server/episodic/npc_hunter.cpp @@ -6464,7 +6464,7 @@ const char *CNPC_Hunter::SelectRandomExpressionForState( NPC_STATE state ) if ( !hunter_random_expressions.GetBool() ) return NULL; - char *szExpressions[4] = + const char *szExpressions[4] = { "scenes/npc/hunter/hunter_scan.vcd", "scenes/npc/hunter/hunter_eyeclose.vcd", diff --git a/src/game/server/func_break.cpp b/src/game/server/func_break.cpp index 7af9742ed..39c434812 100644 --- a/src/game/server/func_break.cpp +++ b/src/game/server/func_break.cpp @@ -435,7 +435,7 @@ void CBreakable::DamageSound( void ) { int pitch; float fvol; - char *soundname = NULL; + const char *soundname = NULL; int material = m_Material; if (random->RandomInt(0,2)) diff --git a/src/game/server/gameinterface.cpp b/src/game/server/gameinterface.cpp index 08a4bc373..b621c764a 100644 --- a/src/game/server/gameinterface.cpp +++ b/src/game/server/gameinterface.cpp @@ -1725,8 +1725,8 @@ void CServerGameDLL::PreSave( CSaveRestoreData *s ) // This little hack lets me marry BSP names to messages in titles.txt typedef struct { - char *pBSPName; - char *pTitleName; + const char *pBSPName; + const char *pTitleName; } TITLECOMMENT; // this list gets searched for the first partial match, so some are out of order diff --git a/src/game/server/hl2/npc_bullseye.h b/src/game/server/hl2/npc_bullseye.h index f897bac4c..09c5fdbd3 100644 --- a/src/game/server/hl2/npc_bullseye.h +++ b/src/game/server/hl2/npc_bullseye.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -34,7 +34,7 @@ class CNPC_Bullseye : public CAI_BaseNPC Class_T Classify( void ); void Event_Killed( const CTakeDamageInfo &info ); void DecalTrace( trace_t *pTrace, char const *decalName ); - void ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName ); + void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName ); bool IsLightDamage( const CTakeDamageInfo &info ); void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ); int OnTakeDamage( const CTakeDamageInfo &info ); diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 18f1c6eee..eb2c382df 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -4242,7 +4242,7 @@ void CBasePlayer::CheckSuitUpdate() // seconds, then we won't repeat playback of this word or sentence // for at least that number of seconds. -void CBasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeatTime) +void CBasePlayer::SetSuitUpdate(const char *name, int fgroup, int iNoRepeatTime) { int i; int isentence; diff --git a/src/game/server/player.h b/src/game/server/player.h index 608fa2620..a2ab9cc9e 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2009, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2009, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -583,7 +583,7 @@ class CBasePlayer : public CBaseCombatCharacter virtual float GetHeldObjectMass( IPhysicsObject *pHeldObject ); void CheckSuitUpdate(); - void SetSuitUpdate(char *name, int fgroup, int iNoRepeat); + void SetSuitUpdate(const char *name, int fgroup, int iNoRepeat); virtual void UpdateGeigerCounter( void ); void CheckTimeBasedDamage( void ); diff --git a/src/game/server/sceneentity.cpp b/src/game/server/sceneentity.cpp index 46f724e60..a534e1949 100644 --- a/src/game/server/sceneentity.cpp +++ b/src/game/server/sceneentity.cpp @@ -2282,16 +2282,16 @@ void CSceneEntity::InputInterjectResponse( inputdata_t &inputdata ) char modifiers[ 512 ]; Q_snprintf( modifiers, sizeof( modifiers ), "scene:%s", STRING( GetEntityName() ) ); - AIConcept_t concept(inputdata.value.String()); + AIConcept_t conceptName(inputdata.value.String()); for ( int i = 0; i < c; i++ ) { CAI_BaseActor *npc = candidates[ i ]; Assert( npc ); AI_CriteriaSet set; - npc->GatherCriteria( &set, concept, modifiers ); + npc->GatherCriteria( &set, conceptName, modifiers ); AI_Response response; - if ( !npc->FindResponse( response, concept, &set ) ) + if ( !npc->FindResponse( response, conceptName, &set ) ) continue; float duration = npc->GetResponseDuration( &response ); @@ -3453,7 +3453,7 @@ void MissingSceneWarning( char const *scenename ) static CUtlSymbolTable missing; // Make sure we only show the message once - if ( UTL_INVAL_SYMBOL == missing.Find( scenename ) ) + if ( !missing.Find( scenename ).IsValid() ) { missing.AddString( scenename ); @@ -4755,7 +4755,7 @@ END_DATADESC() int SceneNameAutocomplete( char const *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] ) { // chop the command off the begining of the string - char *commandName = "scene_playvcd"; + const char *commandName = "scene_playvcd"; int numMatches = 0; partial += Q_strlen( commandName ) + 1; int partialLength = Q_strlen( partial ); diff --git a/src/game/server/swarm/asw_broadcast_camera.cpp b/src/game/server/swarm/asw_broadcast_camera.cpp index ebd972927..ac595644b 100644 --- a/src/game/server/swarm/asw_broadcast_camera.cpp +++ b/src/game/server/swarm/asw_broadcast_camera.cpp @@ -526,7 +526,7 @@ void CASW_Broadcast_Camera::Move() // Subtract movement from the previous frame //m_moveDistance -= m_flSpeed * gpGlobals->frametime; - m_moveDistance -= VectorNormalize(GetAbsOrigin() - m_vecLastPos); + m_moveDistance -= VectorLength( GetAbsOrigin() - m_vecLastPos ); // Have we moved enough to reach the target? if ( m_moveDistance <= 0 ) diff --git a/src/game/server/swarm/asw_drone_advanced.cpp b/src/game/server/swarm/asw_drone_advanced.cpp index 4c33332a7..cbfef16f2 100644 --- a/src/game/server/swarm/asw_drone_advanced.cpp +++ b/src/game/server/swarm/asw_drone_advanced.cpp @@ -954,7 +954,7 @@ void CASW_Drone_Advanced::StartTouch( CBaseEntity *pOther ) } } -void CASW_Drone_Advanced::MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ) +void CASW_Drone_Advanced::MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ) { Vector vecForceDir; diff --git a/src/game/server/swarm/asw_drone_advanced.h b/src/game/server/swarm/asw_drone_advanced.h index be1632965..959da165c 100644 --- a/src/game/server/swarm/asw_drone_advanced.h +++ b/src/game/server/swarm/asw_drone_advanced.h @@ -28,7 +28,7 @@ class CASW_Drone_Advanced : public CASW_Alien_Jumper virtual int MeleeAttack1Conditions( float flDot, float flDist ); virtual int MeleeAttack2Conditions( float flDot, float flDist ); - void MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ); + void MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ); virtual bool MovementCost( int moveType, const Vector &vecStart, const Vector &vecEnd, float *pCost ); diff --git a/src/game/server/swarm/asw_marine.cpp b/src/game/server/swarm/asw_marine.cpp index c8f1668d5..18fd0c34e 100644 --- a/src/game/server/swarm/asw_marine.cpp +++ b/src/game/server/swarm/asw_marine.cpp @@ -3644,8 +3644,8 @@ void CASW_Marine::Script_Speak( const char *pszConcept, float delay, const char criteria.Merge( pszCriteria ); } - AIConcept_t concept( pszConcept ); - QueueSpeak( concept, this, delay, criteria ); + AIConcept_t conceptName( pszConcept ); + QueueSpeak( conceptName, this, delay, criteria ); } void CASW_Marine::SetMarineRolls( bool bRolls ) diff --git a/src/game/server/swarm/asw_marine.h b/src/game/server/swarm/asw_marine.h index 7170f955b..a3c4214e1 100644 --- a/src/game/server/swarm/asw_marine.h +++ b/src/game/server/swarm/asw_marine.h @@ -513,7 +513,7 @@ class CASW_Marine : public CASW_VPhysics_NPC, public IASWPlayerAnimStateHelpers, virtual void TookAmmoPickup( CBaseEntity* pAmmoPickup ); int GetAllAmmoCount( void ); int GetTotalAmmoCount(int iAmmoIndex); - int GetTotalAmmoCount(char *szName); + int GetTotalAmmoCount(const char *szName); int GetWeaponAmmoCount(int iAmmoIndex); int GetWeaponAmmoCount(char *szName); void ThrowAmmo(int iInventorySlot, int iTargetMarine, int iAmmoType); // throwing ammo from the ammo bag diff --git a/src/game/server/swarm/asw_shieldbug.cpp b/src/game/server/swarm/asw_shieldbug.cpp index b9b12457f..e5def0eeb 100644 --- a/src/game/server/swarm/asw_shieldbug.cpp +++ b/src/game/server/swarm/asw_shieldbug.cpp @@ -657,7 +657,7 @@ int CASW_Shieldbug::MeleeAttack1Conditions( float flDot, float flDist ) return COND_CAN_MELEE_ATTACK1; } -void CASW_Shieldbug::MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ) +void CASW_Shieldbug::MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ) { Vector vecForceDir; diff --git a/src/game/server/swarm/asw_shieldbug.h b/src/game/server/swarm/asw_shieldbug.h index 8e51a074b..154c166d1 100644 --- a/src/game/server/swarm/asw_shieldbug.h +++ b/src/game/server/swarm/asw_shieldbug.h @@ -29,7 +29,7 @@ class CASW_Shieldbug : public CASW_Alien_Shover, public IShieldbugAutoList float GetSequenceGroundSpeed( int iSequence ); int MeleeAttack1Conditions( float flDot, float flDist ); int MeleeAttack2Conditions ( float flDot, float flDist ); - void MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ); + void MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ); float MaxYawSpeed( void ); void HandleAnimEvent( animevent_t *pEvent ); Class_T Classify( void ) { return (Class_T) CLASS_ASW_SHIELDBUG; } diff --git a/src/game/server/swarm/asw_simple_alien.cpp b/src/game/server/swarm/asw_simple_alien.cpp index 1b2fbe7fe..15d769bb1 100644 --- a/src/game/server/swarm/asw_simple_alien.cpp +++ b/src/game/server/swarm/asw_simple_alien.cpp @@ -274,7 +274,7 @@ void CASW_Simple_Alien::SetState( int iNewState ) // Movement // ========================================= -void CASW_Simple_Alien::SetMoveTarget( Vector &vecTarget ) +void CASW_Simple_Alien::SetMoveTarget( const Vector &vecTarget ) { m_vecMoveTarget = vecTarget; m_hMoveTarget = NULL; @@ -684,7 +684,7 @@ bool CASW_Simple_Alien::ShouldAttack() return ( dist < 100.0f ); } -void CASW_Simple_Alien::MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ) +void CASW_Simple_Alien::MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ) { Vector vecForceDir; diff --git a/src/game/server/swarm/asw_simple_alien.h b/src/game/server/swarm/asw_simple_alien.h index 56ce60a37..3c25016ac 100644 --- a/src/game/server/swarm/asw_simple_alien.h +++ b/src/game/server/swarm/asw_simple_alien.h @@ -46,7 +46,7 @@ class CASW_Simple_Alien : public CBaseAnimating, public IASW_Spawnable_NPC // movement virtual Vector PickRandomDestination(float dist, Vector bias); - virtual void SetMoveTarget(Vector &vecTarget); + virtual void SetMoveTarget(const Vector &vecTarget); virtual float GetIdealSpeed() const; virtual float GetYawSpeed() const; virtual float GetIdealYaw(); @@ -71,7 +71,7 @@ class CASW_Simple_Alien : public CBaseAnimating, public IASW_Spawnable_NPC int m_iState; // attacking - virtual void MeleeAttack( float distance, float damage, QAngle &viewPunch, Vector &shove ); + virtual void MeleeAttack( float distance, float damage, const QAngle &viewPunch, const Vector &shove ); virtual CBaseEntity *CheckTraceHullAttack( float flDist, const Vector &mins, const Vector &maxs, int iDamage, int iDmgType, float forceScale = 1.0f, bool bDamageAnyNPC = false ); virtual CBaseEntity *CheckTraceHullAttack( const Vector &vStart, const Vector &vEnd, const Vector &mins, const Vector &maxs, int iDamage, int iDmgType, float flForceScale = 1.0f, bool bDamageAnyNPC = false ); virtual void ReachedEndOfSequence(); diff --git a/src/game/server/util.h b/src/game/server/util.h index 5b9b2bd59..5cf3dfe31 100644 --- a/src/game/server/util.h +++ b/src/game/server/util.h @@ -328,7 +328,7 @@ void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color void UTIL_BloodSpray( const Vector &pos, const Vector &dir, int color, int amount, int flags ); void UTIL_BloodSprayPrecache(); Vector UTIL_RandomBloodVector( void ); -void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, char *pCustomImpactName = NULL ); +void UTIL_ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName = NULL ); void UTIL_PlayerDecalTrace( trace_t *pTrace, int playernum ); void UTIL_Smoke( const Vector &origin, const float scale, const float framerate ); void UTIL_AxisStringToPointDir( Vector &start, Vector &dir, const char *pString ); @@ -450,7 +450,7 @@ void UTIL_HudMessage( CBasePlayer *pToPlayer, const hudtextparms_t &textparms, void UTIL_HudHintText( CBaseEntity *pEntity, const char *pMessage ); // Writes message to console with timestamp and FragLog header. -void UTIL_LogPrintf( char *fmt, ... ); +void UTIL_LogPrintf( const char *fmt, ... ); // Sorta like FInViewCone, but for nonNPCs. float UTIL_DotPoints ( const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir ); diff --git a/src/game/shared/SoundEmitterSystem.cpp b/src/game/shared/SoundEmitterSystem.cpp index 265851fd8..67defffd3 100644 --- a/src/game/shared/SoundEmitterSystem.cpp +++ b/src/game/shared/SoundEmitterSystem.cpp @@ -154,7 +154,7 @@ void WaveTrace( char const *wavname, char const *funcname ) static CUtlSymbolTable s_WaveTrace; // Make sure we only show the message once - if ( UTL_INVAL_SYMBOL == s_WaveTrace.Find( wavname ) ) + if ( !s_WaveTrace.Find( wavname ).IsValid() ) { DevMsg( "%s directly referenced wave %s (should use game_sounds.txt system instead)\n", funcname, wavname ); @@ -244,7 +244,7 @@ class CSoundEmitterSystem : public CBaseGameSystem return; // Make sure we only show the message once - if ( UTL_INVAL_SYMBOL != m_PrecachedScriptSounds.Find( soundname ) ) + if ( m_PrecachedScriptSounds.Find( soundname ).IsValid() ) return; if (m_hPrecacheLogFile == FILESYSTEM_INVALID_HANDLE) @@ -512,7 +512,7 @@ class CSoundEmitterSystem : public CBaseGameSystem static CUtlSymbolTable s_PrecacheScriptSoundFailures; // Make sure we only show the message once - if ( UTL_INVAL_SYMBOL == s_PrecacheScriptSoundFailures.Find( soundname ) ) + if ( !s_PrecacheScriptSoundFailures.Find( soundname ).IsValid() ) { Warning( "PrecacheScriptSound '%s' failed, no such sound script entry\n", soundname ); s_PrecacheScriptSoundFailures.AddString( soundname ); diff --git a/src/game/shared/swarm/rd_inventory_shared.cpp b/src/game/shared/swarm/rd_inventory_shared.cpp index 024507b23..d92bc7edc 100644 --- a/src/game/shared/swarm/rd_inventory_shared.cpp +++ b/src/game/shared/swarm/rd_inventory_shared.cpp @@ -1492,7 +1492,7 @@ static class CRD_Inventory_Manager final : public CAutoGameSystem, public CGameE const ReactiveDropInventory::ItemDef_t *pDef = ReactiveDropInventory::GetItemDef( g_RD_Crafting_Material_Info[eMaterial].m_iItemDef ); char szErrorCode[16]; V_snprintf( szErrorCode, sizeof( szErrorCode ), "%d", eResult ); - ClientPrint( NULL, ASW_HUD_PRINTTALKANDCONSOLE, "#rd_crafting_pickup_error", pDef ? pDef->Name : "?err?",szErrorCode, UTIL_RD_EResultToString( eResult ) ); + ClientPrint( NULL, ASW_HUD_PRINTTALKANDCONSOLE, "#rd_crafting_pickup_error", pDef ? (const char *)pDef->Name : "?err?",szErrorCode, UTIL_RD_EResultToString( eResult ) ); } #endif diff --git a/src/game/shared/swarm/rd_lobby_utils.cpp b/src/game/shared/swarm/rd_lobby_utils.cpp index 206ec4835..31385fd13 100644 --- a/src/game/shared/swarm/rd_lobby_utils.cpp +++ b/src/game/shared/swarm/rd_lobby_utils.cpp @@ -236,7 +236,7 @@ void UTIL_RD_ReadLobbyScoreboard( CSteamID lobby, CUtlVectorSetValue( m_hControlTable, "look_x", flLookX / MAX_BUTTONSAMPLE ); g_pScriptVM->SetValue( m_hControlTable, "look_y", flLookY / MAX_BUTTONSAMPLE ); - g_pScriptVM->SetValue( m_hControlTable, "focus", m_iControllerFocusIndex == -1 ? SCRIPT_VARIANT_NULL : m_ButtonDefs[m_iControllerFocusIndex]->m_hThis ); + g_pScriptVM->SetValue( m_hControlTable, "focus", m_iControllerFocusIndex == -1 ? SCRIPT_VARIANT_NULL : ScriptVariant_t( m_ButtonDefs[m_iControllerFocusIndex]->m_hThis ) ); } void CRD_VGui_VScript::InitButtonPanels( vgui::Panel *pParent ) diff --git a/src/game/shared/usercmd.cpp b/src/game/shared/usercmd.cpp index d66e4be30..dc350086f 100644 --- a/src/game/shared/usercmd.cpp +++ b/src/game/shared/usercmd.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -25,7 +25,7 @@ ConVar net_showusercmd( "net_showusercmd", "0", 0, "Show user command encoding" #endif //----------------------------------------------------------------------------- -static bool WriteUserCmdDeltaInt( bf_write *buf, char *what, int from, int to, int bits = 32 ) +static bool WriteUserCmdDeltaInt( bf_write *buf, const char *what, int from, int to, int bits = 32 ) { if ( from != to ) { @@ -40,7 +40,7 @@ static bool WriteUserCmdDeltaInt( bf_write *buf, char *what, int from, int to, i return false; } -static bool WriteUserCmdDeltaShort( bf_write *buf, char *what, int from, int to ) +static bool WriteUserCmdDeltaShort( bf_write *buf, const char *what, int from, int to ) { if ( from != to ) { @@ -55,7 +55,7 @@ static bool WriteUserCmdDeltaShort( bf_write *buf, char *what, int from, int to return false; } -static bool WriteUserCmdDeltaFloat( bf_write *buf, char *what, float from, float to ) +static bool WriteUserCmdDeltaFloat( bf_write *buf, const char *what, float from, float to ) { if ( from != to ) { @@ -70,7 +70,7 @@ static bool WriteUserCmdDeltaFloat( bf_write *buf, char *what, float from, float return false; } -static bool WriteUserCmdDeltaCoord( bf_write *buf, char *what, float from, float to ) +static bool WriteUserCmdDeltaCoord( bf_write *buf, const char *what, float from, float to ) { if ( from != to ) { @@ -85,7 +85,7 @@ static bool WriteUserCmdDeltaCoord( bf_write *buf, char *what, float from, float return false; } -static bool WriteUserCmdDeltaAngle( bf_write *buf, char *what, float from, float to, int bits ) +static bool WriteUserCmdDeltaAngle( bf_write *buf, const char *what, float from, float to, int bits ) { if ( from != to ) { @@ -100,7 +100,7 @@ static bool WriteUserCmdDeltaAngle( bf_write *buf, char *what, float from, float return false; } -static bool WriteUserCmdDeltaVec3Coord( bf_write *buf, char *what, const Vector &from, const Vector &to ) +static bool WriteUserCmdDeltaVec3Coord( bf_write *buf, const char *what, const Vector &from, const Vector &to ) { if ( from != to ) { diff --git a/src/game/shared/util_shared.cpp b/src/game/shared/util_shared.cpp index 2245979df..49a8593ac 100644 --- a/src/game/shared/util_shared.cpp +++ b/src/game/shared/util_shared.cpp @@ -1353,7 +1353,7 @@ char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *p { DevWarning( "Can't get key value '%s' from file '%s'.\n", pName, pFilename ); } - return ""; + return (char *)""; } int len = Q_strlen( pValue ) + 1; From 9f7577373d7331a590695850dea400d67b16e001 Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:30 +0200 Subject: [PATCH 11/13] C++14 to C++20: fix C2666/C2593/C2445 (rewritten comparisons) C++20 adds rewritten comparison candidates, so the legacy comparisons became ambiguous: CUtlSymbol and FileNameHandle_t results are tested with IsValid(), and EHANDLE and ScriptVariant_t are constructed explicitly at the handle and script boundaries. --- src/game/client/bone_merge_cache.cpp | 4 ++-- src/game/client/hud_closecaption.cpp | 4 ++-- src/game/client/swarm/rd_steam_input.cpp | 2 +- src/game/client/swarm/vgui/tabbedgriddetails.cpp | 8 ++++---- src/game/server/global_event_log.cpp | 2 +- src/game/server/swarm/asw_ai_behavior_charge.cpp | 4 ++-- src/game/server/swarm/asw_ai_behavior_melee.cpp | 4 ++-- src/game/server/swarm/asw_marine_schedule.cpp | 2 +- src/game/shared/sharedvar.h | 4 ++-- src/game/shared/swarm/rd_workshop.cpp | 2 +- src/public/particles/particles.h | 2 +- src/public/tier1/UtlStringMap.h | 4 ++-- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/game/client/bone_merge_cache.cpp b/src/game/client/bone_merge_cache.cpp index 8b7b49809..094c66a0d 100644 --- a/src/game/client/bone_merge_cache.cpp +++ b/src/game/client/bone_merge_cache.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -96,7 +96,7 @@ void CBoneMergeCache::UpdateCache() m_pFollowHdr->pBone( parentBoneIndex )->pszName(), m_pFollowHdr->pszName() ); static CUtlSymbolTableMT s_FollowerWarnings; - if ( UTL_INVAL_SYMBOL == s_FollowerWarnings.Find( sz ) ) + if ( !s_FollowerWarnings.Find( sz ).IsValid() ) { s_FollowerWarnings.AddString( sz ); Warning( "%s", sz ); diff --git a/src/game/client/hud_closecaption.cpp b/src/game/client/hud_closecaption.cpp index 07fee7b85..6b87da90a 100644 --- a/src/game/client/hud_closecaption.cpp +++ b/src/game/client/hud_closecaption.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -2004,7 +2004,7 @@ static bool CaptionTrace( const char *token ) static CUtlSymbolTable s_MissingCloseCaptions; // Make sure we only show the message once - if ( UTL_INVAL_SYMBOL == s_MissingCloseCaptions.Find( token ) ) + if ( !s_MissingCloseCaptions.Find( token ).IsValid() ) { s_MissingCloseCaptions.AddString( token ); return true; diff --git a/src/game/client/swarm/rd_steam_input.cpp b/src/game/client/swarm/rd_steam_input.cpp index 692b05f73..1518128d1 100644 --- a/src/game/client/swarm/rd_steam_input.cpp +++ b/src/game/client/swarm/rd_steam_input.cpp @@ -184,7 +184,7 @@ void CRD_Steam_Input::Update( float frametime ) // Check for text input focus even if we're not using Steam Input. static vgui::DHANDLE s_hTextEntryFocus; vgui::TextEntry *pTextEntry = dynamic_cast< vgui::TextEntry * >( vgui::ipanel()->GetPanel( vgui::input()->GetFocus(), vgui::GetControlsModuleName() ) ); - if ( s_hTextEntryFocus != pTextEntry ) + if ( s_hTextEntryFocus.Get() != pTextEntry ) { s_hTextEntryFocus = pTextEntry; diff --git a/src/game/client/swarm/vgui/tabbedgriddetails.cpp b/src/game/client/swarm/vgui/tabbedgriddetails.cpp index 1d0681f7b..49f353929 100644 --- a/src/game/client/swarm/vgui/tabbedgriddetails.cpp +++ b/src/game/client/swarm/vgui/tabbedgriddetails.cpp @@ -313,15 +313,15 @@ void TabbedGridDetails::ShowFullScreen() { if ( g_hBriefingFrame ) { - SetParent( g_hBriefingFrame ); + SetParent( g_hBriefingFrame.Get() ); } else if ( GetClientModeASW()->m_hCampaignFrame ) { - SetParent( GetClientModeASW()->m_hCampaignFrame ); + SetParent( GetClientModeASW()->m_hCampaignFrame.Get() ); } else if ( GetClientModeASW()->m_hMissionCompleteFrame ) { - SetParent( GetClientModeASW()->m_hMissionCompleteFrame ); + SetParent( GetClientModeASW()->m_hMissionCompleteFrame.Get() ); } else if ( engine->IsConnected() ) { @@ -938,7 +938,7 @@ void TGD_Grid::DisplayEntry( TGD_Entry *pEntry ) m_pParent->m_pHighlight->SetVisible( true ); m_pParent->m_pLabelHighlight->SetVisible( true ); - if ( m_pParent->m_pParent->m_hCurrentTab != m_pParent ) + if ( m_pParent->m_pParent->m_hCurrentTab.Get() != m_pParent ) { m_pParent->m_pParent->m_hCurrentTab = m_pParent; if ( m_pParent->m_pParent->m_pLastTabConVar ) diff --git a/src/game/server/global_event_log.cpp b/src/game/server/global_event_log.cpp index 7a078b5a5..205a2dac7 100644 --- a/src/game/server/global_event_log.cpp +++ b/src/game/server/global_event_log.cpp @@ -64,7 +64,7 @@ void CGlobalEventLine::Clear( ) bool CGlobalEventLine::SetStaticText( const char *pszValue ) { - if ( m_ValueSymbol != UTL_INVAL_SYMBOL && m_ValueSymbol == EventSymbols.Find( pszValue ) ) + if ( m_ValueSymbol.IsValid() && m_ValueSymbol == EventSymbols.Find( pszValue ) ) { return false; } diff --git a/src/game/server/swarm/asw_ai_behavior_charge.cpp b/src/game/server/swarm/asw_ai_behavior_charge.cpp index 79c638857..c132881ac 100644 --- a/src/game/server/swarm/asw_ai_behavior_charge.cpp +++ b/src/game/server/swarm/asw_ai_behavior_charge.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -255,7 +255,7 @@ void CAI_ASW_ChargeBehavior::StartTask( const Task_t *pTask ) MovementActivity = ACT_RUN_AGITATED; } - if ( m_IsCrouched != UTL_INVAL_SYMBOL ) + if ( m_IsCrouched.IsValid() ) { if ( GetBehaviorParam( m_IsCrouched ) != 0 ) { diff --git a/src/game/server/swarm/asw_ai_behavior_melee.cpp b/src/game/server/swarm/asw_ai_behavior_melee.cpp index 0c730e2af..0a82bea4a 100644 --- a/src/game/server/swarm/asw_ai_behavior_melee.cpp +++ b/src/game/server/swarm/asw_ai_behavior_melee.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: NPC does a melee attack against his enemy when close enough. Uses MeleeAttack1Conditions. // @@ -371,7 +371,7 @@ void CAI_ASW_MeleeBehavior::HullAttack( float flDistance, float flDamage, float { SetBehaviorParam( m_StatusParm, 1 ); // Play a random attack hit sound - if ( AttackHitSound != UTL_INVAL_SYMBOL ) + if ( AttackHitSound.IsValid() ) { GetOuter()->EmitSound( GetSymbolText( AttackHitSound ) ); } diff --git a/src/game/server/swarm/asw_marine_schedule.cpp b/src/game/server/swarm/asw_marine_schedule.cpp index b6543b1ce..60d23eb21 100644 --- a/src/game/server/swarm/asw_marine_schedule.cpp +++ b/src/game/server/swarm/asw_marine_schedule.cpp @@ -870,7 +870,7 @@ int CASW_Marine::SelectTakeAmmoSchedule() } } - EHANDLE hAmmo = ( m_hTakeAmmo.Get() ? m_hTakeAmmo : ( m_hTakeAmmoDrop.Get() ? m_hTakeAmmoDrop : NULL ) ); + EHANDLE hAmmo = m_hTakeAmmo.Get() ? EHANDLE( m_hTakeAmmo ) : ( m_hTakeAmmoDrop.Get() ? EHANDLE( m_hTakeAmmoDrop ) : EHANDLE() ); if ( hAmmo != NULL ) { diff --git a/src/game/shared/sharedvar.h b/src/game/shared/sharedvar.h index 5746388d2..8a3ddfb27 100644 --- a/src/game/shared/sharedvar.h +++ b/src/game/shared/sharedvar.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -40,7 +40,7 @@ { if ( iIn == INVALID_NETWORKED_EHANDLE_VALUE ) { - return INVALID_EHANDLE_INDEX; + return EHANDLE( INVALID_EHANDLE_INDEX ); } else { diff --git a/src/game/shared/swarm/rd_workshop.cpp b/src/game/shared/swarm/rd_workshop.cpp index 56aba15d7..7b7cfe189 100644 --- a/src/game/shared/swarm/rd_workshop.cpp +++ b/src/game/shared/swarm/rd_workshop.cpp @@ -2957,7 +2957,7 @@ void CReactiveDropWorkshop::RemoveDuplicateTags() FOR_EACH_VEC_BACK( m_aszTags, i ) { - if ( existing.Find( m_aszTags[i] ) != UTL_INVAL_SYMBOL ) + if ( existing.Find( m_aszTags[i] ).IsValid() ) { delete m_aszTags[i]; m_aszTags.Remove( i ); diff --git a/src/public/particles/particles.h b/src/public/particles/particles.h index f2ddde7a7..62743d41f 100644 --- a/src/public/particles/particles.h +++ b/src/public/particles/particles.h @@ -1718,7 +1718,7 @@ class CParticleCollection // the camera objetc may be compared for equality against control point objects void Render( IMatRenderContext *pRenderContext, const Vector4D &vecDiffuseModulation, bool bTranslucentOnly = false, void *pCameraObject = NULL ); - bool IsValid( void ) const { return m_pDef != NULL; } + bool IsValid( void ) const { return m_pDef.IsValid(); } // this system and all children are valid bool IsFullyValid( void ) const; diff --git a/src/public/tier1/UtlStringMap.h b/src/public/tier1/UtlStringMap.h index 7176e1e4b..f664e9d82 100644 --- a/src/public/tier1/UtlStringMap.h +++ b/src/public/tier1/UtlStringMap.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -47,7 +47,7 @@ class CUtlStringMap bool Defined( const char *pString ) const { - return m_SymbolTable.Find( pString ) != UTL_INVAL_SYMBOL; + return m_SymbolTable.Find( pString ).IsValid(); } UtlSymId_t Find( const char *pString ) const From 310e5cec535c16bccc6b3d61eb00e7d5a6e8eab2 Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:31 +0200 Subject: [PATCH 12/13] C++14 to C++20: fix C4596 (qualified member declarations) Qualified member declarations are not allowed inside a class body: void CASW_Holo_Sentry::InputEnable becomes void InputEnable. --- src/game/shared/swarm/asw_holo_sentry_shared.h | 4 ++-- src/game/shared/swarm/asw_mortarbug_shell_shared.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/shared/swarm/asw_holo_sentry_shared.h b/src/game/shared/swarm/asw_holo_sentry_shared.h index 9c0519195..8bf6770ec 100644 --- a/src/game/shared/swarm/asw_holo_sentry_shared.h +++ b/src/game/shared/swarm/asw_holo_sentry_shared.h @@ -34,8 +34,8 @@ class CASW_Holo_Sentry : public CBaseEntity virtual void FireGameEvent( IGameEvent *event ); - void CASW_Holo_Sentry::InputEnable( inputdata_t &inputdata ); - void CASW_Holo_Sentry::InputDisable( inputdata_t &inputdata ); + void InputEnable( inputdata_t &inputdata ); + void InputDisable( inputdata_t &inputdata ); private: COutputEvent m_OnSentryPlaced; diff --git a/src/game/shared/swarm/asw_mortarbug_shell_shared.h b/src/game/shared/swarm/asw_mortarbug_shell_shared.h index cf29c37f5..162415be9 100644 --- a/src/game/shared/swarm/asw_mortarbug_shell_shared.h +++ b/src/game/shared/swarm/asw_mortarbug_shell_shared.h @@ -36,7 +36,7 @@ class CASW_Mortarbug_Shell : public CBaseCombatCharacter virtual void SetFuseLength(float fSeconds); virtual void Detonate(); - static CASW_Mortarbug_Shell *CASW_Mortarbug_Shell::CreateShell( const Vector &vecOrigin, const Vector &vecForward, CBaseEntity *pOwner ); + static CASW_Mortarbug_Shell *CreateShell( const Vector &vecOrigin, const Vector &vecForward, CBaseEntity *pOwner ); bool m_bDoScreenShake; From d8ae96781f8ca38b7ae80dd287ce720cf36b1168 Mon Sep 17 00:00:00 2001 From: kitsune Date: Tue, 29 Sep 2026 15:32:31 +0200 Subject: [PATCH 13/13] C++14 to C++20: fix LNK2005 (explicit specializations) Explicit specializations of class template members are not implicitly inline, so the linker folded duplicate definitions: the four ITilegenClassFactory::ReadLiteralValue specializations and C_SpatialEntityTemplate::ResetAccumulation are marked inline. --- src/game/client/c_spatialentity.h | 4 ++-- .../layout_system/tilegen_class_factories.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/client/c_spatialentity.h b/src/game/client/c_spatialentity.h index 1657d56b0..277434192 100644 --- a/src/game/client/c_spatialentity.h +++ b/src/game/client/c_spatialentity.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: Spatial entity with simple radial falloff // @@ -133,7 +133,7 @@ template float C_SpatialEntityTemplate::m_ForcedInfluence; template <> -void C_SpatialEntityTemplate::ResetAccumulation( void ) +inline void C_SpatialEntityTemplate::ResetAccumulation( void ) { m_AccumulatedValue.Init(); m_ForcedValue.Init(); diff --git a/src/game/missionchooser/layout_system/tilegen_class_factories.h b/src/game/missionchooser/layout_system/tilegen_class_factories.h index 91d965d60..502cbc16d 100644 --- a/src/game/missionchooser/layout_system/tilegen_class_factories.h +++ b/src/game/missionchooser/layout_system/tilegen_class_factories.h @@ -64,22 +64,22 @@ ITilegenExpression< const char * > *ReadLiteralStringValue( KeyValues *pKeyValue // Class factory specializations to handle parsing literal values... -ITilegenExpression< int > *ITilegenClassFactory< ITilegenExpression< int > >::ReadLiteralValue( KeyValues *pKeyValues ) +inline ITilegenExpression< int > *ITilegenClassFactory< ITilegenExpression< int > >::ReadLiteralValue( KeyValues *pKeyValues ) { return ReadLiteralIntValue( pKeyValues ); } -ITilegenExpression< bool > *ITilegenClassFactory< ITilegenExpression< bool > >::ReadLiteralValue( KeyValues *pKeyValues ) +inline ITilegenExpression< bool > *ITilegenClassFactory< ITilegenExpression< bool > >::ReadLiteralValue( KeyValues *pKeyValues ) { return ReadLiteralBoolValue( pKeyValues ); } -ITilegenExpression< float > *ITilegenClassFactory< ITilegenExpression< float > >::ReadLiteralValue( KeyValues *pKeyValues ) +inline ITilegenExpression< float > *ITilegenClassFactory< ITilegenExpression< float > >::ReadLiteralValue( KeyValues *pKeyValues ) { return ReadLiteralFloatValue( pKeyValues ); } -ITilegenExpression< char const * > *ITilegenClassFactory< ITilegenExpression< char const * > >::ReadLiteralValue( KeyValues *pKeyValues ) +inline ITilegenExpression< char const * > *ITilegenClassFactory< ITilegenExpression< char const * > >::ReadLiteralValue( KeyValues *pKeyValues ) { return ReadLiteralStringValue( pKeyValues ); }