Ejemplo n.º 1
0
/**
 * @brief Updates the pilot stats after mass change.
 *
 *    @param pilot Pilot to update his mass.
 */
void pilot_updateMass( Pilot *pilot )
{
   double mass, factor;

   /* Set limit. */
   mass = pilot->solid->mass;
   if ((pilot->stats.engine_limit > 0.) && (mass > pilot->stats.engine_limit))
      factor = pilot->stats.engine_limit / mass;
   else
      factor = 1.;

   pilot->thrust  = factor * pilot->thrust_base * mass;
   pilot->turn    = factor * pilot->turn_base;
   pilot->speed   = factor * pilot->speed_base;

/* limit the maximum speed if limiter is active */
   if (pilot_isFlag(pilot, PILOT_HASSPEEDLIMIT)) {
      pilot->speed = pilot->speed_limit - pilot->thrust / (mass * 3.);
      /* Sanity: speed must never go negative. */
      if (pilot->speed < 0.) {
         /* If speed DOES go negative, we have to lower thrust. */
         pilot->thrust = 3 * pilot->speed_limit * mass;
         pilot->speed = 0.;
      }
   }
   /* Need to recalculate electronic warfare mass change. */
   pilot_ewUpdateStatic( pilot );
}
Ejemplo n.º 2
0
/**
 * @brief Updates the pilot stats after mass change.
 */
void pilot_updateMass( Pilot *pilot )
{
   pilot->turn = pilot->turn_base * pilot->ship->mass / pilot->solid->mass;

   /* Need to recalculate electronic warfare mass change. */
   pilot_ewUpdateStatic( pilot );
}
Ejemplo n.º 3
0
/**
 * @brief Updates the pilot stats after mass change.
 *
 *    @param pilot Pilot to update his mass.
 */
void pilot_updateMass( Pilot *pilot )
{
   /* Calculate mass. */
   pilot->solid->mass = pilot->ship->mass + pilot->stats.cargo_inertia*pilot->mass_cargo + pilot->mass_outfit;

   pilot->turn = pilot->turn_base * pilot->ship->mass / pilot->solid->mass;
   /* Need to recalculate electronic warfare mass change. */
   pilot_ewUpdateStatic( pilot );
}
Ejemplo n.º 4
0
/**
 * @brief Updates the pilot stats after mass change.
 *
 *    @param pilot Pilot to update his mass.
 */
void pilot_updateMass( Pilot *pilot )
{
   double mass, factor;

   /* Set limit. */
   mass = pilot->solid->mass;
   if ((pilot->stats.engine_limit > 0.) && (mass > pilot->stats.engine_limit))
      factor = pilot->stats.engine_limit / mass;
   else
      factor = 1.;

   pilot->thrust  = factor * pilot->thrust_base * mass;
   pilot->turn    = factor * pilot->turn_base;
   pilot->speed   = factor * pilot->speed_base;

   /* Need to recalculate electronic warfare mass change. */
   pilot_ewUpdateStatic( pilot );
}