Beispiel #1
0
int
ReRaceEnd(void)
{
	int curDrvIdx;
	int nCars;
	void *params = ReInfo->params;
	void *results = ReInfo->results;
	const char *sessionName = ReInfo->_reRaceName;

	ReShutdownUpdaters();

	ReUI().onRaceFinishing();
	
	ReRaceCleanup();

	if (NetGetNetwork())
		NetGetNetwork()->RaceDone();

	// If we are at the end of a qualification or practice session for a competitor,
	// select the next competitor : it is his turn for the same session.
	// If no more competitor, this is the end of the session for all the competitors.
	bool bEndOfSession = true;
	if ((ReInfo->s->_raceType == RM_TYPE_QUALIF || ReInfo->s->_raceType == RM_TYPE_PRACTICE)
		&& ReInfo->s->_totTime < 0.0f)
	{
		// Up to the next competitor now, if not the last one.
		nCars = MIN(GfParmGetEltNb(params, RM_SECT_DRIVERS),
				(int)GfParmGetNum(params, sessionName, RM_ATTR_MAX_DRV, NULL, 100));
		ReCurrDriverNr++;
		if (ReStartingOrderIdx != NULL) {
			if (ReCurrDriverNr < nCars) {curDrvIdx = ReStartingOrderIdx[ReCurrDriverNr];}
			else {curDrvIdx = nCars + 1;}
		}
		else {
			curDrvIdx = 1;
		}
		if (ReCurrDriverNr < nCars) 
			bEndOfSession = false;
		else {
			ReCurrDriverNr = 0; // Was the last one : end of session !
			curDrvIdx = 1;
		}
		GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_DRIVER, NULL, (tdble)curDrvIdx);
	}

	// Calculate class points if we just finished a session.
	if (bEndOfSession)
	{
		ReCalculateClassPoints (ReInfo->_reRaceName);
		if (ReStartingOrderIdx != NULL) {
			delete[] ReStartingOrderIdx;
			ReStartingOrderIdx = NULL;
		}
	}
	
	// Determine the new race state automation mode.
	const bool bGoOn = ReUI().onRaceFinished(bEndOfSession);
	
	return (bEndOfSession ? RM_NEXT_STEP : RM_NEXT_RACE) | (bGoOn ? RM_SYNC : RM_ASYNC);
}
Beispiel #2
0
static void
RestartRaceHookActivate(void * /* dummy */)
{
	ReRaceCleanup();
	ReInfo->_reState = RE_STATE_PRE_RACE;
	GfuiScreenActivate(ReInfo->_reGameScreen);
}
Beispiel #3
0
void ReRaceRestart()
{
	ReShutdownUpdaters();

	ReUI().onRaceFinishing();
	
	ReRaceCleanup();

	ReStateApply((void*)RE_STATE_PRE_RACE);
}
Beispiel #4
0
int
ReRaceEnd(void)
{
	int curDrvIdx;
	void *params = ReInfo->params;
	void *results = ReInfo->results;

	ReRaceCleanup();

	if (ReInfo->s->_raceType == RM_TYPE_QUALIF) {
		curDrvIdx = (int)GfParmGetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_DRIVER, NULL, 1);
		curDrvIdx++;
		if (curDrvIdx > GfParmGetEltNb(params, RM_SECT_DRIVERS)) {
			GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_DRIVER, NULL, 1);
			return ReDisplayResults();
		}
		GfParmSetNum(results, RE_SECT_CURRENT, RE_ATTR_CUR_DRIVER, NULL, curDrvIdx);
		return RM_SYNC | RM_NEXT_RACE;
	}

	return ReDisplayResults();
}