//-----------------------------------------------------------------------------
// Serialization
//-----------------------------------------------------------------------------
void CUtlBufferEditor::Put( const void *pMem, int size )
{
	if ( size && CheckPut( size ) )
	{
		memcpy( &m_Memory[m_Put - m_nOffset], pMem, size );
		m_Put += size;

		AddNullTermination();
	}
}
//-----------------------------------------------------------------------------
// null terminate the buffer
//-----------------------------------------------------------------------------
void CUtlBufferEditor::AddNullTermination( void )
{
	if ( m_Put > m_nMaxPut )
	{
		if ( !IsReadOnly() && ((m_Error & PUT_OVERFLOW) == 0)  )
		{
			// Add null termination value
			if ( CheckPut( 1 ) )
			{
				m_Memory[m_Put - m_nOffset] = 0;
			}
			else
			{
				// Restore the overflow state, it was valid before...
				m_Error &= ~PUT_OVERFLOW;
			}
		}
		m_nMaxPut = m_Put;
	}		
}
Beispiel #3
0
//-------------------------------------------------------
// main関数
//-------------------------------------------------------
int main()
{

    int x,y;
    printf("Program Start\n");
    BoardIni();

    while(1) {

        InputMap(&x,&y);

        if(x == 0 && y == 0) {
            printf("Program End\n");
            break;
        }
        CheckPut(x,y);
        printf("z:%d %d-%d\nmove:%d\n",z,x,y,move);
    }

    return 0;
}