Ejemplo n.º 1
0
int CObject::Update (void)
{
	short	nPrevSegment = (short) info.nSegment;

#if DBG
if ((info.nType == OBJ_WEAPON) && (info.nId == SMARTMINE_BLOB_ID)) {
	nDbgObj = OBJ_IDX (this);
	nDbgObj = nDbgObj;
	}
if (OBJ_IDX (this) == nDbgObj)
	nDbgObj = nDbgObj;
#endif
if (info.nType == OBJ_ROBOT) {
	if (gameOpts->gameplay.bNoThief && (!IsMultiGame || IsCoopGame) && ROBOTINFO (info.nId).thief) {
		info.xShields = 0;
		info.xLifeLeft = 0;
		Die ();
		}
	else {
		fix xMaxShields = RobotDefaultShields (this);
		if (info.xShields > xMaxShields)
			info.xShields = xMaxShields;
		}
	}
info.vLastPos = info.position.vPos;			// Save the current position
RepairDamage ();
HandleSpecialSegment ();
if ((info.xLifeLeft != IMMORTAL_TIME) &&
	 (info.xLifeLeft != ONE_FRAME_TIME) &&
	 (gameData.physics.xTime != I2X (1)))
	info.xLifeLeft -= (fix) (gameData.physics.xTime / gameStates.gameplay.slowmo [0].fSpeed);		//...inevitable countdown towards death
gameStates.render.bDropAfterburnerBlob = 0;
if ((gameData.physics.xTime != I2X (1)) && UpdateControl ()) {
	UpdateEffects ();
	return 1;
	}
if (info.xLifeLeft < 0) {		// We died of old age
	Die ();
	if ((info.nType == OBJ_WEAPON) && WI_damage_radius (info.nId))
		ExplodeBadassWeapon (info.position.vPos);
	else if (info.nType == OBJ_ROBOT)	//make robots explode
		Explode (0);
	}
if ((info.nType == OBJ_NONE) || (info.nFlags & OF_SHOULD_BE_DEAD)) {
	return 1;			//CObject has been deleted
	}
UpdateMovement ();
UpdateEffects ();
if (CheckTriggerHits (nPrevSegment))
	return 0;
CheckWallPhysics ();
CheckGuidedMissileThroughExit (nPrevSegment);
CheckAfterburnerBlobDrop ();
return 1;
}
Ejemplo n.º 2
0
bool ManagedStrategy::needPitstop(tCarElt* car, tSituation *s, Opponents* opponents)
{
	// Do we need to refuel?
	int laps = car->_remainingLaps-car->_lapsBehindLeader;
	if (laps > 0) {
		float cmpfuel = (fuelperlap == 0.0) ? expectedfuelperlap : fuelperlap;
		if (car->_fuel < 1.5*cmpfuel &&
			car->_fuel < laps*cmpfuel)
		{
				return true;
		}
	}

	return RepairDamage(car, opponents);
}