예제 #1
0
void* SendProxy_LengthTable( const SendProp *pProp, const void *pStructBase, const void *pData, CSendProxyRecipients *pRecipients, int objectID )
{
	// Make sure the array has space to hold all the elements.
	CSendPropExtra_UtlVector *pExtra = (CSendPropExtra_UtlVector*)pProp->GetExtraData();
	pExtra->m_EnsureCapacityFn( (void*)pStructBase, pExtra->m_Offset, pExtra->m_nMaxElements );
	return (void*)pData;
}
예제 #2
0
void* SendProxy_UtlVectorElement_DataTable(
    const SendProp *pProp,
    const void *pStructBase,
    const void *pData,
    CSendProxyRecipients *pRecipients,
    int objectID )
{
    CSendPropExtra_UtlVector *pExtra = (CSendPropExtra_UtlVector*)pProp->GetExtraData();

    int iElement = pProp->m_ElementStride;
    Assert( iElement < pExtra->m_nMaxElements );

    // This should have gotten called in SendProxy_LengthTable before we get here, so
    // the capacity should be correct.
#ifdef _DEBUG
    pExtra->m_EnsureCapacityFn( (void*)pStructBase, pExtra->m_Offset, pExtra->m_nMaxElements );
#endif

    // NOTE: this is cheesy because we're assuming the type of the template class, but it does the trick.
    CUtlVector<int> *pUtlVec = (CUtlVector<int>*)((char*)pStructBase + pExtra->m_Offset);

    // Call through to the proxy they passed in, making pStruct=the CUtlVector and forcing iElement to 0.
    return pExtra->m_DataTableProxyFn( pProp, pData, (char*)pUtlVec->Base() + iElement*pExtra->m_ElementStride, pRecipients, objectID );
}