From 1a6f1f0cab2fd372851dbf95be254135baca29c2 Mon Sep 17 00:00:00 2001 From: Blixibon Date: Wed, 7 Apr 2021 13:53:06 -0500 Subject: [PATCH] Replaced expresser cases involving CBaseMultiplayerPlayer with CBasePlayer to allow singleplayer expressers to be obtained --- sp/src/game/server/ai_speechqueue.cpp | 4 ++++ sp/src/game/server/sceneentity.cpp | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/sp/src/game/server/ai_speechqueue.cpp b/sp/src/game/server/ai_speechqueue.cpp index 79794d4b..7e8bf055 100644 --- a/sp/src/game/server/ai_speechqueue.cpp +++ b/sp/src/game/server/ai_speechqueue.cpp @@ -174,7 +174,11 @@ void CResponseQueue::RemoveExpresserHost(CBaseEntity *host) /// TODO: Kind of an ugly hack until I get the class hierarchy straightened out. static CAI_Expresser *InferExpresserFromBaseEntity(CBaseEntity * RESTRICT pEnt) { +#ifdef MAPBASE + if ( CBasePlayer *pPlayer = ToBasePlayer(pEnt) ) +#else if ( CBaseMultiplayerPlayer *pPlayer = dynamic_cast(pEnt) ) +#endif { return pPlayer->GetExpresser(); } diff --git a/sp/src/game/server/sceneentity.cpp b/sp/src/game/server/sceneentity.cpp index 92914d05..1ff2b18e 100644 --- a/sp/src/game/server/sceneentity.cpp +++ b/sp/src/game/server/sceneentity.cpp @@ -4835,10 +4835,17 @@ void CSceneEntity::OnSceneFinished( bool canceled, bool fireoutput ) CBaseFlex *pFlex = FindNamedActor( 0 ) ; if ( pFlex ) { +#ifdef MAPBASE + CBasePlayer *pAsPlayer = ToBasePlayer(pFlex); +#else CBaseMultiplayerPlayer *pAsPlayer = dynamic_cast(pFlex); +#endif if (pAsPlayer) { CAI_Expresser *pExpresser = pAsPlayer->GetExpresser(); +#ifdef MAPBASE + if (pExpresser) +#endif pExpresser->OnSpeechFinished(); } else if ( CAI_BaseActor *pActor = dynamic_cast( pFlex ) )