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

total_mass() loops through every part and item stored in that part, I don't
want to do that 20 times while calculating stuff. The others are less
intensive, but still worth caching.

On Tue, Dec 30, 2014 at 1:51 AM, Kevin Granade <notifications@github.com>
wrote:

> In src/veh_physics.h
> <https://github.com/CleverRaven/Cataclysm-DDA/pull/10666#discussion-diff-22335432>
> :
>
> > +
> > +public:
> > +    veh_physics(vehicle *v) : veh(v) {
> > +        mass = veh->total_mass();
> > +        eng_pwr_cur = veh->total_power();
> > +        eng_pwr_max = veh->total_power(false);
> > +        engine_watt_avail = veh->engine_on ? double(veh->power_to_epower(eng_pwr_cur)) : 0.0;
> > +        valid_wheel_config = veh->valid_wheel_config(); /* Cache this */
> > +        tire_friction_coeff = 0.7;
> > +        ground_res_coeff = 0.01;
> > +    }
> > +
> > +    /**
> > +     * These values are used when accelerating/braking and in the examine screen
> > +     * The first letters of the comments shows where the value is used:
> > +     * i=internal, basic properties of vehicle, copied from vehicle, setup in constructor
>
> why ever copy values from the vehicle? just use them from the vehicle.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/CleverRaven/Cataclysm-DDA/pull/10666/files#r22335432>.
>



-- 

 - Vidar