mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-25 06:15:30 +03:00
Merge pull request #206 from samisalreadytaken/fix
Fix CScriptNetMsgHelper::WriteEntity()
This commit is contained in:
commit
216ea46c25
@ -740,7 +740,11 @@ void CScriptGameEventListener::StopListeningForEvent()
|
||||
#ifdef _DEBUG
|
||||
// Event listeners are iterated forwards in the game event manager,
|
||||
// removing while iterating will cause it to skip one listener.
|
||||
// This could be prevented by writing a custom game event manager.
|
||||
//
|
||||
// Fix this in engine without altering any behaviour by
|
||||
// changing event exeuction order to tail->head,
|
||||
// changing listener removal to tail->head,
|
||||
// changing listener addition to head
|
||||
if ( m_nEventTick == gpGlobals->tickcount )
|
||||
{
|
||||
Warning("CScriptGameEventListener stopped in the same frame it was fired. This will break other event listeners!\n");
|
||||
@ -1749,8 +1753,8 @@ void CNetMsgScriptHelper::WriteEntity( HSCRIPT hEnt )
|
||||
{
|
||||
SCRIPT_NETMSG_WRITE_FUNC
|
||||
CBaseEntity *p = ToEnt(hEnt);
|
||||
int i = p ? p->entindex() : -1;
|
||||
m_MsgOut.WriteSBitLong( i, MAX_EDICT_BITS );
|
||||
int i = p ? p->entindex() : 0;
|
||||
m_MsgOut.WriteUBitLong( i, MAX_EDICT_BITS );
|
||||
}
|
||||
|
||||
void CNetMsgScriptHelper::WriteEHandle( HSCRIPT hEnt )
|
||||
@ -1861,7 +1865,11 @@ bool CNetMsgScriptHelper::ReadBool()
|
||||
|
||||
HSCRIPT CNetMsgScriptHelper::ReadEntity()
|
||||
{
|
||||
int index = m_MsgIn_()ReadSBitLong( MAX_EDICT_BITS );
|
||||
int index = m_MsgIn_()ReadUBitLong( MAX_EDICT_BITS );
|
||||
|
||||
if ( !index )
|
||||
return NULL;
|
||||
|
||||
#ifdef GAME_DLL
|
||||
edict_t *e = INDEXENT(index);
|
||||
if ( e && !e->IsFree() )
|
||||
|
@ -2779,7 +2779,6 @@ bool SquirrelVM::GenerateUniqueKey(const char* pszRoot, char* pBuf, int nBufSize
|
||||
static int keyIdx = 0;
|
||||
// This gets used for script scope, still confused why it needs to be inside IScriptVM
|
||||
// is it just to be a compatible name for CreateScope?
|
||||
SquirrelSafeCheck safeCheck(vm_);
|
||||
V_snprintf(pBuf, nBufSize, "%08X_%s", ++keyIdx, pszRoot);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user