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

tidy up fault code a bit #76314

Merged
merged 5 commits into from
Sep 16, 2024
Merged

Conversation

GuardianDll
Copy link
Member

Summary

None

Purpose of change

Code i made in #74696 is... not good

Describe the solution

This tries to clean it up a bit, and also resolves the problem of function applying the first fault it finds instead of random one

Testing

I shoot a gun and was able to apply more than 1 type of fault
image
image
image

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions labels Sep 9, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Sep 9, 2024
@akrieger
Copy link
Member

akrieger commented Sep 9, 2024

🤔 IDK the old code seemed pretty fine to me? The new code is almost strictly less efficient (although in practice it doesn't matter) and not really cleaner.

You could maybe make the random_fault_of_type a static helper in item.cpp

Does faults_potential_of_type have to return a set (can there be duplicate entries in type->faults), or can it be a vector which is generally cheaper?

@GuardianDll
Copy link
Member Author

it is cleaner in a sense that instead of calling faults:: and shoving both item and fault type, you instead call item and shove only fault type

I could, if i knew what static helper is and how to make it :)

No, it can return a vector, array of faults in item should not repeat

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Sep 10, 2024
@Maleclypse Maleclypse merged commit e186f1b into CleverRaven:master Sep 16, 2024
26 checks passed
@GuardianDll GuardianDll deleted the faults_again branch September 16, 2024 05:57
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 [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.

3 participants