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

typified a bit of vehicle.h and dependents #77554

Merged
merged 5 commits into from
Nov 10, 2024

Conversation

PatrikLundell
Copy link
Contributor

@PatrikLundell PatrikLundell commented Nov 3, 2024

Summary

None

Purpose of change

Another step on the path to use typed coordinates, this time focusing on vehicle.h and dependents.

Describe the solution

Continue from where the previous PR left off to:
Change untyped coordinate fields and operation parameter/results into appropriate typed ones, converting reasonably easy usages and removing orphaned untyped operations.
There should be no functional changes.

Also split a "point" parameter used to hide turn direction + acceleration into its parts in a couple of operations so it's actually possible to understand what the parameters are. It can be noted that one of the users of this seems to use the same practice, but dealing with that was considered out of scope.

Describe alternatives you've considered

Testing

Loaded a save, walked up a ramp, jumped into a car, drove through some hay bales (which are no longer reinforced), missed zombie corpses, but ran over a turkey and smashed into a stationary vehicle. Nothing odd seen.

Additional context

There was one untyped element of vehicle that was used to store both absolute coordinates (for item use) and bubble coordinates (for turret use). I settled on absolute coordinates, as that's the one that won't break with a change of bubble references, and converted the bubble usage to convert to/from absolute. Presumably the two usages don't overlap, but I wouldn't bet on what happens if a cannon engages while your doing whatever the item stuff does.

It's not that much left of the vehicle header after this pass. The next one will probably deal with that and start with the implementation. Vehicle parts have a bunch of annoying untyped fields blocking some conversion, so that's probably the next target after the vehicle implementation has been dealt with, but it's unlikely that will being in the next PR.

Given that this touches a lot of files, there's definitely a merge conflict risk merging this PR concurrently with others, so that should probably be avoided.

@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership Info / User Interface Game - player communication, menus, etc. Map / Mapgen Overmap, Mapgen, Map extras, Map display Vehicles Vehicles, parts, mechanics & interactions Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Appliance/Power Grid Anything to do with appliances and power grid 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 Nov 3, 2024
@PatrikLundell
Copy link
Contributor Author

Hidden among hundreds of copies of the same demands for obfuscation addressed by an update, there was a demand I was unable to parse:
It demanded that this function implementation:

std::vector<vehicle_part *> vehicle::get_parts_at( const tripoint_bub_ms &pos,
        const std::string &flag,
        const part_status_flag condition )

should have "const" added apparently between "vehicle::" and "get_parts_at". This function is identical to the old untyped function directly above, save for the "pos" parameter being typed.
I need help to be able to satisfy the demand I'm sure will be repeated when the next round of compilation is done (but hopefully not buried near as deep in chaff).

@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 3, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 3, 2024
@github-actions github-actions bot added BasicBuildPassed This PR builds correctly, label assigned by github actions and removed BasicBuildPassed This PR builds correctly, label assigned by github actions labels Nov 9, 2024
@Maleclypse Maleclypse merged commit 340d049 into CleverRaven:master Nov 10, 2024
19 of 26 checks passed
@PatrikLundell PatrikLundell deleted the typify branch November 10, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Appliance/Power Grid Anything to do with appliances and power grid 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` Code: Tests Measurement, self-control, statistics, balancing. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display NPC / Factions NPCs, AI, Speech, Factions, Ownership Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants