Exemple #1
0
void CModel::Init(CComment* comments)
{
	m_comments = comments;
	m_next = NULL;
	m_sequences = NULL;
	m_curSequence = NULL;
	m_name = NULL;
	m_path = NULL;
	m_psSkelPath = NULL;
	m_psMakeSkelPath = NULL;
	m_psRefGLAPath = NULL;
	SetOrigin(0, 0, 0);
	SetParms(-1, -1, 0, 1);
	m_iType		= TK_AS_CONVERTMDX_NOASK;
	m_bSmooth	= false;
	m_bLoseDupVerts = false;
	m_bMakeSkin	= false;
	m_fScale	= 1.0f;
	m_bIgnoreBaseDeviations = false;
	m_bSkew90	= false;
	m_bNoSkew90	= false;	
	m_bKeepMotion = false;
	m_bPreQuat = false;

	PCJList_Clear();
}
/***
	PUBLIC
	Construtor da classe LBSC_RepSort

	Parameters:
		- pSortFieldPar		-> ponteiro para o objeto LBSC_Field que vai ser ordenado.

	Return:
		-

	Comments:
		- 

***/
LBSC_RepSort::LBSC_RepSort( LBSC_Field *pSortFieldPar ):
		SortObject(), cComp()
{
	// inicializacao dos atributos
	pSortField = pSortFieldPar;
	iIndAtual = 0;

	if( !pSortField ){
		// nao podemos prosseguir sem esta informacao
		SetError( LBSE_BADARG );
		return;
	}

	long	lNumRep = pSortField->GetNumberOfRepetition();
	if( lNumRep <= 0 ){
		SetError( LBSE_EMPTYLIST );
		return;
	}

	// DESCRITOR DA CHAVE DE ORDENACAO:
	//	- %l	-> apontador para o objeto de comparacao (Comparator)
	//			   (util para a CompareRepetition)
	//			   (nao ordenado)
	//	- %l	-> ponteiro para a repeticao, que saira' da lista no final
	//			   do Get e voltara' no Put, em outra posicao da lista
	//			   (util para o PutData)
	//		       (nao ordenado)
	//	- %ns	-> string de tamanho n, que contera' o conteudo de uma repeticao
	//		       (ordenado)
	//			   (na verdade pode ser %l, %w, etc. dependendo do tipo do campo)
	//	- %l	-> numero de ordem da repeticao dentro do campo. Nao eh o numero de
	//			   sequencia na lista, e sim um numero que representa a ordem de atualizacao
	//			   da repeticao. Util para desempate em caso de chaves iguais.

	// espaco para o apontador do objeto comparator
	strcpy( szDescriptor, "%l" );

	// apontador para a repeticao
	strcat( szDescriptor, "%l" );

	// montar o restante da expressao
	switch( pSortField->GetType() ){
	case BINARY_FIELD:
		// campo invalido para ordenacao
		SetError( LBSE_INVALIDFIELDTYPE );
		return;

	case VALUE_FIELD:
		strcat( szDescriptor, "%l" );
		break;

	case DVALUE_FIELD:
		strcat( szDescriptor, "%w" );
		break;

	case TEXT_FIELD:
	case REFERENCED_FIELD:
	case ALPHA_FIELD:
		{
			char	szNum[ 10 ];
			char	*szAux;
			itoa( pSortField->GetType() == ALPHA_FIELD ? pSortField->GetSize() : MAXPATH, szNum, 10 );
			// retira espacos
			for( szAux = szNum; *szAux == ' '; szAux++ );
			strcat( szDescriptor, "%" );
			strcat( szDescriptor, szAux );
		}
		strcat( szDescriptor, "s" );
		break;

	case DATE_FIELD:
		strcat( szDescriptor, "%u" );
		break;

	case TIME_FIELD:
		strcat( szDescriptor, "%6s" );
		break;

	case BYTE_FIELD:
		strcat( szDescriptor, "%c" );
		break;

	case SINT_FIELD:
		strcat( szDescriptor, "%d" );
		break;

	case FLOAT_FIELD:
		strcat( szDescriptor, "%f" );
		break;

	default:
		// erro interno
		SetError( LBSE_ERROR );
		return;
	}

	// inserir o sinal
	strcat( szDescriptor, (pSortField->GetAttrib() & ASC_ORD_FIELD) ? ">" : "<" );

	// inserir numero de ordem de atualizacao, para desempate
	strcat( szDescriptor, (pSortField->GetAttrib() & ASC_ORD_FIELD) ? "%l>" : "%l<" );

	// terminamos de montar a expressao.
	iSizeOfKey = cComp.SetDescriptor( szDescriptor );
	if( cComp.BuildStatus != PARSEOK ){
		// deu pau no objeto comparador
		iSizeOfKey = 0;
		SetError( LBSE_ERROR );
		return;
	}

	// obter no LBS.INI o nome do diretorio de trabalho
	char	szAuxDir[ FULLNAMESIZE ];
	strncpy( szAuxDir, LBSC_ServerConfig::TempDir(), FULLNAMESIZE );

	// inicializar o SortObject
	SetParms( lNumRep );
	if( BuildStatus != BUILDISOK ){
		// deu pau
		SetError( LBSE_ERROR );
		return;
	}
	SetError( LBS_OK );
}