Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions sp/src/game/shared/mapbase/vscript_singletons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1243,17 +1243,20 @@ class CScriptNetPropManager
return -1;
}

unsigned int arraysize = pInfo->arraysize;

if ( pInfo->datatype == types::_VEC3 )
index /= 3;
arraysize *= 3;

if ( index < 0 || (unsigned int)index >= pInfo->arraysize )
if ( index < 0 || (unsigned int)index >= arraysize )
return -1;

switch ( pInfo->datatype )
{
case types::_VEC3:
case types::_FLOAT:
return *(float*)((char*)pEnt + pInfo->GetOffset( index ));
case types::_VEC3:
return ((float*)((char*)pEnt + pInfo->GetOffset( index / 3 )))[ index % 3 ];
#ifdef GAME_DLL
case types::_DAR_FLOAT:
{
Expand Down Expand Up @@ -1285,19 +1288,24 @@ class CScriptNetPropManager
return;
}

unsigned int arraysize = pInfo->arraysize;

if ( pInfo->datatype == types::_VEC3 )
index /= 3;
arraysize *= 3;

if ( index < 0 || (unsigned int)index >= pInfo->arraysize )
if ( index < 0 || (unsigned int)index >= arraysize )
return;

switch ( pInfo->datatype )
{
case types::_VEC3:
case types::_FLOAT:
*(float*)((char*)pEnt + pInfo->GetOffset( index )) = value;
NetworkStateChanged( pEnt, pInfo->GetOffset( index ) );
break;
case types::_VEC3:
((float*)((char*)pEnt + pInfo->GetOffset( index / 3 )))[ index % 3 ] = value;
NetworkStateChanged( pEnt, pInfo->GetOffset( index / 3 ) );
break;
#ifdef GAME_DLL
case types::_DAR_FLOAT:
{
Expand Down