From 0dd9b97c37784a6130af12ab61f14e917bad2241 Mon Sep 17 00:00:00 2001 From: Vaqtincha <51029683+Vaqtincha@users.noreply.github.com> Date: Wed, 27 May 2020 06:32:15 +0500 Subject: [PATCH] Reset entvars on create bot (#538) * Reset entvars on create bot --- regamedll/game_shared/bot/bot.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/regamedll/game_shared/bot/bot.h b/regamedll/game_shared/bot/bot.h index 9b2b0d93..e366a210 100644 --- a/regamedll/game_shared/bot/bot.h +++ b/regamedll/game_shared/bot/bot.h @@ -60,6 +60,15 @@ T *CreateBot(const BotProfile *profile) else { T *pBot = nullptr; + +#ifdef REGAMEDLL_FIXES + auto name = pentBot->v.netname; + Q_memset(&pentBot->v, 0, sizeof(pentBot->v)); // Reset entvars data + pentBot->v.netname = name; + pentBot->v.flags = FL_FAKECLIENT | FL_CLIENT; + pentBot->v.pContainingEntity = pentBot; +#endif + FREE_PRIVATE(pentBot); pBot = GetClassPtr((T *)VARS(pentBot)); pBot->Initialize(profile);