Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include "navigation.h"
#include "macosx_math.h"
#include <math.h>
#include <assert.h>
#include "cmd/unit_generic.h"
#include "lin_time.h"
#include "cmd/script/flightgroup.h"
#include "config_xml.h"
#include "vs_globals.h"
#include "warpto.h"
#include "flybywire.h"
#include "cmd/unit_util.h"
Go to the source code of this file.
Functions | |
static float | CalculateBalancedDecelTime (float l, float v, float &F, float mass) |
static float | CalculateDecelTime (float l, float v, float &F, float D, float mass) |
float | CalculateNearestWarpUnit (const Unit *thus, float minmultiplier, Unit **nearest_unit, bool negative_spec_units) |
bool | DistanceWarrantsWarpTo (Unit *parent, float dist, bool following) |
static float | mymax (float a, float b) |
static float | mymin (float a, float b) |
bool | useJitteryAutopilot (Unit *parent, Unit *target, float minaccel) |
Variables | |
float | MOVETHRESHOLD = SIMULATION_ATOM/1.9 |
float | TURNTHRESHOLD = SIMULATION_ATOM/1.9 |
the time we need to start slowing down from now calculation (if it's in this frame we'll only accelerate for partial vslowdown - decel * t = 0 t = vslowdown/decel finalx = -.5 decel ( v/decel)^2 + v^2 / decel + slowdownx = .5 * v^2 / decel + slowdownx slowdownx = .5 accel * t^2 + v0 * t + initx finalx = (.5*(accel * t + v0)^2)/decel + .5 accel * t^2 + v0*t + initx ; Length = finalx-initx Length = (.5*accel^2*t^2+accel*t*v0+ .5 *v0^2)/decel + .5 accel * t^2 + v0*t
balanced thrust equation Length = accel * t^2 + 2*t*v0 + .5*v0^2/accel t = ( -2v0 (+/-) sqrtf (4*v0^2 - 4*(.5*v0^2 - accel*Length) ) / (2*accel)) t = -v0/accel (+/-) sqrtf (.5*v0^2 + Length*accel)/accel;
8/15/05 Patched Calulate BalancedDecel time: our previous quantization factor ignored the quantization during ACCEL phase and also ignored the fact that we overestimated the integral rather than underestimated new quantization factor is .5*accel*SIMULATION_ATOM*SIMULATION_ATOM-.5*initialVelocity*SIMULATION_ATOM also this threshold idea is silly–accelerate if t>SIM_ATOM decel if t<0 still havent fixed t between 0 and SIM_ATOM...have decent approx for now. 3/2/02 Patched CalculateBalancedDecel time with the fact that length should be more by a quantity of .5*initialVelocity*SIMULATION_ATOM
Definition at line 37 of file navigation.cpp.
References SIMULATION_ATOM, and v.
Referenced by Orders::MoveToParent::Execute().
the time we need to start slowing down from now calculation (if it's in this frame we'll only accelerate for partial vslowdown - decel * t = 0 t = vslowdown/decel finalx = -.5 decel ( v/decel)^2 + v^2 / decel + slowdownx = .5 * v^2 / decel + slowdownx slowdownx = .5 accel * t^2 + v0 * t + initx finalx = (.5*(accel * t + v0)^2)/decel + .5 accel * t^2 + v0*t + initx ; Length = finalx-initx Length = (.5*accel^2*t^2+accel*t*v0+ .5 *v0^2)/decel + .5 accel * t^2 + v0*t
imbalanced thrust equation Length = .5*(accel+accel*accel/decel) * t^2 + t*v0(1+accel/decel) + .5*v0^2/decel t = ( -v0*(1+accel/decel) (+/-) sqrtf (v0^2*(1+accel/decel)^2 - 2*(accel+accel*accel/decel)*(.5*v0^2/decel-Length)))/2*.5*(accel+accel*accel/decel); t = (-v0 (+/-) sqrtf (v0^2 - 2*(accel/(1+accel/decel))*(.5*v0^2/decel-Length)))/accel
Definition at line 66 of file navigation.cpp.
References SIMULATION_ATOM, and v.
Referenced by Orders::MoveToParent::Execute().
float CalculateNearestWarpUnit | ( | const Unit * | thus, |
float | minmultiplier, | ||
Unit ** | nearest_unit, | ||
bool | negative_spec_units | ||
) |
Definition at line 2595 of file unit_generic.cpp.
References _Universe, Universe::activeStarSystem(), StarSystem::collidemap, UnitCollection::fastIterator(), findObjects(), UniverseUtil::getPlanetRadiusPercent(), UnitUtil::getSignificantDistance(), VegaConfig::getVariable(), Unit::graphicOptions, StarSystem::gravitationalUnits(), Unit::location, XMLSupport::parse_float(), PLANETPTR, Unit::Position(), QVector, NearestUnitLocator::retval, Unit::rSize(), Unit::specInterdiction, Unit::graphic_options::specInterdictionOnline, Collidable::CollideRef::unit, Unit::UNIT_ONLY, and vs_config.
Referenced by Unit::AddVelocity(), and Orders::AutoLongHaul::Execute().
Definition at line 12 of file warpto.cpp.
Referenced by Orders::AutoLongHaul::Execute(), and WarpToP().
Definition at line 475 of file navigation.cpp.
References b.
Referenced by Unit::DamageRandSys(), DrawShield(), Orders::AutoLongHaul::Execute(), HaloAccelSmooth(), Beam::Init(), and Unit::LightShields().
Definition at line 484 of file navigation.cpp.
References Unit::Computer::combat_mode, Unit::computer, Unit::GetComputerData(), VegaConfig::getVariable(), Unit::graphicOptions, Unit::isPlanet(), Unit::Computer::max_combat_ab_speed, StarSystemGent::maxspeed, XMLSupport::parse_float(), Unit::specInterdiction, Unit::graphic_options::specInterdictionOnline, and vs_config.
Referenced by Orders::AutoLongHaul::Execute().
float MOVETHRESHOLD = SIMULATION_ATOM/1.9 |
Definition at line 114 of file navigation.cpp.
float TURNTHRESHOLD = SIMULATION_ATOM/1.9 |
Definition at line 270 of file navigation.cpp.