Exemplo n.º 1
0
int Performance_Data::Volume2 (int period)
{
	//double distance = Distance2 (period);

	//if (distance > 0.0) {
	//	double length = Length ();

	//	if (length > 0.0) {
	//		int volume = (int) (distance / length + 0.5);
	//		if (volume == 0) {
	//			return (1);
	//		} else {
	//			return (volume);
	//		}
	//	} else {
	//		return ((int) (distance + 0.5));
	//	}
	//} else {
	//	return (0);
	//}

	if (Time2 (period) <= 0.0) {
		return (0);
	} else {
		int volume = (Enter2 (period) + Exit2 (period) + 1) / 2;
		if (volume < 1) volume = 1;
		return (volume);
	}
}
Exemplo n.º 2
0
/*===========================================================================
 *
 * Function - int l_FileListCompare (lParam1, lParam2, lParamSort);
 *
 *=========================================================================*/
int CALLBACK l_FileListCompare (LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) {
  srloaddlgfileinfo_t*  pData1    = (srloaddlgfileinfo_t  *) lParam1;
  srloaddlgfileinfo_t*  pData2    = (srloaddlgfileinfo_t  *) lParam2;
  srloadfilesortinfo_t* pSortData = (srloadfilesortinfo_t *) lParamSort;
  int		        Result    = 0;

  if (pData1 == NULL || pData2 == NULL || pSortData == NULL) return (0);

  switch (pSortData->SortType) {
    case SRFILELIST_FILENAME:
        Result = _tcsicmp(pData2->FindData.cFileName, pData1->FindData.cFileName);
	break;
    case SRFILELIST_DATE: {
        CTime Time1(pData1->FindData.ftLastWriteTime);
        CTime Time2(pData2->FindData.ftLastWriteTime);
        CTimeSpan TimeDiff = Time2 - Time1;
		Result = (int)(TimeDiff.GetTotalSeconds());
		break; }
    case SRFILELIST_SIZE:
        Result = pData2->FindData.nFileSizeHigh - pData1->FindData.nFileSizeHigh;
		if (Result == 0) Result = pData1->FindData.nFileSizeLow - pData2->FindData.nFileSizeLow;
		break;
    case SRFILELIST_DEFAULTSORT: {
        
		if (pData1->IsMaster != pData2->IsMaster) {
			Result = pData2->IsMaster - pData1->IsMaster;
		}
		else {
          CTime Time1(pData1->FindData.ftLastWriteTime);
          CTime Time2(pData2->FindData.ftLastWriteTime);
          CTimeSpan TimeDiff = Time2 - Time1;
		  Result = (int) (TimeDiff.GetTotalSeconds());
		}

	break; }
  }

  if (pSortData->Reverse) return (-Result);
  return (Result);
}
Exemplo n.º 3
0
double Performance_Data::TTime2 (int period)
{
	double time = Time2 (period);

	if (time <= 0.0) {
		time = Time0 () / 10.0;
	} else {
		double distance = Distance2 (period);
		double speed = distance / time;
		if (speed < 0.5) speed = 0.5;
		time = Length () / speed;
	}
	if (time < 0.1) time = 0.1;
	return (time);
}
Exemplo n.º 4
0
/*===========================================================================
 *
 * Function - int l_SortLoadInfosByDate (lParam1, lParam2, lParamSort);
 *
 *=========================================================================*/
int __stdcall l_SortLoadInfosByDate (long lParam1, long lParam2, long lParamSort) 
{
  srloaddlgfileinfo_t* pFileInfo1 = (srloaddlgfileinfo_t *) lParam1;
  srloaddlgfileinfo_t* pFileInfo2 = (srloaddlgfileinfo_t *) lParam2;

		/* Special case for Skyrim.esm to ensure it is loaded first */
  if (stricmp(pFileInfo1->FindData.cFileName, "Skyrim.esm") == 0) return -1;
  if (stricmp(pFileInfo2->FindData.cFileName, "Skyrim.esm") == 0) return 1;

  if (pFileInfo1 == NULL || pFileInfo2 == NULL) return (0);

  CTime Time1(pFileInfo1->FindData.ftLastWriteTime);
  CTime Time2(pFileInfo2->FindData.ftLastWriteTime);
  CTimeSpan TimeDiff = Time1 - Time2;

  return(int) TimeDiff.GetTotalSeconds();
}
Exemplo n.º 5
0
double Performance_Data::Avg_Speed2 (int period)
{
	double time = Time2 (period);

	if (time <= 0.0) {
		double length = Length ();

		time = Time0 () / 10.0;
		if (time < 0.1) time = 0.1;

		return (length / time);
	} else {
		double distance = Distance2 (period);
		double speed = distance / time;

		if (speed < 0.5) speed = 0.5;
		return (speed);
	}
}