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 cables #60516

Merged
merged 1 commit into from
Aug 29, 2022
Merged

fix cables #60516

merged 1 commit into from
Aug 29, 2022

Conversation

Hirmuolio
Copy link
Contributor

Summary

Bugfixes "Fix power cables"

Purpose of change

Fix #60512

Describe the solution

Remove the item in the item use action.

Describe alternatives you've considered

Use "SINGLE_USE" flag.

Testing

Jumper cable is removed after use (vehicle) and works.
Extension cord is removed after use (appliance) and works.

Additional context

@github-actions github-actions bot added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Aug 28, 2022
@irwiss
Copy link
Contributor

irwiss commented Aug 28, 2022

Between #60489 and this cables issue, I think something is broken with how iuse::* return value is used

Returning 1 should already remove the item from inventory, no?

If not then the comment here needs to be updated too (well, it needs to be updated to int regardless but...), and the functions changed to void

// iuse methods returning a bool indicating whether to consume a charge of the item being used.

@Hirmuolio
Copy link
Contributor Author

Hirmuolio commented Aug 28, 2022

There is a more up to date comment in iuse.cpp https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/iuse.cpp#L493

Seems like that comment in iuse.h is several years out of date.

Both of the problems were fallout from #60039.
The reason for cable problem: It used to be so that if the use action returned >0 (to consume charges) and the tool json was defined to consume 0 charges per use the tool would then be deleted. That weird behavior was removed. Either items need to use the "SINGLE_USE" flag or remove the item in the use action.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Aug 28, 2022
@irwiss
Copy link
Contributor

irwiss commented Aug 28, 2022

Ah I see, might be worth moving the up to date comment to the header then - IDEs can pick it up for hints as well.

Not sure how anyone will find a comment buried 500 lines down in the middle of unrelated methods

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.

Extension cord item not removed after connecting two appliances
3 participants