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

That function is used to calculate acceleration 0-60mph (or 0-100kph). Some
cars will not be able to reach those speeds ever, so I need a fallback. In
this case I chose the speed it is able to reach after 10 second. I could
use anything here, 100 seconds, 1 second, 0.1 millisecond, it's just used
as a car performance indicator and will be displayed in veh_interact
instead of safe/top speed.

On Tue, Dec 30, 2014 at 2:15 AM, Kevin Granade <notifications@github.com>
wrote:

> In src/veh_physics.cpp
> <https://github.com/CleverRaven/Cataclysm-DDA/pull/10666#discussion-diff-22335832>
> :
>
> > +    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 ) {
>
> Why 10 sec? one turn is 6 sec.
> also, please keep the interleaving of vehicle movement, it's problematic
> to do all of one vehicle's movement followed by the next.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/CleverRaven/Cataclysm-DDA/pull/10666/files#r22335832>.
>



-- 

 - Vidar