Skip to content

Commit ec32ca2

Browse files
committed
gameserver: try to resolve the crash when moving the client
1 parent f9c8119 commit ec32ca2

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

source/modules/gameserver.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,16 @@ static void hook_CBaseServer_CheckTimeouts(CBaseServer* srv)
14561456
*/
14571457
static void MoveCGameClientIntoCGameClient(CGameClient* origin, CGameClient* target)
14581458
{
1459+
int slot = target->m_nClientSlot;
1460+
edict_t* edict = target->edict;
1461+
1462+
*target = *origin;
1463+
target->m_nClientSlot = slot;
1464+
target->edict = edict;
1465+
1466+
if (true)
1467+
return;
1468+
14591469
target->Inactivate();
14601470
target->Clear();
14611471

@@ -1505,6 +1515,13 @@ static void MoveCGameClientIntoCGameClient(CGameClient* origin, CGameClient* tar
15051515
target->m_bPlayerNameLocked = origin->m_bPlayerNameLocked;
15061516
memcpy(target->m_szPendingNameChange, origin->m_szPendingNameChange, sizeof(origin->m_szPendingNameChange));
15071517

1518+
/*
1519+
* Update CNetChan properly.
1520+
*/
1521+
1522+
CNetChan* chan = (CNetChan*)target->m_NetChannel;
1523+
chan->m_MessageHandler = target;
1524+
15081525
/*
15091526
* Nuke the origin client
15101527
*/
@@ -1513,8 +1530,6 @@ static void MoveCGameClientIntoCGameClient(CGameClient* origin, CGameClient* tar
15131530
//origin->m_ConVars = NULL; // Same here
15141531
origin->Inactivate();
15151532
origin->Clear();
1516-
1517-
target->FreeBaselines(); // Force a full update, as we don't copy the baseline.
15181533
}
15191534

15201535
void InitializeEntityDLLFields( edict_t *pEdict )

0 commit comments

Comments
 (0)