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

Fix map cache segfault, remove omt tripoints from map items' operations #79537

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

ShnitzelX2
Copy link
Contributor

@ShnitzelX2 ShnitzelX2 commented Feb 4, 2025

Summary

Bugfixes "fix map cache segfault, remove omt tripoints from map items' operations"

Purpose of change

Fix segfault on using a map cache item

Describe the solution

#79307 didn't account for location_variable_adjust, which uses tripoint_abs_ms and not tripoint_abs_omt, resulting in a tripoint type mismatch. When it was submitted, the maps I used just happened to work, I guess.

I realized that EOCs pretty much exclusively use tripoint_abs_ms, so trying to include more point types into EOCs was probably a bad idea. SPAWN_LOCATION_OMT using tripoint_abs_omt was therefore the outlier, so I changed it to record tripoint_abs_ms and project to _omt for reveal_map.

There are still issues with map-related items initializing their locations, see #79536

Describe alternatives you've considered

Serializing tripoint type and/or generalizing EOC tripoint use, either of which are overkill for maps alone

Testing

Used both a map cache with and without an initialized location, used a road map, verified TCLF badges still display correctly

For existing saves: because the item_var fields' names were changed, existing unread maps/badges you still want to use can be reinitialized by dropping them near their original spawn location; using them without doing this will default to the player's position without error

Additional context

 this is because EOCs generally only support reading ms tripoints
@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. NPC / Factions NPCs, AI, Speech, Factions, Ownership [JSON] Changes (can be) made in JSON Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs EOC: Effects On Condition Anything concerning Effects On Condition <Bugfix> This is a fix for a bug (or closes open issue) labels Feb 4, 2025
@ShnitzelX2 ShnitzelX2 changed the title Fix map cache segfault, remove omt tripoints from map operations Fix map cache segfault, remove omt tripoints from map itemsoperations Feb 4, 2025
@ShnitzelX2 ShnitzelX2 changed the title Fix map cache segfault, remove omt tripoints from map itemsoperations Fix map cache segfault, remove omt tripoints from map items' operations Feb 4, 2025
@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Feb 4, 2025
@GuardianDll GuardianDll merged commit 6882f8b into CleverRaven:master Feb 5, 2025
33 checks passed
@ZhilkinSerg
Copy link
Contributor

ZhilkinSerg commented Feb 5, 2025

This probably needs a migration from spawn_location_omt to spawn_location

@GuardianDll
Copy link
Member

undefined EoC coordinate variables are treat as coordinates of one of the talker as fallback
which is bad and a lot of people told we need to remove it, but it saves us here, the game would just assume to reveal area around character

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 <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. <Documentation> Design documents, internal info, guides and help. EOC: Effects On Condition Anything concerning Effects On Condition [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants