Skip to content

simplify vpart_info::has_control_req #81823

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sonphantrung
Copy link
Contributor

Summary

None

Purpose of change

I feel the check can be simplified a bit.

Describe the solution

As the title suggests.

Describe alternatives you've considered

  • Just dump the whole function entirely, but it'll be too long to read
  • I'm thinking of adding terrain type of argument that will remove the need for duplicate can_control_* functions. It's beyond my expertise — sadly.

Testing

Should work

Additional context

This is a result of me obsessively reading the same PR again and again just to have more understanding of the code.

@github-actions github-actions bot added Vehicles Vehicles, parts, mechanics & interactions [C++] Changes (can be) made in C++. Previously named `Code` labels Jul 15, 2025
Copy link
Contributor

@ehughsbaird ehughsbaird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is an improvement.
You're making a function that tells us if a vehicle part has a control requirement require passing in data from that vehicle part, and it will work incorrectly if you pass in data from another vehicle part.

You could have a has_control_req_air and has_control_req_land functions if you think it's important to split these, but this just seems like churn.

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants