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

dirty caches on translucency change #77532

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

PatrikLundell
Copy link
Contributor

Summary

None

Purpose of change

Fix #77521 (but only in a very literal sense).

Describe the solution

  • Add checks to terrain/furniture changes as to whether translucency changes, not only "transparency", as the latter is set for both transparent and translucent terrain/furniture.
  • Update build_vision_transparency_cache to rely on the terrain setting cache invalidation, which also means the translucency juggling can be moved after the cache replacement, and so the appropriate tiles can be updated directly rather than stored in an array.

Describe alternatives you've considered

Wait until someone can figure out how to deal with closing door effects being delayed (see Additional context).

Testing

  • Load bug report save.
  • Open door.
  • Verify that the area beyond is now shown.
  • Close door.
  • See that the area beyond remains displayed, which it shouldn't be.
  • Wait a tick (or smash the floor, or whatever).
  • See that the displayed area beyond the door is finally hidden as it should be.
  • Walk to a regular door and open it.
  • Verify that the area beyond is shown.
  • Close the door again.
  • Verify that the area beyond is hidden immediately, as it should.
  • Translucent furniture is not tested. I don't think there is any currently, and I don't think it would work, as I don't see any code that seems to deal with it.

Additional context

The translucency handling is a hack that's not fully carried through. Translucent terrain is handled as transparent in the terrain information (i.e. both flags set the same boolean). This means that the operations and transparency cache accessing code is completely oblivious of there being such a thing as translucency which is ignored by the access operations and the transparency cache.
As mentioned above, there is now a problem with the lingering visibility when a translucent door is closed (this was hidden previously, because nothing was revealed, so that state remaining didn't differ from it being set).
A lot of these usages of transparency information should probably also check transparency (such as e.g. whether creatures can see each other), but which? And how to test the changes?
I've tried to hack in checks in a number of suspects, one at a time, but none have removed the door closing update delay, so they are all removed again.

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Nov 2, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 2, 2024
@ZhilkinSerg ZhilkinSerg merged commit 4f011de into CleverRaven:master Nov 15, 2024
22 of 28 checks passed
@PatrikLundell PatrikLundell deleted the translucent branch November 15, 2024 10:56
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` json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected behaviour after light map adjustments
2 participants