Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug where the air drag coefficient of a vehicle isn't updated when doors are opened/closed #39761

Merged
merged 1 commit into from
Apr 21, 2020

Conversation

thorondir
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Updates vehicle drag when door opened/closed"

Purpose of change

When a vehicle's door is opened or closed, the drag doesn't appear to change when the vehicle is examined, even though drag is supposed to be different depending on whether doors and trunks are open. This causes vehicles to appear to have much higher drag when they are loaded with open doors/trunks which are subsequently closed.

Describe the solution

Set coeff_air_dirty=true at the end of the function vehicle::open_or_close(), so that vehicle::coeff_air_drag() performs a full calculation, instead of just returning coefficient_air_resistance.

Describe alternatives you've considered

I considered trying to find a more complicated solution, but decided against it, since this was a very simple solution to a fairly simple problem (and I would like to get some sleep) (this also seemed like the approach which would result in me having the least likelihood of screwing anything else up).

Testing

Recompiled game and summoned two identical vehicles. Closed all doors and trunks on both vehicles to find that they had different drag coefficients. Saved game and reloaded, after which the vehicles had the same drag coefficient. Opened doors and trunks, checked the vehicles, and found that the drag coefficients were unchanged.

Repeated this after the fix, and found that drag coefficients changed when expected to.

Additional context

Sorry if this is really scuffed. I've never done one of these before.

take into account the opening and closing of doors/trunks
@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Vehicles Vehicles, parts, mechanics & interactions labels Apr 20, 2020
@ZhilkinSerg ZhilkinSerg merged commit 2d89311 into CleverRaven:master Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants