From 9d0f5197bd5df732259f890c75644efcd6678a8e Mon Sep 17 00:00:00 2001 From: Alexander 'z33ky' Hirsch <1zeeky@gmail.com> Date: Sun, 14 Jun 2020 10:39:08 +0200 Subject: [PATCH] Fix gcc 9/10 & mapbase build errors --- .gitignore | 3 + sp/src/devtools/gcc9+support.cpp | 59 ++++++++ sp/src/devtools/makefile_base_posix.mak | 1 + sp/src/devtools/makefile_base_posix.mak.gcc8 | 8 +- sp/src/game/client/clientshadowmgr.cpp | 2 +- sp/src/game/client/hl2/c_script_intro.cpp | 10 +- sp/src/game/server/ai_basenpc.cpp | 2 +- sp/src/game/server/ai_speech.cpp | 8 +- sp/src/game/server/ai_speech.h | 14 +- sp/src/game/server/basecombatcharacter.cpp | 10 -- sp/src/game/server/basecombatcharacter.h | 8 +- sp/src/game/server/filters.cpp | 2 +- sp/src/game/server/hl2/hl2_player.cpp | 2 +- sp/src/game/server/hl2/npc_combine.cpp | 16 --- sp/src/game/server/hl2/npc_combine.h | 8 +- sp/src/game/server/hl2/npc_metropolice.cpp | 7 - sp/src/game/server/hl2/npc_metropolice.h | 5 +- sp/src/game/server/hl2/npc_strider.cpp | 2 +- sp/src/game/server/hl2/script_intro.cpp | 10 +- sp/src/game/server/logicentities.cpp | 43 +++--- sp/src/game/server/mapbase/GlobalStrings.cpp | 13 -- sp/src/game/server/mapbase/GlobalStrings.h | 20 ++- .../game/server/mapbase/SystemConvarMod.cpp | 2 +- sp/src/game/server/mapbase/ai_grenade.h | 132 +++++++++--------- sp/src/game/server/mapbase/ai_monitor.cpp | 10 +- sp/src/game/server/mapbase/logic_skill.cpp | 2 +- sp/src/game/server/props.cpp | 2 +- sp/src/game/server/skyboxswapper.cpp | 6 +- sp/src/game/shared/mapbase/MapEdit.cpp | 4 +- .../game/shared/mapbase/mapbase_game_log.cpp | 8 +- sp/src/game/shared/mapbase/matchers.cpp | 25 ++-- sp/src/game/shared/mapbase/matchers.h | 25 ++-- sp/src/public/vscript/ivscript.h | 2 +- 33 files changed, 267 insertions(+), 204 deletions(-) create mode 100644 sp/src/devtools/gcc9+support.cpp diff --git a/.gitignore b/.gitignore index 011d70f1..958ac4a9 100644 --- a/.gitignore +++ b/.gitignore @@ -88,3 +88,6 @@ sp/src/materialsystem/*.dll sp/src/materialsystem/*.pdb sp/src/vgui2/*.dll sp/src/vgui2/*.pdb + +# Build support files +sp/src/devtools/gcc9+support.o diff --git a/sp/src/devtools/gcc9+support.cpp b/sp/src/devtools/gcc9+support.cpp new file mode 100644 index 00000000..6ab7c971 --- /dev/null +++ b/sp/src/devtools/gcc9+support.cpp @@ -0,0 +1,59 @@ +// compatibility with old ABI +#if __GNUC__ >= 9 +#include + +extern "C" double __pow_finite(double a, double b) +{ + return pow(a, b); +} + +extern "C" double __log_finite(double a) +{ + return log(a); +} + +extern "C" double __exp_finite(double a) +{ + return exp(a); +} + +extern "C" double __atan2_finite(double a, double b) +{ + return atan2(a, b); +} + +extern "C" double __atan2f_finite(double a, double b) +{ + return atan2f(a, b); +} + +extern "C" float __powf_finite(float a, float b) +{ + return powf(a, b); +} + +extern "C" float __logf_finite(float a) +{ + return logf(a); +} + +extern "C" float __expf_finite(float a) +{ + return expf(a); +} + +extern "C" float __acosf_finite(float a) +{ + return acosf(a); +} + +extern "C" double __asin_finite(double a) +{ + return asin(a); +} + +extern "C" double __acos_finite(double a) +{ + return acos(a); +} +#endif diff --git a/sp/src/devtools/makefile_base_posix.mak b/sp/src/devtools/makefile_base_posix.mak index ae2bfb69..559ee2be 100644 --- a/sp/src/devtools/makefile_base_posix.mak +++ b/sp/src/devtools/makefile_base_posix.mak @@ -8,6 +8,7 @@ MAKEFILE_LINK:=$(THISFILE).link $(MAKEFILE_LINK): $(shell which $(CC)) $(THISFILE) if [ "$(shell printf "$(shell $(CC) -dumpversion)\n8" | sort -Vr | head -1)" = 8 ]; then \ + $(COMPILE.cpp) -o gcc9+support.o gcc9+support.c ;\ ln -sf $(MAKEFILE_BASE).default $@ ;\ else \ ln -sf $(MAKEFILE_BASE).gcc8 $@ ;\ diff --git a/sp/src/devtools/makefile_base_posix.mak.gcc8 b/sp/src/devtools/makefile_base_posix.mak.gcc8 index 90bd818e..97178245 100644 --- a/sp/src/devtools/makefile_base_posix.mak.gcc8 +++ b/sp/src/devtools/makefile_base_posix.mak.gcc8 @@ -94,9 +94,9 @@ ifeq ($(OS),Linux) # So symbols like _Z16ClearMultiDamagev should show up when you do "nm server_srv.so" in TF2. STRIP_FLAGS = -x endif - # core2 = MMX, SSE, SSE2, SSE3, SSSE3 - MARCH_TARGET = core2 - MTUNE_TARGET = sandybridge + # nocona = MMX, SSE, SSE2, SSE3 + MARCH_TARGET = nocona + MTUNE_TARGET = generic ifeq ($(CXX),clang++) # Clang does not support -mfpmath=sse because it uses whatever @@ -174,7 +174,7 @@ ifeq ($(OS),Linux) LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group - LIB_END_SHLIB = -Wl,--end-group -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt + LIB_END_SHLIB = -Wl,--end-group $(SRCROOT)/devtools/gcc9+support.o -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt endif diff --git a/sp/src/game/client/clientshadowmgr.cpp b/sp/src/game/client/clientshadowmgr.cpp index 76b162dd..f6e78e18 100644 --- a/sp/src/game/client/clientshadowmgr.cpp +++ b/sp/src/game/client/clientshadowmgr.cpp @@ -2135,7 +2135,7 @@ ClientShadowHandle_t CClientShadowMgr::CreateProjectedTexture( ClientEntityHandl { pShadowMaterial = NULL; // these materials aren't used for shadow depth texture shadows. pShadowModelMaterial = NULL; - pShadowProxyData = (void*)h; + pShadowProxyData = (void*)(uintp)h; } #else if( flags & SHADOW_FLAGS_USE_DEPTH_TEXTURE ) diff --git a/sp/src/game/client/hl2/c_script_intro.cpp b/sp/src/game/client/hl2/c_script_intro.cpp index 62a20989..835e0a82 100644 --- a/sp/src/game/client/hl2/c_script_intro.cpp +++ b/sp/src/game/client/hl2/c_script_intro.cpp @@ -440,7 +440,8 @@ const QAngle &C_PlayerViewProxy::EyeAngles( void ) float fldummy; pPlayer->CalcView( vecOrigin, angAngles, fldummy, fldummy, fldummy ); - return GetAbsAngles() + (angAngles - pPlayer->GetAbsAngles()); + angAngles = GetAbsAngles() + (angAngles - pPlayer->GetAbsAngles()); + return angAngles; //return m_hPlayer.Get()->EyeAngles(); } @@ -474,8 +475,11 @@ void C_PlayerViewProxy::GetEyePosition( Vector &vecOrigin, QAngle &angAngles ) const QAngle &C_PlayerViewProxy::LocalEyeAngles( void ) { C_BasePlayer *pPlayer = GetPlayer(); - if (pPlayer) - return GetAbsAngles() + (pPlayer->LocalEyeAngles() - pPlayer->GetAbsAngles()); + if (pPlayer) { + static QAngle angAngles; + angAngles = GetAbsAngles() + (pPlayer->LocalEyeAngles() - pPlayer->GetAbsAngles()); + return angAngles; + } else return BaseClass::LocalEyeAngles(); } diff --git a/sp/src/game/server/ai_basenpc.cpp b/sp/src/game/server/ai_basenpc.cpp index 74e14f87..8c90b851 100644 --- a/sp/src/game/server/ai_basenpc.cpp +++ b/sp/src/game/server/ai_basenpc.cpp @@ -15092,7 +15092,7 @@ void CAI_BaseNPC::CalculateValidEnemyInteractions( void ) pPlayer->ModifyOrAppendPlayerCriteria( set ); ReAppendContextCriteria( set ); - DevMsg("Testing %s misc criteria\n", pInteraction->MiscCriteria); + DevMsg("Testing %s misc criteria\n", STRING(pInteraction->MiscCriteria)); int index; const char *criteriavalue; diff --git a/sp/src/game/server/ai_speech.cpp b/sp/src/game/server/ai_speech.cpp index c364b704..bdc0cd63 100644 --- a/sp/src/game/server/ai_speech.cpp +++ b/sp/src/game/server/ai_speech.cpp @@ -441,7 +441,7 @@ void CAI_Expresser::MergeModifiers( AI_CriteriaSet& set, const char *modifiers ) // NULL - // Output : AI_Response //----------------------------------------------------------------------------- -AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet &modifiers ) +AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet &modifiers ) { IResponseSystem *rs = GetOuter()->GetResponseSystem(); if ( !rs ) @@ -536,7 +536,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, AI_CriteriaS // Input : *response - //----------------------------------------------------------------------------- #ifdef MAPBASE -bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *result, IRecipientFilter *filter, AI_CriteriaSet *modifiers ) +bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *result, IRecipientFilter *filter, const AI_CriteriaSet *modifiers ) #else bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *result, IRecipientFilter *filter /* = NULL */ ) #endif @@ -833,7 +833,7 @@ bool CAI_Expresser::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/ // Input : concept - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- -bool CAI_Expresser::Speak( AIConcept_t concept, AI_CriteriaSet& modifiers, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +bool CAI_Expresser::Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { AI_Response *result = SpeakFindResponse( concept, modifiers ); if ( !result ) @@ -1420,4 +1420,4 @@ void CMultiplayer_Expresser::AllowMultipleScenes() void CMultiplayer_Expresser::DisallowMultipleScenes() { m_bAllowMultipleScenes = false; -} \ No newline at end of file +} diff --git a/sp/src/game/server/ai_speech.h b/sp/src/game/server/ai_speech.h index 2abb87f6..da204c5f 100644 --- a/sp/src/game/server/ai_speech.h +++ b/sp/src/game/server/ai_speech.h @@ -158,15 +158,15 @@ public: bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); #ifdef MAPBASE - bool Speak( AIConcept_t concept, AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); - AI_Response *SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet& modifiers ); + bool Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + AI_Response *SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers ); void MergeModifiers( AI_CriteriaSet& set, const char *modifiers ); #endif // 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 ); #ifdef MAPBASE - bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, IRecipientFilter *filter = NULL, AI_CriteriaSet *modifiers = NULL ); + bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, IRecipientFilter *filter = NULL, const AI_CriteriaSet *modifiers = NULL ); #else bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, IRecipientFilter *filter = NULL ); #endif @@ -306,13 +306,13 @@ public: virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); #ifdef MAPBASE - virtual bool Speak( AIConcept_t concept, AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); + virtual bool Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL ); #endif // 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 ); #ifdef MAPBASE - AI_Response * SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet& modifiers ); + AI_Response * SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers ); #endif bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response ); virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; } @@ -359,7 +359,7 @@ inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, const char // Version of Speak() that takes a direct AI_CriteriaSet for modifiers. //----------------------------------------------------------------------------- template -inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, AI_CriteriaSet& modifiers, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) +inline bool CAI_ExpresserHost::Speak( AIConcept_t concept, const AI_CriteriaSet& modifiers, char *pszOutResponseChosen /*=NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ ) { AssertOnce( this->GetExpresser()->GetOuter() == this ); return this->GetExpresser()->Speak( concept, modifiers, pszOutResponseChosen, bufsize, filter ); @@ -411,7 +411,7 @@ inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- template -inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet& modifiers ) +inline AI_Response *CAI_ExpresserHost::SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers ) { return this->GetExpresser()->SpeakFindResponse( concept, modifiers ); } diff --git a/sp/src/game/server/basecombatcharacter.cpp b/sp/src/game/server/basecombatcharacter.cpp index c5fb9e56..2f7c34dc 100644 --- a/sp/src/game/server/basecombatcharacter.cpp +++ b/sp/src/game/server/basecombatcharacter.cpp @@ -3958,16 +3958,6 @@ bool CBaseCombatCharacter::IsGlowEffectActive( void ) } #endif // GLOWS_ENABLE -#ifdef MAPBASE -//----------------------------------------------------------------------------- -// Mapbase adds proficiency override -//----------------------------------------------------------------------------- -inline WeaponProficiency_t CBaseCombatCharacter::GetCurrentWeaponProficiency() -{ - return (m_ProficiencyOverride > WEAPON_PROFICIENCY_INVALID) ? m_ProficiencyOverride : m_CurrentWeaponProficiency; -} -#endif - //----------------------------------------------------------------------------- // Assume everyone is average with every weapon. Override this to make exceptions. //----------------------------------------------------------------------------- diff --git a/sp/src/game/server/basecombatcharacter.h b/sp/src/game/server/basecombatcharacter.h index 5d5c30df..39c07974 100644 --- a/sp/src/game/server/basecombatcharacter.h +++ b/sp/src/game/server/basecombatcharacter.h @@ -399,11 +399,15 @@ public: CBaseCombatWeapon* GetWeapon( int i ) const; bool RemoveWeapon( CBaseCombatWeapon *pWeapon ); virtual void RemoveAllWeapons(); + WeaponProficiency_t GetCurrentWeaponProficiency() + { #ifdef MAPBASE - WeaponProficiency_t GetCurrentWeaponProficiency(); + // Mapbase adds proficiency override + return (m_ProficiencyOverride > WEAPON_PROFICIENCY_INVALID) ? m_ProficiencyOverride : m_CurrentWeaponProficiency; #else - WeaponProficiency_t GetCurrentWeaponProficiency() { return m_CurrentWeaponProficiency; } + return m_CurrentWeaponProficiency; #endif + } void SetCurrentWeaponProficiency( WeaponProficiency_t iProficiency ) { m_CurrentWeaponProficiency = iProficiency; } virtual WeaponProficiency_t CalcWeaponProficiency( CBaseCombatWeapon *pWeapon ); virtual Vector GetAttackSpread( CBaseCombatWeapon *pWeapon, CBaseEntity *pTarget = NULL ); diff --git a/sp/src/game/server/filters.cpp b/sp/src/game/server/filters.cpp index c1746ad1..2dc49ad3 100644 --- a/sp/src/game/server/filters.cpp +++ b/sp/src/game/server/filters.cpp @@ -1461,7 +1461,7 @@ public: return TestEntityTriggerIntersection_Accurate(pVolume, pTarget); else { - Msg("%s cannot find target entity %s, returning false\n", STRING(m_iszVolumeTester)); + Msg("%s cannot find target entity %s, returning false\n", GetDebugName(), STRING(m_iszVolumeTester)); return false; } } diff --git a/sp/src/game/server/hl2/hl2_player.cpp b/sp/src/game/server/hl2/hl2_player.cpp index 0d1df86d..2a29a8a8 100644 --- a/sp/src/game/server/hl2/hl2_player.cpp +++ b/sp/src/game/server/hl2/hl2_player.cpp @@ -2193,7 +2193,7 @@ void CHL2_Player::InputSquadForceGoTo( inputdata_t &inputdata ) } else { - goal.m_pGoalEntity = var.FieldType() == FIELD_EHANDLE ? var.Entity() : gEntList.FindEntityByNameNearest(var.String(), pPlayerSquadLeader->GetAbsOrigin(), 0, this, inputdata.pActivator, inputdata.pCaller); + goal.m_pGoalEntity = var.FieldType() == FIELD_EHANDLE ? var.Entity().Get() : gEntList.FindEntityByNameNearest(var.String(), pPlayerSquadLeader->GetAbsOrigin(), 0, this, inputdata.pActivator, inputdata.pCaller); goal.m_vecGoalLocation = vec3_invalid; } diff --git a/sp/src/game/server/hl2/npc_combine.cpp b/sp/src/game/server/hl2/npc_combine.cpp index 57517a34..0ecccd66 100644 --- a/sp/src/game/server/hl2/npc_combine.cpp +++ b/sp/src/game/server/hl2/npc_combine.cpp @@ -703,14 +703,6 @@ Class_T CNPC_Combine::Classify ( void ) } #ifdef MAPBASE -//----------------------------------------------------------------------------- -// Purpose: -//----------------------------------------------------------------------------- -inline bool CNPC_Combine::IsElite( void ) -{ - return m_fIsElite; -} - //----------------------------------------------------------------------------- // Purpose: Function for gauging whether we're capable of alt-firing. //----------------------------------------------------------------------------- @@ -2931,14 +2923,6 @@ void CNPC_Combine::SpeakSentence( int sentenceType ) #ifdef COMBINE_SOLDIER_USES_RESPONSE_SYSTEM //========================================================= -//========================================================= -inline bool CNPC_Combine::SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) -{ - return SpeakIfAllowed( concept, NULL, sentencepriority, sentencecriteria ); -} - -//========================================================= -//========================================================= bool CNPC_Combine::SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) { AI_CriteriaSet set; diff --git a/sp/src/game/server/hl2/npc_combine.h b/sp/src/game/server/hl2/npc_combine.h index ad96125d..d574e770 100644 --- a/sp/src/game/server/hl2/npc_combine.h +++ b/sp/src/game/server/hl2/npc_combine.h @@ -104,13 +104,12 @@ public: void Activate(); Class_T Classify( void ); + bool IsElite() { return m_fIsElite; } #ifdef MAPBASE - bool IsElite(); bool IsAltFireCapable(); bool IsGrenadeCapable(); const char* GetGrenadeAttachment() { return "lefthand"; } #else - bool IsElite() { return m_fIsElite; } #endif #ifndef MAPBASE void DelayAltFireAttack( float flDelay ); @@ -190,7 +189,10 @@ public: // Speaking void SpeakSentence( int sentType ); #ifdef COMBINE_SOLDIER_USES_RESPONSE_SYSTEM - bool SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); + bool SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ) + { + return SpeakIfAllowed( concept, NULL, sentencepriority, sentencecriteria ); + } bool SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); bool SpeakIfAllowed( const char *concept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); void ModifyOrAppendCriteria( AI_CriteriaSet& set ); diff --git a/sp/src/game/server/hl2/npc_metropolice.cpp b/sp/src/game/server/hl2/npc_metropolice.cpp index 03a170f6..f4254ece 100644 --- a/sp/src/game/server/hl2/npc_metropolice.cpp +++ b/sp/src/game/server/hl2/npc_metropolice.cpp @@ -1137,13 +1137,6 @@ void CNPC_MetroPolice::SpeakSentence( int nSentenceType ) } #ifdef METROPOLICE_USES_RESPONSE_SYSTEM -//========================================================= -//========================================================= -inline bool CNPC_MetroPolice::SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) -{ - return SpeakIfAllowed( concept, NULL, sentencepriority, sentencecriteria ); -} - //========================================================= //========================================================= bool CNPC_MetroPolice::SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority, SentenceCriteria_t sentencecriteria ) diff --git a/sp/src/game/server/hl2/npc_metropolice.h b/sp/src/game/server/hl2/npc_metropolice.h index c9d02fee..1f3f9517 100644 --- a/sp/src/game/server/hl2/npc_metropolice.h +++ b/sp/src/game/server/hl2/npc_metropolice.h @@ -112,7 +112,10 @@ public: // Speaking virtual void SpeakSentence( int nSentenceType ); #ifdef METROPOLICE_USES_RESPONSE_SYSTEM - bool SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); + bool SpeakIfAllowed( const char *concept, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ) + { + return SpeakIfAllowed( concept, NULL, sentencepriority, sentencecriteria ); + } bool SpeakIfAllowed( const char *concept, const char *modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); bool SpeakIfAllowed( const char *concept, AI_CriteriaSet& modifiers, SentencePriority_t sentencepriority = SENTENCE_PRIORITY_NORMAL, SentenceCriteria_t sentencecriteria = SENTENCE_CRITERIA_IN_SQUAD ); void ModifyOrAppendCriteria( AI_CriteriaSet& set ); diff --git a/sp/src/game/server/hl2/npc_strider.cpp b/sp/src/game/server/hl2/npc_strider.cpp index de59feca..5be578f3 100644 --- a/sp/src/game/server/hl2/npc_strider.cpp +++ b/sp/src/game/server/hl2/npc_strider.cpp @@ -4447,7 +4447,7 @@ CBaseFilter *CNPC_Strider::GetStompFilter() } else { - Warning("%s stomp filter not found!", GetDebugName(), STRING(m_strStompFilter)); + Warning("%s stomp filter %s not found!", GetDebugName(), STRING(m_strStompFilter)); } } diff --git a/sp/src/game/server/hl2/script_intro.cpp b/sp/src/game/server/hl2/script_intro.cpp index d992496e..6ac28e10 100644 --- a/sp/src/game/server/hl2/script_intro.cpp +++ b/sp/src/game/server/hl2/script_intro.cpp @@ -581,7 +581,8 @@ const QAngle &CPlayerViewProxy::EyeAngles( void ) float fldummy; m_hPlayer->CalcView( vecOrigin, angAngles, fldummy, fldummy, fldummy ); - return GetAbsAngles() + (angAngles - m_hPlayer->GetAbsAngles()); + angAngles = GetAbsAngles() + (angAngles - m_hPlayer->GetAbsAngles()); + return angAngles; //return m_hPlayer.Get()->EyeAngles(); } @@ -594,9 +595,10 @@ const QAngle &CPlayerViewProxy::EyeAngles( void ) //----------------------------------------------------------------------------- const QAngle &CPlayerViewProxy::LocalEyeAngles( void ) { - if (m_hPlayer.Get()) - return GetAbsAngles() + (m_hPlayer->LocalEyeAngles() - m_hPlayer->GetAbsAngles()); - else + if (m_hPlayer.Get()) { + static QAngle angAngles = GetAbsAngles() + (m_hPlayer->LocalEyeAngles() - m_hPlayer->GetAbsAngles()); + return angAngles; + } else return BaseClass::LocalEyeAngles(); } diff --git a/sp/src/game/server/logicentities.cpp b/sp/src/game/server/logicentities.cpp index 2d9b48ce..aa1f65af 100644 --- a/sp/src/game/server/logicentities.cpp +++ b/sp/src/game/server/logicentities.cpp @@ -3752,14 +3752,14 @@ public: // TODO: Replace "append" with variable arguments? inline void LCMsg(const char *msg, const char *append = NULL) { ConColorMsg(m_MsgColor, msg, append); } - inline void LCDevMsg(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ConColorMsg(m_MsgColor, msg, append) : 0; } + inline void LCDevMsg(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ConColorMsg(m_MsgColor, msg, append) : (void)0; } inline void LCWarning(const char *msg, const char *append = NULL) { ConColorMsg(m_WarningColor, msg, append); } - inline void LCDevWarning(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ConColorMsg(m_WarningColor, msg, append) : 0; } + inline void LCDevWarning(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ConColorMsg(m_WarningColor, msg, append) : (void)0; } //inline void LCMsg(const char *msg, const char *append = NULL) { ColorSpewMessage(SPEW_MESSAGE, &m_MsgColor, msg, append); } - //inline void LCDevMsg(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ColorSpewMessage(SPEW_MESSAGE, &m_MsgColor, msg, append) : 0; } + //inline void LCDevMsg(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ColorSpewMessage(SPEW_MESSAGE, &m_MsgColor, msg, append) : (void)0; } //inline void LCWarning(const char *msg, const char *append = NULL) { ColorSpewMessage(SPEW_MESSAGE, &m_WarningColor, msg, append); } - //inline void LCDevWarning(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ColorSpewMessage(SPEW_MESSAGE, &m_WarningColor, msg, append) : 0; } + //inline void LCDevWarning(int lvl, const char *msg, const char *append = NULL) { developer.GetInt() >= lvl ? ColorSpewMessage(SPEW_MESSAGE, &m_WarningColor, msg, append) : (void)0; } // Inputs void InputSendMsg( inputdata_t &inputdata ) { !m_bNewLineNotAuto ? LCMsg("%s\n", inputdata.value.String()) : LCMsg("%s", inputdata.value.String()); } @@ -3772,7 +3772,7 @@ public: // MAPBASE MP TODO: "ClearConsoleOnTarget" // (and make this input broadcast to all players) - void InputClearConsole( inputdata_t &inputdata ) { UTIL_GetLocalPlayer() ? engine->ClientCommand(UTIL_GetLocalPlayer()->edict(), "clear") : NULL; } + void InputClearConsole( inputdata_t &inputdata ) { UTIL_GetLocalPlayer() ? engine->ClientCommand(UTIL_GetLocalPlayer()->edict(), "clear") : (void)0; } DECLARE_DATADESC(); }; @@ -4320,7 +4320,7 @@ inline float CMathClamp::ClampValue(float input, float min, float max, int *boun { if ( max < min ) { - Warning("WARNING: Max value (%i) less than min value (%i) in %s!\n", max, min, GetDebugName()); + Warning("WARNING: Max value (%f) less than min value (%f) in %s!\n", max, min, GetDebugName()); return max; } else if( input < min ) @@ -4750,7 +4750,7 @@ private: bool KeyValue(const char *szKeyName, const char *szValue); bool KeyValue( const char *szKeyName, const Vector &vecValue ); - void UpdateOutValue(CBaseEntity *pActivator, Vector &vecNewValue); + void UpdateOutValue(CBaseEntity *pActivator, Vector vecNewValue); int DrawDebugTextOverlays(void); @@ -5307,7 +5307,7 @@ void CMathVector::SubtractCoordinate(float value, char coord, CBaseEntity *pActi // Purpose: Sets the value to the new value, firing the output value. // Input : vecNewValue - Value to set. //----------------------------------------------------------------------------- -void CMathVector::UpdateOutValue(CBaseEntity *pActivator, Vector &vecNewValue) +void CMathVector::UpdateOutValue(CBaseEntity *pActivator, Vector vecNewValue) { if (HasSpawnFlags( SF_MATH_VECTOR_DISABLE_X )) vecNewValue.x = 0; @@ -5808,7 +5808,7 @@ void CLogicModelInfo::InputLookupActivity( inputdata_t &inputdata ) iActivity = atoi(inputdata.value.String()); if (!ActivityList_NameForIndex(iActivity)) { - Msg("%s received invalid LookupActivity %s\n", inputdata.value.String()); + Msg("%s received invalid LookupActivity %s\n", GetDebugName(), inputdata.value.String()); return; } } @@ -5896,8 +5896,8 @@ private: CBaseEntity *GetTarget(CBaseEntity *pActivator, CBaseEntity *pCaller); - const Vector &GetPosition(CBaseEntity *pEntity); - const QAngle &GetAngles(CBaseEntity *pEntity); + Vector GetPosition(CBaseEntity *pEntity); + QAngle GetAngles(CBaseEntity *pEntity); // Inputs void InputGetPosition( inputdata_t &inputdata ); @@ -5945,7 +5945,7 @@ inline CBaseEntity *CLogicEntityPosition::GetTarget(CBaseEntity *pActivator, CBa //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const Vector &CLogicEntityPosition::GetPosition(CBaseEntity *pEntity) +Vector CLogicEntityPosition::GetPosition(CBaseEntity *pEntity) { switch (m_iPositionType) { @@ -5963,8 +5963,7 @@ const Vector &CLogicEntityPosition::GetPosition(CBaseEntity *pEntity) break; } - // Attachment position doesn't originate anywhere, so use a static variable - static Vector vecPosition; + Vector vecPosition; pAnimating->GetAttachment(STRING(m_iszPositionParameter), vecPosition); return vecPosition; } @@ -5975,16 +5974,15 @@ const Vector &CLogicEntityPosition::GetPosition(CBaseEntity *pEntity) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -const QAngle &CLogicEntityPosition::GetAngles(CBaseEntity *pEntity) +QAngle CLogicEntityPosition::GetAngles(CBaseEntity *pEntity) { - const QAngle *angAngles = &vec3_angle; switch (m_iPositionType) { case POSITION_BBOX: case POSITION_EARS: - case POSITION_ORIGIN: angAngles = &pEntity->GetAbsAngles(); break; - case POSITION_LOCAL: angAngles = &pEntity->GetLocalAngles(); break; - case POSITION_EYES: angAngles = &pEntity->EyeAngles(); break; + case POSITION_ORIGIN: return pEntity->GetAbsAngles(); break; + case POSITION_LOCAL: return pEntity->GetLocalAngles(); break; + case POSITION_EYES: return pEntity->EyeAngles(); break; case POSITION_ATTACHMENT: { CBaseAnimating *pAnimating = pEntity->GetBaseAnimating(); @@ -5994,16 +5992,15 @@ const QAngle &CLogicEntityPosition::GetAngles(CBaseEntity *pEntity) break; } - // Attachment angles don't originate anywhere, so use a static variable - static QAngle AttachmentAngles; + QAngle AttachmentAngles; matrix3x4_t attachmentToWorld; pAnimating->GetAttachment( pAnimating->LookupAttachment( STRING( m_iszPositionParameter ) ), attachmentToWorld ); MatrixAngles( attachmentToWorld, AttachmentAngles ); - angAngles = &AttachmentAngles; + return AttachmentAngles; } break; } - return *angAngles; + return vec3_angle; } //----------------------------------------------------------------------------- diff --git a/sp/src/game/server/mapbase/GlobalStrings.cpp b/sp/src/game/server/mapbase/GlobalStrings.cpp index 011e9d99..e7fb989e 100644 --- a/sp/src/game/server/mapbase/GlobalStrings.cpp +++ b/sp/src/game/server/mapbase/GlobalStrings.cpp @@ -56,19 +56,6 @@ string_t gm_isz_name_activator; // ------------------------------------------------------------- -// Does the classname of this entity match the string_t? -// -// This function is for comparing global strings and allows us to change how we compare them quickly. -inline bool EntIsClass( CBaseEntity *ent, string_t str2 ) -{ - //return ent->ClassMatches(str2); - - // Since classnames are pooled, the global string and the entity's classname should point to the same string in memory. - // As long as this rule is preserved, we only need a pointer comparison. A string comparison isn't necessary. - // Feel free to correct me if I'm disastrously wrong. - return ent->m_iClassname == str2; -} - // We know it hasn't been allocated yet #define INITIALIZE_GLOBAL_STRING(string, text) string = AllocPooledString(text) //SetGlobalString(string, text) diff --git a/sp/src/game/server/mapbase/GlobalStrings.h b/sp/src/game/server/mapbase/GlobalStrings.h index 22d2e494..9a0ff4d2 100644 --- a/sp/src/game/server/mapbase/GlobalStrings.h +++ b/sp/src/game/server/mapbase/GlobalStrings.h @@ -5,6 +5,12 @@ // $NoKeywords: $ //============================================================================= +#ifndef MAPBASE_GLOBAL_STRINGS_H +#define MAPBASE_GLOBAL_STRINGS_H +#ifdef _WIN32 +#pragma once +#endif + #include "cbase.h" // ------------------------------------------------------------- @@ -67,10 +73,20 @@ extern string_t gm_isz_name_activator; // Does the classname of this entity match the string_t? // // This function is for comparing global strings and allows us to change how we compare them quickly. -extern bool EntIsClass( CBaseEntity *ent, string_t str2 ); +inline bool EntIsClass( CBaseEntity *ent, string_t str2 ) +{ + //return ent->ClassMatches(str2); + + // Since classnames are pooled, the global string and the entity's classname should point to the same string in memory. + // As long as this rule is preserved, we only need a pointer comparison. A string comparison isn't necessary. + // Feel free to correct me if I'm disastrously wrong. + return ent->m_iClassname == str2; +} // ------------------------------------------------------------- -extern void InitGlobalStrings(); +void InitGlobalStrings(); // ------------------------------------------------------------- + +#endif diff --git a/sp/src/game/server/mapbase/SystemConvarMod.cpp b/sp/src/game/server/mapbase/SystemConvarMod.cpp index fd2197f5..001f2347 100644 --- a/sp/src/game/server/mapbase/SystemConvarMod.cpp +++ b/sp/src/game/server/mapbase/SystemConvarMod.cpp @@ -72,7 +72,7 @@ void CV_GlobalChange_Mapbase( IConVar *var, const char *pOldString, float flOldV //----------------------------------------------------------------------------- void CC_MapbaseNotChangingCVars( void ) { - SetChangingCVars( false ); + SetChangingCVars( NULL ); } static ConCommand mapbase_cvarsnotchanging("mapbase_cvarsnotchanging", CC_MapbaseNotChangingCVars, "An internal command used for ConVar modification.", FCVAR_HIDDEN); diff --git a/sp/src/game/server/mapbase/ai_grenade.h b/sp/src/game/server/mapbase/ai_grenade.h index 398ba405..02e3158a 100644 --- a/sp/src/game/server/mapbase/ai_grenade.h +++ b/sp/src/game/server/mapbase/ai_grenade.h @@ -91,6 +91,7 @@ template class CAI_GrenadeUser : public BASE_NPC, public CAI_GrenadeUserSink { DECLARE_CLASS_NOFRIEND( CAI_GrenadeUser, BASE_NPC ); + public: CAI_GrenadeUser() : CAI_GrenadeUserSink() { } @@ -162,8 +163,8 @@ void CAI_GrenadeUser::HandleAnimEvent( animevent_t *pEvent ) { if ( pEvent->event == COMBINE_AE_BEGIN_ALTFIRE ) { - if (GetActiveWeapon()) - GetActiveWeapon()->WeaponSound( SPECIAL1 ); + if (this->GetActiveWeapon()) + this->GetActiveWeapon()->WeaponSound( SPECIAL1 ); //SpeakIfAllowed( TLK_CMB_THROWGRENADE, "altfire:1" ); return; @@ -176,8 +177,8 @@ void CAI_GrenadeUser::HandleAnimEvent( animevent_t *pEvent ) fakeEvent.event = EVENT_WEAPON_AR2_ALTFIRE; // Weapon could've been dropped while playing animation - if (GetActiveWeapon()) - GetActiveWeapon()->Operator_HandleAnimEvent( &fakeEvent, this ); + if (this->GetActiveWeapon()) + this->GetActiveWeapon()->Operator_HandleAnimEvent( &fakeEvent, this ); // Stop other squad members from combine balling for a while. DelaySquadAltFireAttack( 10.0f ); @@ -195,25 +196,25 @@ void CAI_GrenadeUser::HandleAnimEvent( animevent_t *pEvent ) vecSpin.z = random->RandomFloat( -1000.0, 1000.0 ); Vector vecStart; - GetAttachment( GetGrenadeAttachment(), vecStart ); + this->GetAttachment( GetGrenadeAttachment(), vecStart ); - if( m_NPCState == NPC_STATE_SCRIPT ) + if( this->GetState() == NPC_STATE_SCRIPT ) { // Use a fixed velocity for grenades thrown in scripted state. // Grenades thrown from a script do not count against grenades remaining for the AI to use. Vector forward, up, vecThrow; - GetVectors( &forward, NULL, &up ); + this->GetVectors( &forward, NULL, &up ); vecThrow = forward * 750 + up * 175; // This code is used by player allies now, so it's only "combine spawned" if the thrower isn't allied with the player. - CBaseEntity *pGrenade = Fraggrenade_Create( vecStart, vec3_angle, vecThrow, vecSpin, this, COMBINE_GRENADE_TIMER, !IsPlayerAlly() ); + CBaseEntity *pGrenade = Fraggrenade_Create( vecStart, vec3_angle, vecThrow, vecSpin, this, COMBINE_GRENADE_TIMER, !this->IsPlayerAlly() ); m_OnThrowGrenade.Set(pGrenade, pGrenade, this); } else { // Use the Velocity that AI gave us. - CBaseEntity *pGrenade = Fraggrenade_Create( vecStart, vec3_angle, m_vecTossVelocity, vecSpin, this, COMBINE_GRENADE_TIMER, !IsPlayerAlly() ); + CBaseEntity *pGrenade = Fraggrenade_Create( vecStart, vec3_angle, m_vecTossVelocity, vecSpin, this, COMBINE_GRENADE_TIMER, !this->IsPlayerAlly() ); m_OnThrowGrenade.Set(pGrenade, pGrenade, this); AddGrenades(-1, pGrenade); } @@ -235,20 +236,20 @@ template void CAI_GrenadeUser::InputThrowGrenadeAtTarget( inputdata_t &inputdata ) { // Ignore if we're inside a scripted sequence - if ( m_NPCState == NPC_STATE_SCRIPT && m_hCine ) + if ( this->GetState() == NPC_STATE_SCRIPT && this->m_hCine ) return; CBaseEntity *pEntity = gEntList.FindEntityByName( NULL, inputdata.value.String(), this, inputdata.pActivator, inputdata.pCaller ); if ( !pEntity ) { - DevMsg("%s (%s) received ThrowGrenadeAtTarget input, but couldn't find target entity '%s'\n", GetClassname(), GetDebugName(), inputdata.value.String() ); + DevMsg("%s (%s) received ThrowGrenadeAtTarget input, but couldn't find target entity '%s'\n", this->GetClassname(), this->GetDebugName(), inputdata.value.String() ); return; } m_hForcedGrenadeTarget = pEntity; m_flNextGrenadeCheck = 0; - ClearSchedule( "Told to throw grenade via input" ); + this->ClearSchedule( "Told to throw grenade via input" ); } //----------------------------------------------------------------------------- @@ -262,33 +263,33 @@ bool CAI_GrenadeUser::CanAltFireEnemy( bool bUseFreeKnowledge ) if (!IsAltFireCapable()) return false; - if (!GetActiveWeapon()) + if (!this->GetActiveWeapon()) return false; - if (IsCrouching()) + if (this->IsCrouching()) return false; if ( gpGlobals->curtime < m_flNextAltFireTime || gpGlobals->curtime < m_flNextGrenadeCheck ) return false; - if( !GetEnemy() ) + if( !this->GetEnemy() ) return false; - if (!EntIsClass(GetActiveWeapon(), gm_isz_class_AR2) && !EntIsClass(GetActiveWeapon(), gm_isz_class_SMG1)) + if (!EntIsClass(this->GetActiveWeapon(), gm_isz_class_AR2) && !EntIsClass(this->GetActiveWeapon(), gm_isz_class_SMG1)) return false; - CBaseEntity *pEnemy = GetEnemy(); + CBaseEntity *pEnemy = this->GetEnemy(); Vector vecTarget; // Determine what point we're shooting at if( bUseFreeKnowledge ) { - vecTarget = GetEnemies()->LastKnownPosition( pEnemy ) + (pEnemy->GetViewOffset()*0.75);// approximates the chest + vecTarget = this->GetEnemies()->LastKnownPosition( pEnemy ) + (pEnemy->GetViewOffset()*0.75);// approximates the chest } else { - vecTarget = GetEnemies()->LastSeenPosition( pEnemy ) + (pEnemy->GetViewOffset()*0.75);// approximates the chest + vecTarget = this->GetEnemies()->LastSeenPosition( pEnemy ) + (pEnemy->GetViewOffset()*0.75);// approximates the chest } // Trace a hull about the size of the combine ball (don't shoot through grates!) @@ -297,11 +298,11 @@ bool CAI_GrenadeUser::CanAltFireEnemy( bool bUseFreeKnowledge ) Vector mins( -12, -12, -12 ); Vector maxs( 12, 12, 12 ); - Vector vShootPosition = EyePosition(); + Vector vShootPosition = this->EyePosition(); - if ( GetActiveWeapon() ) + if ( this->GetActiveWeapon() ) { - GetActiveWeapon()->GetAttachment( "muzzle", vShootPosition ); + this->GetActiveWeapon()->GetAttachment( "muzzle", vShootPosition ); } // Trace a hull about the size of the combine ball. @@ -350,7 +351,8 @@ void CAI_GrenadeUser::DelaySquadAltFireAttack( float flDelay ) DelayAltFireAttack( flDelay ); AISquadIter_t iter; - CAI_BaseNPC *pSquadmate = m_pSquad ? m_pSquad->GetFirstMember( &iter ) : NULL; + CAI_Squad *pSquad = this->GetSquad(); + CAI_BaseNPC *pSquadmate = pSquad ? pSquad->GetFirstMember( &iter ) : NULL; while ( pSquadmate ) { CAI_GrenadeUser *pUser = dynamic_cast(pSquadmate); @@ -359,7 +361,7 @@ void CAI_GrenadeUser::DelaySquadAltFireAttack( float flDelay ) pUser->DelayAltFireAttack( flDelay ); } - pSquadmate = m_pSquad->GetNextMember( &iter ); + pSquadmate = pSquad->GetNextMember( &iter ); } } @@ -368,25 +370,25 @@ void CAI_GrenadeUser::DelaySquadAltFireAttack( float flDelay ) template bool CAI_GrenadeUser::CanGrenadeEnemy( bool bUseFreeKnowledge ) { - CBaseEntity *pEnemy = GetEnemy(); + CBaseEntity *pEnemy = this->GetEnemy(); Assert( pEnemy != NULL ); if( pEnemy ) { // I'm not allowed to throw grenades during dustoff - if ( IsCurSchedule(SCHED_DROPSHIP_DUSTOFF) ) + if ( this->IsCurSchedule(SCHED_DROPSHIP_DUSTOFF) ) return false; if( bUseFreeKnowledge ) { // throw to where we think they are. - return CanThrowGrenade( GetEnemies()->LastKnownPosition( pEnemy ) ); + return CanThrowGrenade( this->GetEnemies()->LastKnownPosition( pEnemy ) ); } else { // hafta throw to where we last saw them. - return CanThrowGrenade( GetEnemies()->LastSeenPosition( pEnemy ) ); + return CanThrowGrenade( this->GetEnemies()->LastSeenPosition( pEnemy ) ); } } @@ -421,7 +423,7 @@ bool CAI_GrenadeUser::CanThrowGrenade( const Vector &vecTarget ) } float flDist; - flDist = ( vecTarget - GetAbsOrigin() ).Length(); + flDist = ( vecTarget - this->GetAbsOrigin() ).Length(); if( flDist > 1024 || flDist < 128 ) { @@ -433,15 +435,16 @@ bool CAI_GrenadeUser::CanThrowGrenade( const Vector &vecTarget ) // ----------------------- // If moving, don't check. // ----------------------- - if ( m_flGroundSpeed != 0 ) + if ( this->m_flGroundSpeed != 0 ) return false; // --------------------------------------------------------------------- // Are any of my squad members near the intended grenade impact area? // --------------------------------------------------------------------- - if ( m_pSquad ) + CAI_Squad *pSquad = this->GetSquad(); + if ( pSquad ) { - if (m_pSquad->SquadMemberInRange( vecTarget, COMBINE_MIN_GRENADE_CLEAR_DIST )) + if (pSquad->SquadMemberInRange( vecTarget, COMBINE_MIN_GRENADE_CLEAR_DIST )) { // crap, I might blow my own guy up. Don't throw a grenade and don't check again for a while. m_flNextGrenadeCheck = gpGlobals->curtime + 1; // one full second. @@ -464,7 +467,7 @@ bool CAI_GrenadeUser::CanThrowGrenade( const Vector &vecTarget ) template bool CAI_GrenadeUser::CheckCanThrowGrenade( const Vector &vecTarget ) { - //NDebugOverlay::Line( EyePosition(), vecTarget, 0, 255, 0, false, 5 ); + //NDebugOverlay::Line( this->EyePosition(), vecTarget, 0, 255, 0, false, 5 ); // --------------------------------------------------------------------- // Check that throw is legal and clear @@ -473,21 +476,21 @@ bool CAI_GrenadeUser::CheckCanThrowGrenade( const Vector &vecTarget ) Vector vecToss; Vector vecMins = -Vector(4,4,4); Vector vecMaxs = Vector(4,4,4); - if( FInViewCone( vecTarget ) && CBaseEntity::FVisible( vecTarget ) ) + if( this->FInViewCone( vecTarget ) && CBaseEntity::FVisible( vecTarget ) ) { - vecToss = VecCheckThrow( this, EyePosition(), vecTarget, COMBINE_GRENADE_THROW_SPEED, 1.0, &vecMins, &vecMaxs ); + vecToss = VecCheckThrow( this, this->EyePosition(), vecTarget, COMBINE_GRENADE_THROW_SPEED, 1.0, &vecMins, &vecMaxs ); } else { // Have to try a high toss. Do I have enough room? trace_t tr; - AI_TraceLine( EyePosition(), EyePosition() + Vector( 0, 0, 64 ), MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); + AI_TraceLine( this->EyePosition(), this->EyePosition() + Vector( 0, 0, 64 ), MASK_SHOT, this, COLLISION_GROUP_NONE, &tr ); if( tr.fraction != 1.0 ) { return false; } - vecToss = VecCheckToss( this, EyePosition(), vecTarget, -1, 1.0, true, &vecMins, &vecMaxs ); + vecToss = VecCheckToss( this, this->EyePosition(), vecTarget, -1, 1.0, true, &vecMins, &vecMaxs ); } if ( vecToss != vec3_origin ) @@ -518,7 +521,7 @@ bool CAI_GrenadeUser::CheckCanThrowGrenade( const Vector &vecTarget ) template void CAI_GrenadeUser::ClearAttackConditions() { - bool fCanRangeAttack2 = IsGrenadeCapable() && HasCondition( COND_CAN_RANGE_ATTACK2 ); + bool fCanRangeAttack2 = IsGrenadeCapable() && this->HasCondition( COND_CAN_RANGE_ATTACK2 ); // Call the base class. BaseClass::ClearAttackConditions(); @@ -527,7 +530,7 @@ void CAI_GrenadeUser::ClearAttackConditions() { // We don't allow the base class to clear this condition because we // don't sense for it every frame. - SetCondition( COND_CAN_RANGE_ATTACK2 ); + this->SetCondition( COND_CAN_RANGE_ATTACK2 ); } } @@ -537,8 +540,8 @@ void CAI_GrenadeUser::ClearAttackConditions() template void CAI_GrenadeUser::StartTask_FaceAltFireTarget( const Task_t *pTask ) { - SetIdealActivity( (Activity)(int)pTask->flTaskData ); - GetMotor()->SetIdealYawToTargetAndUpdate( m_vecAltFireTarget, AI_KEEP_YAW_SPEED ); + this->SetIdealActivity( (Activity)(int)pTask->flTaskData ); + this->GetMotor()->SetIdealYawToTargetAndUpdate( m_vecAltFireTarget, AI_KEEP_YAW_SPEED ); } template @@ -546,7 +549,7 @@ void CAI_GrenadeUser::StartTask_GetPathToForced( const Task_t *pTask ) { if ( !m_hForcedGrenadeTarget ) { - TaskFail(FAIL_NO_ENEMY); + this->TaskFail(FAIL_NO_ENEMY); return; } @@ -559,47 +562,48 @@ void CAI_GrenadeUser::StartTask_GetPathToForced( const Task_t *pTask ) Vector posLos; bool found = false; - if ( GetTacticalServices()->FindLateralLos( vecEnemyEye, &posLos ) ) + if ( this->GetTacticalServices()->FindLateralLos( vecEnemyEye, &posLos ) ) { float dist = ( posLos - vecEnemyEye ).Length(); if ( dist < flMaxRange && dist > flMinRange ) found = true; } - if ( !found && GetTacticalServices()->FindLos( vecEnemy, vecEnemyEye, flMinRange, flMaxRange, 1.0, &posLos ) ) + if ( !found && this->GetTacticalServices()->FindLos( vecEnemy, vecEnemyEye, flMinRange, flMaxRange, 1.0, &posLos ) ) { found = true; } if ( !found ) { - TaskFail( FAIL_NO_SHOOT ); + this->TaskFail( FAIL_NO_SHOOT ); } else { // else drop into run task to offer an interrupt - m_vInterruptSavePosition = posLos; + this->m_vInterruptSavePosition = posLos; } } template void CAI_GrenadeUser::StartTask_DeferSquad( const Task_t *pTask ) { - if ( m_pSquad ) + CAI_Squad *pSquad = this->GetSquad(); + if ( pSquad ) { // iterate my squad and stop everyone from throwing grenades for a little while. AISquadIter_t iter; - CAI_BaseNPC *pSquadmate = m_pSquad ? m_pSquad->GetFirstMember( &iter ) : NULL; + CAI_BaseNPC *pSquadmate = pSquad ? pSquad->GetFirstMember( &iter ) : NULL; while ( pSquadmate ) { pSquadmate->DelayGrenadeCheck(5); - pSquadmate = m_pSquad->GetNextMember( &iter ); + pSquadmate = pSquad->GetNextMember( &iter ); } } - TaskComplete(); + this->TaskComplete(); } //----------------------------------------------------------------------------- @@ -607,14 +611,14 @@ void CAI_GrenadeUser::StartTask_DeferSquad( const Task_t *pTask ) template void CAI_GrenadeUser::RunTask_FaceAltFireTarget( const Task_t *pTask ) { - GetMotor()->SetIdealYawToTargetAndUpdate( m_vecAltFireTarget, AI_KEEP_YAW_SPEED ); + this->GetMotor()->SetIdealYawToTargetAndUpdate( m_vecAltFireTarget, AI_KEEP_YAW_SPEED ); // New Mapbase thing that fixes forced alt-fires not changing weapon yaw/pitch - SetAim( m_vecAltFireTarget - Weapon_ShootPosition() ); + this->SetAim( m_vecAltFireTarget - this->Weapon_ShootPosition() ); - if (IsActivityFinished()) + if (this->IsActivityFinished()) { - TaskComplete(); + this->TaskComplete(); } } @@ -623,23 +627,23 @@ void CAI_GrenadeUser::RunTask_GetPathToForced( const Task_t *pTask ) { if ( !m_hForcedGrenadeTarget ) { - TaskFail(FAIL_NO_ENEMY); + this->TaskFail(FAIL_NO_ENEMY); return; } - if ( GetTaskInterrupt() > 0 ) + if ( this->GetTaskInterrupt() > 0 ) { - ClearTaskInterrupt(); + this->ClearTaskInterrupt(); Vector vecEnemy = m_hForcedGrenadeTarget->GetAbsOrigin(); - AI_NavGoal_t goal( m_vInterruptSavePosition, ACT_RUN, AIN_HULL_TOLERANCE ); + AI_NavGoal_t goal( this->m_vInterruptSavePosition, ACT_RUN, AIN_HULL_TOLERANCE ); - GetNavigator()->SetGoal( goal, AIN_CLEAR_TARGET ); - GetNavigator()->SetArrivalDirection( vecEnemy - goal.dest ); + this->GetNavigator()->SetGoal( goal, AIN_CLEAR_TARGET ); + this->GetNavigator()->SetArrivalDirection( vecEnemy - goal.dest ); } else { - TaskInterrupt(); + this->TaskInterrupt(); } } @@ -647,11 +651,11 @@ template void CAI_GrenadeUser::RunTask_FaceTossDir( const Task_t *pTask ) { // project a point along the toss vector and turn to face that point. - GetMotor()->SetIdealYawToTargetAndUpdate( GetLocalOrigin() + m_vecTossVelocity * 64, AI_KEEP_YAW_SPEED ); + this->GetMotor()->SetIdealYawToTargetAndUpdate( this->GetLocalOrigin() + m_vecTossVelocity * 64, AI_KEEP_YAW_SPEED ); - if ( FacingIdeal() ) + if ( this->FacingIdeal() ) { - TaskComplete( true ); + this->TaskComplete( true ); } } diff --git a/sp/src/game/server/mapbase/ai_monitor.cpp b/sp/src/game/server/mapbase/ai_monitor.cpp index fe6120ec..ab437c8c 100644 --- a/sp/src/game/server/mapbase/ai_monitor.cpp +++ b/sp/src/game/server/mapbase/ai_monitor.cpp @@ -119,11 +119,11 @@ public: #if AI_MONITOR_USE_UTLVECTOR inline void SetCondition( int iCondition ) { m_Conditions.HasElement(iCondition) ? NULL : m_Conditions.AddToTail(iCondition); } inline void ClearCondition( int iCondition ) { m_Conditions.FindAndRemove(iCondition); } - inline bool HasCondition( int iCondition ) { m_Conditions.HasElement(iCondition); } + inline bool HasCondition( int iCondition ) { return m_Conditions.HasElement(iCondition); } #else inline void SetCondition( int iCondition ) { m_Conditions.Set(iCondition); } inline void ClearCondition( int iCondition ) { m_Conditions.Clear(iCondition); } - inline bool HasCondition( int iCondition ) { m_Conditions.IsBitSet(iCondition); } + inline bool HasCondition( int iCondition ) { return m_Conditions.IsBitSet(iCondition); } #endif static int GetConditionID(const char* condName) { return CAI_BaseNPC::GetSchedulingSymbols()->ConditionSymbolToId(condName); } @@ -150,11 +150,11 @@ public: #if AI_MONITOR_USE_UTLVECTOR inline void SetSchedule( int iSchedule ) { m_Schedules.HasElement(iSchedule) ? NULL : m_Schedules.AddToTail(iSchedule); } inline void ClearSchedule( int iSchedule ) { m_Schedules.FindAndRemove(iSchedule); } - inline bool HasSchedule( int iSchedule ) { m_Schedules.HasElement(iSchedule); } + inline bool HasSchedule( int iSchedule ) { return m_Schedules.HasElement(iSchedule); } #else inline void SetSchedule( int iSchedule ) { m_Schedules.Set(iSchedule); } inline void ClearSchedule( int iSchedule ) { m_Schedules.Clear(iSchedule); } - inline bool HasSchedule( int iSchedule ) { m_Schedules.IsBitSet(iSchedule); } + inline bool HasSchedule( int iSchedule ) { return m_Schedules.IsBitSet(iSchedule); } #endif static int GetScheduleID(const char* schedName) { return CAI_BaseNPC::GetSchedulingSymbols()->ScheduleSymbolToId(schedName); } @@ -179,7 +179,7 @@ public: inline void SetHint( int iHint ) { m_Hints.HasElement(iHint) ? NULL : m_Hints.AddToTail(iHint); } inline void ClearHint( int iHint ) { m_Hints.FindAndRemove(iHint); } - inline bool HasHint( int iHint ) { m_Hints.HasElement(iHint); } + inline bool HasHint( int iHint ) { return m_Hints.HasElement(iHint); } // Only register a hint as "being used" when the NPC is this distance away or less float m_flDistanceFromHint; diff --git a/sp/src/game/server/mapbase/logic_skill.cpp b/sp/src/game/server/mapbase/logic_skill.cpp index 6454b6b0..505e933e 100644 --- a/sp/src/game/server/mapbase/logic_skill.cpp +++ b/sp/src/game/server/mapbase/logic_skill.cpp @@ -20,7 +20,7 @@ private: // Used by gamerules to fire OnSkillChanged. // Passes the level it changed to as well. - void InputSkillLevelChanged(inputdata_t &inputdata) { m_bListeningForSkillChanges ? m_OnSkillChanged.Set(inputdata.value.Int(), inputdata.pActivator, this) : 0; } + void InputSkillLevelChanged(inputdata_t &inputdata) { m_bListeningForSkillChanges ? m_OnSkillChanged.Set(inputdata.value.Int(), inputdata.pActivator, this) : (void)0; } COutputInt m_OnSkillChanged; COutputEvent m_OnEasy; diff --git a/sp/src/game/server/props.cpp b/sp/src/game/server/props.cpp index f8180da8..cb483bc7 100644 --- a/sp/src/game/server/props.cpp +++ b/sp/src/game/server/props.cpp @@ -6263,7 +6263,7 @@ public: if (m_debugOverlays & OVERLAY_TEXT_BIT) { char tempstr[512]; - Q_snprintf(tempstr, sizeof(tempstr), "Flare Duration: %d", GetEnvFlareLifetime(m_hFlareEnt)); + Q_snprintf(tempstr, sizeof(tempstr), "Flare Duration: %f", GetEnvFlareLifetime(m_hFlareEnt)); EntityText(text_offset, tempstr, 0); text_offset++; } diff --git a/sp/src/game/server/skyboxswapper.cpp b/sp/src/game/server/skyboxswapper.cpp index 16aa4f1f..40d1f2ba 100644 --- a/sp/src/game/server/skyboxswapper.cpp +++ b/sp/src/game/server/skyboxswapper.cpp @@ -52,7 +52,7 @@ void CSkyboxSwapper::Precache( void ) { if ( Q_strlen( m_iszSkyboxName.ToCStr() ) == 0 ) { - Warning( "skybox_swapper (%s) has no skybox specified!\n", GetEntityName() ); + Warning( "skybox_swapper (%s) has no skybox specified!\n", STRING(GetEntityName()) ); return; } @@ -73,8 +73,8 @@ void CSkyboxSwapper::InputTrigger( inputdata_t &inputdata ) static ConVarRef skyname( "sv_skyname", false ); if ( !skyname.IsValid() ) { - Warning( "skybox_swapper (%s) trigger input failed - cannot find 'sv_skyname' convar!\n", GetEntityName() ); + Warning( "skybox_swapper (%s) trigger input failed - cannot find 'sv_skyname' convar!\n", STRING(GetEntityName()) ); return; } skyname.SetValue( m_iszSkyboxName.ToCStr() ); -} \ No newline at end of file +} diff --git a/sp/src/game/shared/mapbase/MapEdit.cpp b/sp/src/game/shared/mapbase/MapEdit.cpp index 0f8170bb..21ef9268 100644 --- a/sp/src/game/shared/mapbase/MapEdit.cpp +++ b/sp/src/game/shared/mapbase/MapEdit.cpp @@ -39,7 +39,7 @@ inline void DebugMsg(const tchar *pMsg, ...) { if (mapedit_debug.GetBool() == true) { - Msg(pMsg); + Msg("%s", pMsg); } } @@ -544,7 +544,7 @@ public: else { DebugMsg("MapEdit Debug: File not NULL, loading %s\n", pFile); - Q_snprintf(szFullName,sizeof(szFullName), pFile); + Q_strncpy(szFullName, pFile, sizeof(szFullName)); } KeyValues *pkvFile = new KeyValues( "MapEdit" ); if ( pkvFile->LoadFromFile( filesystem, szFullName, "MOD" ) ) diff --git a/sp/src/game/shared/mapbase/mapbase_game_log.cpp b/sp/src/game/shared/mapbase/mapbase_game_log.cpp index d87714ab..c83adee0 100644 --- a/sp/src/game/shared/mapbase/mapbase_game_log.cpp +++ b/sp/src/game/shared/mapbase/mapbase_game_log.cpp @@ -162,9 +162,9 @@ void MapbaseGameLog_Record( const char *szContext ) continue; if ( pPlayer->GetActiveWeapon() == pWeapon ) - pKVWeapons->SetString(pWeapon->GetClassname(), CFmtStrN<32>("%i; %i (active)", pWeapon->m_iClip1, pWeapon->m_iClip2)); + pKVWeapons->SetString(pWeapon->GetClassname(), CFmtStrN<32>("%i; %i (active)", pWeapon->m_iClip1.Get(), pWeapon->m_iClip2.Get())); else - pKVWeapons->SetString(pWeapon->GetClassname(), CFmtStrN<32>("%i; %i", pWeapon->m_iClip1, pWeapon->m_iClip2)); + pKVWeapons->SetString(pWeapon->GetClassname(), CFmtStrN<32>("%i; %i", pWeapon->m_iClip1.Get(), pWeapon->m_iClip2.Get())); } } @@ -209,7 +209,7 @@ void MapbaseGameLog_Record( const char *szContext ) } } - CFmtStrN pathfmt("map_logs/%s_log_%i.txt", gpGlobals->mapname, pGameLoggerEnt->m_iSaveID); + CFmtStrN pathfmt("map_logs/%s_log_%i.txt", STRING(gpGlobals->mapname), pGameLoggerEnt->m_iSaveID); pGameLoggerEnt->m_flLastLogTime = gpGlobals->curtime; pGameLoggerEnt->m_iSaveID++; @@ -219,7 +219,7 @@ void MapbaseGameLog_Record( const char *szContext ) if (pKV->SaveToFile( g_pFullFileSystem, pathfmt, "MOD" )) { - Msg("Saved game log file to \"%s\"\n", pathfmt); + Msg("Saved game log file to \"%s\"\n", pathfmt.Get()); } pKV->deleteThis(); diff --git a/sp/src/game/shared/mapbase/matchers.cpp b/sp/src/game/shared/mapbase/matchers.cpp index b66cf40f..6197009c 100644 --- a/sp/src/game/shared/mapbase/matchers.cpp +++ b/sp/src/game/shared/mapbase/matchers.cpp @@ -9,14 +9,20 @@ #include "matchers.h" #include "fmtstr.h" + +// glibc (Linux) uses these tokens when including , so we must not #define them +#undef max +#undef min #include +#undef MINMAX_H +#include "minmax.h" ConVar mapbase_wildcards_enabled("mapbase_wildcards_enabled", "1", FCVAR_NONE, "Toggles Mapbase's '?' wildcard and true '*' features. Useful for maps that have '?' in their targetnames."); ConVar mapbase_regex_enabled("mapbase_regex_enabled", "1", FCVAR_NONE, "Toggles Mapbase's regex matching handover."); #ifdef CLIENT_DLL // FIXME: There is no clientside equivalent to the RS code -bool ResponseSystemCompare(const char *criterion, const char *value) { return Matcher_NamesMatch(criterion, value); } +static bool ResponseSystemCompare(const char *criterion, const char *value) { return Matcher_NamesMatch(criterion, value); } #else extern bool ResponseSystemCompare(const char *criterion, const char *value); #endif @@ -32,21 +38,20 @@ extern bool ResponseSystemCompare(const char *criterion, const char *value); // AppearsToBeANumber - Response System-based function which checks if the string might be a number. //============================================================================= -inline bool Matcher_Match(const char *pszQuery, const char *szValue) +bool Matcher_Match(const char *pszQuery, const char *szValue) { // I wasn't kidding when I said all this did was hijack response system matching. return ResponseSystemCompare(pszQuery, szValue); } -inline bool Matcher_Match(const char *pszQuery, int iValue) { return Matcher_Match(pszQuery, CNumStr(iValue)); } -inline bool Matcher_Match(const char *pszQuery, float flValue) { return Matcher_Match(pszQuery, CNumStr(flValue)); } +bool Matcher_Match(const char *pszQuery, int iValue) { return Matcher_Match(pszQuery, CNumStr(iValue)); } +bool Matcher_Match(const char *pszQuery, float flValue) { return Matcher_Match(pszQuery, CNumStr(flValue)); } // ------------------------------------------------------------------------------- // ------------------------------------------------------------------------------- // The recursive part of Mapbase's modified version of Valve's NamesMatch(). -// This part is no longer inlined since it's recursive. -/*FORCEINLINE*/ bool Matcher_RunCharCompare(const char *pszQuery, const char *szValue) +bool Matcher_RunCharCompare(const char *pszQuery, const char *szValue) { // This matching model is based off of the ASW SDK while ( *szValue && *pszQuery ) @@ -119,7 +124,7 @@ bool Matcher_Regex(const char *pszQuery, const char *szValue) } // The entry point for Mapbase's modified version of Valve's NamesMatch(). -FORCEINLINE bool Matcher_NamesMatch(const char *pszQuery, const char *szValue) +bool Matcher_NamesMatch(const char *pszQuery, const char *szValue) { if ( szValue == NULL ) return (*pszQuery == 0 || *pszQuery == '*'); @@ -142,7 +147,7 @@ FORCEINLINE bool Matcher_NamesMatch(const char *pszQuery, const char *szValue) return Matcher_RunCharCompare( pszQuery, szValue ); } -FORCEINLINE bool Matcher_NamesMatch_Classic(const char *pszQuery, const char *szValue) +bool Matcher_NamesMatch_Classic(const char *pszQuery, const char *szValue) { if ( szValue == NULL ) return (!pszQuery || *pszQuery == 0 || *pszQuery == '*'); @@ -178,7 +183,7 @@ FORCEINLINE bool Matcher_NamesMatch_Classic(const char *pszQuery, const char *sz return false; } -FORCEINLINE bool Matcher_NamesMatch_MutualWildcard(const char *pszQuery, const char *szValue) +bool Matcher_NamesMatch_MutualWildcard(const char *pszQuery, const char *szValue) { if ( szValue == NULL ) return (!pszQuery || *pszQuery == 0 || *pszQuery == '*'); @@ -219,7 +224,7 @@ FORCEINLINE bool Matcher_NamesMatch_MutualWildcard(const char *pszQuery, const c // Matcher_Compare is a deprecated alias originally used when Matcher_Match didn't support wildcards. /* -inline bool Matcher_Compare(const char *pszQuery, const char *szValue) +bool Matcher_Compare(const char *pszQuery, const char *szValue) { return Matcher_Match(pszQuery, szValue); #if 0 diff --git a/sp/src/game/shared/mapbase/matchers.h b/sp/src/game/shared/mapbase/matchers.h index dc2528ae..f02f3ff3 100644 --- a/sp/src/game/shared/mapbase/matchers.h +++ b/sp/src/game/shared/mapbase/matchers.h @@ -5,39 +5,46 @@ // $NoKeywords: $ //============================================================================= +#ifndef MAPBASE_MATCHERS_H +#define MAPBASE_MATCHERS_H +#ifdef _WIN32 +#pragma once +#endif + + #define MAPBASE_MATCHERS 1 // Compares with != and the like. Basically hijacks the response system matching. // This also loops back around to Matcher_NamesMatch. // pszQuery = The value that should have the operator(s) at the beginning. // szValue = The value tested against the criterion. -extern bool Matcher_Match( const char *pszQuery, const char *szValue ); -extern bool Matcher_Match( const char *pszQuery, int iValue ); -extern bool Matcher_Match( const char *pszQuery, float flValue ); +bool Matcher_Match( const char *pszQuery, const char *szValue ); +bool Matcher_Match( const char *pszQuery, int iValue ); +bool Matcher_Match( const char *pszQuery, float flValue ); // Regular expressions based off of the std library. // pszQuery = The regex text. // szValue = The value that should be matched. -extern bool Matcher_Regex( const char *pszQuery, const char *szValue ); +bool Matcher_Regex( const char *pszQuery, const char *szValue ); // Compares two strings with support for wildcards or regex. This code is an expanded version of baseentity.cpp's NamesMatch(). // pszQuery = The value that should have the wildcard. // szValue = The value tested against the query. // Use Matcher_Match if you want <, !=, etc. as well. -extern bool Matcher_NamesMatch( const char *pszQuery, const char *szValue ); +bool Matcher_NamesMatch( const char *pszQuery, const char *szValue ); // Identical to baseentity.cpp's original NamesMatch(). // pszQuery = The value that should have the wildcard. // szValue = The value tested against the query. -extern bool Matcher_NamesMatch_Classic( const char *pszQuery, const char *szValue ); +bool Matcher_NamesMatch_Classic( const char *pszQuery, const char *szValue ); // Identical to Matcher_NamesMatch_Classic(), but either value could use a wildcard. // pszQuery = The value that serves as the query. This value can use wildcards. // szValue = The value tested against the query. This value can use wildcards as well. -extern bool Matcher_NamesMatch_MutualWildcard( const char *pszQuery, const char *szValue ); +bool Matcher_NamesMatch_MutualWildcard( const char *pszQuery, const char *szValue ); // Deprecated; do not use -inline bool Matcher_Compare( const char *pszQuery, const char *szValue ) { return Matcher_Match( pszQuery, szValue ); } +static inline bool Matcher_Compare( const char *pszQuery, const char *szValue ) { return Matcher_Match( pszQuery, szValue ); } // Taken from the Response System. // Checks if the specified string appears to be a number of some sort. @@ -57,3 +64,5 @@ static bool AppearsToBeANumber( char const *token ) return true; } + +#endif diff --git a/sp/src/public/vscript/ivscript.h b/sp/src/public/vscript/ivscript.h index 3acba8b7..3526f468 100644 --- a/sp/src/public/vscript/ivscript.h +++ b/sp/src/public/vscript/ivscript.h @@ -200,7 +200,7 @@ DECLARE_DEDUCE_FIELDTYPE( FIELD_VECTOR, const QAngle& ); template inline const char * ScriptFieldTypeName() { - T::using_unknown_script_type(); + return T::using_unknown_script_type(); } #define DECLARE_NAMED_FIELDTYPE( fieldType, strName ) template <> inline const char * ScriptFieldTypeName() { return strName; }