From 72fe214f499fe098de6d1284c3ca4c886d92efed Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 7 Aug 2023 20:11:35 +0300 Subject: [PATCH] engine: server: pre-process string before passing it to PhysicAPI AllocString, for compatibility with existing Xash3D games --- engine/server/sv_game.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index ad6dd670..c3cc42dc 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -3219,7 +3219,18 @@ string_t GAME_EXPORT SV_AllocString( const char *szValue ) int cmp; if( svgame.physFuncs.pfnAllocString != NULL ) - return svgame.physFuncs.pfnAllocString( szValue ); + { + string_t i; + + newString = Mem_Malloc( svgame.stringspool, SV_ProcessString( NULL, szValue )); + + SV_ProcessString( newString, szValue ); + i = svgame.physFuncs.pfnAllocString( newString ); + + Mem_Free( newString ); + + return i; + } #ifdef XASH_64BIT cmp = 1;