[WIP] Add physics calculations for vehicles. Not actually used anywhere yet.

The description from veh_physics.h is:
    /**
     * Max acceleration mode assumes flat ground and accelerates (from a
full stop) as fast as
     * possible across multiple tiles (max 1000 tiles or 10 secs) until
target_speed is reached.
     * Used by veh_interact to display vehicle stats.
     * @param target_speed Target speed to accelerate to in m/s
     * @param max_power Assume all engines are 100% health and fuelled
     * @return Time taken to reach target_speed, if negative it's speed
reached after 10 secs instead
     */
     double calculate_acceleration( double target_speed, bool max_power =
false );

So it doesn't use the current location but a perfect road, sorta like the
0-100 times you'd see on an info page about a car.

I don't use a formula because trying to integrate all the variables
correctly was beyond my skills and would anyways have resulted in an
incomprehensible monstrosity that no mere mortal would be able to debug or
improve (I could be wrong here, maybe some physics wizard could actually
make a simple formula, but I have my doubts).

On Tue, Dec 30, 2014 at 3:50 AM, Kevin Granade <notifications@github.com>
wrote:

> In src/veh_physics.cpp
> <https://github.com/CleverRaven/Cataclysm-DDA/pull/10666#discussion-diff-22337439>
> :
>
> > +    if( engine_watt_avail < 1 ) {
> > +        return 0.0;
> > +    }
> > +    double total_time = 0.0, tile_time;
> > +    int nr_calcs = 0;
> > +    int old_velocity = veh->velocity;
> > +    veh->velocity = 0;
> > +    do {
> > +        tile_time = calculate_time_to_move_one_tile( 1.0 );
> > +        veh->velocity = int( velocity_end * 223.6 + 0.5 );
> > +        if( veh->velocity == 0 ) {
> > +            veh->velocity = old_velocity;
> > +            return 0.0;
> > +        }
> > +        total_time += tile_time;
> > +        if( total_time >= 10.0 ) {
>
> To verify that I'm understanding you, when you bring up the vehicle
> interaction screen, you're planning on simulating accelerating from the
> current location for 10 seconds in order to determine max speed? Why not
> just use a formula?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/CleverRaven/Cataclysm-DDA/pull/10666/files#r22337439>.
>



-- 

 - Vidar