Beispiel #1
0
int32_t C4SortObjectByValue::Compare(C4Object *pObj1, C4Object *pObj2) {
  // this is rather slow, should only be called in special cases

  // make sure to hardcode the call order, as it might lead to desyncs otherwise
  // [Icewing]
  int32_t iValue1 = CompareGetValue(pObj1);
  int32_t iValue2 = CompareGetValue(pObj2);
  return iValue2 - iValue1;
}
Beispiel #2
0
bool C4SortObjectByValue::PrepareCache(const C4ValueArray *pObjs)
{
	// Clear old cache
	delete [] pVals; pVals = NULL; iSize = 0;
	// Create new cache
	iSize = pObjs->GetSize(); pVals = new int32_t [iSize];
	for (int32_t i = 0; i < iSize; i++)
		pVals[i] = CompareGetValue(pObjs->GetItem(i)._getObj());
	// Okay
	return true;
}