Example #1
0
//==========================================================================*
// Decide to do a pit stop
//--------------------------------------------------------------------------*
bool TBaseStrategy::NeedPitStop()
{
  float FuelConsum;                              // Fuel consumption per m
  if (oFuelPerM == 0.0)                          // If still undefined
    FuelConsum = oExpectedFuelPerM;              //   use estimated value
  else                                           // If known
    FuelConsum = oFuelPerM;                      //   use it

  bool Result = RtTeamNeedPitStop(
	  oDriver->oTeamIndex, 
	  FuelConsum, 
	  RepairWanted(cPIT_DAMAGE));

  if (oDriver->oForcePitStop)                    // If defined, try
    Result = true;                               //   to stop in pit

  return Result;
};
Example #2
0
//==========================================================================*
// Entscheiden, ob Boxenstopp nötig ist
//--------------------------------------------------------------------------*
bool TSimpleStrategy::NeedPitStop()
{
  float FuelConsum;                              // Fuel consumption per m
  if (oFuelPerM == 0.0)                          // If still undefined
    FuelConsum = oExpectedFuelPerM;              //   use estimated value
  else                                           // If known
    FuelConsum = oFuelPerM;                      //   use it

  bool Result = RtTeamNeedPitStop(oDriver->TeamIndex(), 
	  FuelConsum, RepairWanted(cPIT_DAMMAGE));

  if (oDriver->oCarHasTYC)
  {
	double TdF = oDriver->TyreTreadDepthFront(); // Check tyre condition
	double TdR = oDriver->TyreTreadDepthRear();  // Pit stop needed if
	oDegradationPerLap = (oLaps * oDegradationPerLap 
	  + MAX(oTireLimitFront - TdF,oTireLimitRear - TdR));
	oDegradationPerLap /= ++oLaps;

	if (MIN(TdF,TdR) < 1.5 * oDegradationPerLap) // tyres become critical
	{
		LogSimplix.warning("Tyre condition D: %.1f%% F: %.1f%% R: %.1f%% (%s)\n",
	    oDegradationPerLap,TdF,TdR,oDriver->GetBotName());

	  if ((TdF < 1.1 * oDegradationPerLap) 
		|| (TdR < 1.1 * oDegradationPerLap))
	  {
        Result = true;                           //   to stop in pit
	  }
	}
	oTireLimitFront = TdF;
	oTireLimitRear = TdR;
  }

  if (oDriver->oTestPitStop)                     // If defined, try
    Result = true;                               //   to stop in pit

  return Result;
};
Example #3
0
//==========================================================================*
// Umfang der Reparaturen festlegen
//--------------------------------------------------------------------------*
int TSimpleStrategy::PitRepair()
{
  oState = PIT_EXIT_WAIT;
  oWasInPit = true;
  return RepairWanted(0);
}