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

typify v-w #79410

Merged
merged 1 commit into from
Jan 30, 2025
Merged

typify v-w #79410

merged 1 commit into from
Jan 30, 2025

Conversation

PatrikLundell
Copy link
Contributor

Summary

None

Purpose of change

Change usage of untyped coordinates into typed ones. This time files v-w, reaching the end of the set.

Describe the solution

Replace usage of untyped coordinates with the corresponding typed ones. Also removing untyped operations orphaned by previous typification efforts.

Describe alternatives you've considered

Testing

Load save, walk up ramp, jump into car, drive through hay bales, run over zombie corpse with inventory, run over turkey, smash into stationary vehicle. Nothing odd seen.

Additional context

This should be the end of the typification effort, at least the majority of it. There are a few remaining untyped usages:

  • The UI. It seems to use a bunch of different coordinate systems, some of which aren't defined as typed ones:
    • Pixels coordinates
    • Tile coordinates. Still uncertain whether these are in bubble coordinates/abs_omt coordinates or in some kind of frame coordinates.
    • Line/Row coordinates for text display.
    • Any others?
  • Some mapgen stuff. It still remains to tease out what these coordinates are, and if they're always the same.
  • vehicle_autodrive,cpp uses some internal untyped class looking structs that seem to be used with different types. Unclear whether there's usage of an internal coordinate system or if it's all relative coordinates tied to a vehicle.
  • Missed stuff. That's always a possibility.
  • Tests. Since the tests aren't using obsolete untyped operations I don't think it's worth the trouble to clean up the test internals. It would still make sense to do so when tests are modified for other reasons, but not as a dedicated task.

@github-actions github-actions bot added Vehicles Vehicles, parts, mechanics & interactions 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 Jan 29, 2025
@GuardianDll GuardianDll merged commit f53c0f2 into CleverRaven:master Jan 30, 2025
29 checks passed
@GuardianDll
Copy link
Member

GuardianDll commented Jan 30, 2025

I have two little side questions:
first, if you say typification is almost finished, does it mean #78703 can be closed as superceded by one of your PRs?
and second, am i correct in my understanding that convert_tripoint_from_var() still uses outdated tripoint?

@PatrikLundell
Copy link
Contributor Author

  1. No. That PR covers a "leftover", in this case support operations that are untyped and used on typed data. There's more of that out there.
  2. Looking at convert_tripoint_from_var(), it seems to me that the template should return any kind of tripoint, since it casts a raw tripoint value parsed from a string into whatever matches the template type parameter. Looking at its two usages, one assigns the result to a tripoint_abs_ms and the other to a tripoint_abs_omt, which seems correct. All the JSON related stuff untypes coordinates when turned into a string and casts it back to the corresponding type when reading it.
    Note that I don't quite understand the question, so my answer may miss the mark.

@PatrikLundell PatrikLundell deleted the typify branch January 30, 2025 08:19
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. 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