Ejemplo n.º 1
0
Archivo: ai.cpp Proyecto: mutnig/vdrift
void AI::update(float dt, const std::list <CAR> & othercars)
{
	updatePlan(); //TODO: THIS CALLS EMPTY FUNCTION. ANYONE CHECK IF THIS FUNCTION IS NEEDED.

	for (std::vector<AI_Car>::iterator it = AI_Cars.begin (); it != AI_Cars.end (); it++ )
	{
		analyzeOthers(&(*it), dt, othercars);
		updateGasBrake(&(*it));
		updateSteer(&(*it));
	}
}
void AI_Car_Experimental::Update(float dt, const std::list <CAR> & checkcars)
{
	float lastThrottle = inputs[CARINPUT::THROTTLE];
	float lastBreak = inputs[CARINPUT::BRAKE];
	fill(inputs.begin(), inputs.end(), 0);

	analyzeOthers(dt, checkcars);
	updateGasBrake();
	updateSteer();
	float rateLimit = THROTTLE_RATE_LIMIT * dt;
	inputs[CARINPUT::THROTTLE] = RateLimit(lastThrottle, inputs[CARINPUT::THROTTLE],
		rateLimit, rateLimit);
	rateLimit = BRAKE_RATE_LIMIT * dt;
	inputs[CARINPUT::BRAKE] = RateLimit(lastBreak, inputs[CARINPUT::BRAKE],
		rateLimit, rateLimit);
}