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

AIM: when cannot wear, try to wield #73181

Merged
merged 2 commits into from
Apr 23, 2024
Merged

Conversation

Brambor
Copy link
Contributor

@Brambor Brambor commented Apr 21, 2024

Summary

Interface "AIM: when cannot wear, try to wield"

Purpose of change

Resolve #73121

Describe the solution

  • Hack new destination into AIM: AIM_WIELD.
  • It can be accessed only as a destination when the destination is AIM_WEAR and the item cannot be worn but can be wielded.
  • Once one item is moved there, AIM_WIELD is not a selected destination anymore. (I believe).

Describe alternatives you've considered

Make it a proper selectable destination. More code, less hacky ( => less bugs?), more things in AIM.

Testing

More testing should be done. Current testing is sufficient.

  • I moved things to and from WORN.
  • Before I finished, items sometimes disappeared, I only hope it is impossible now. edit: source == dest would probably need to be true for them to disappear (according to .h file)
  • in action_move_item squares[destarea] is sometimes accessed. I think it should be undefined behaviour when destarea = AIM_WIELD, but didn't test it. Removed occurrences by refactoring
  • bug: having no space to store and wearing a mattress asks to wield the mattress instead then fails with "Destination area is full. Remove some items first." It probably considers the free volume of the inventory. It shouldn't, it should wield the mattress. Fixed.

Additional context

Demonstrating better flow of Wearing / Wielding:

Cataclysm_.Dark.Days.Ahead.-.0.G-8938-geb7c262356-dirty.2024-04-22.10-31-45.mp4

@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) Info / User Interface Game - player communication, menus, etc. 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 Apr 22, 2024
 - move `squares[destarea]` to where it is not undefined behaviour
 - typo fix
 - style
@Brambor
Copy link
Contributor Author

Brambor commented Apr 22, 2024

Looking through the code I see no more undefined behaviour.

Edit: the rest is unrelated and I reported it separately

However, there is a serialization/deserialization problem. I think it is unrelated...
  • OS: Windows
    • OS Version: 10.0.19045.4291 (22H2)
  • Game Version: 0.G-8939-ge41a476e0a [64-bit]
  • Graphics Version: Tiles
  • Game Language: English [en]
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Portal Storms Ignore NPCs [personal_portal_storms],
    Slowdown Fungal Growth [no_fungal_growth]
    ]

TEST hint good-trimmed.tar.gz

Reproduction steps:

  1. Load

@Maleclypse Maleclypse merged commit 8836287 into CleverRaven:master Apr 23, 2024
25 of 29 checks passed
@Brambor Brambor deleted the AIM-wield branch April 23, 2024 13:42
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` Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AIM - wear menu: allow wielding
2 participants