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

do_aggressive_sentient logical issue #179

Open
mattgodbolt opened this issue Aug 25, 2020 · 1 comment
Open

do_aggressive_sentient logical issue #179

mattgodbolt opened this issue Aug 25, 2020 · 1 comment
Labels
bug Something isn't working code-cruft Internal code cleanups

Comments

@mattgodbolt
Copy link
Owner

mattgodbolt commented Aug 25, 2020

    if (IS_SET(ch->act, ACT_AGGRESSIVE) && !IS_SET(ch->in_room->room_flags, ROOM_SAFE) && !IS_AFFECTED(ch, AFF_CALM)
        && (ch->fighting == nullptr) // Changed by Moog
        && !IS_AFFECTED(ch, AFF_CHARM) && IS_AWAKE(ch) && !(IS_SET(ch->act, ACT_WIMPY) && IS_AWAKE(wch))
        && can_see(ch, wch) && !number_bits(1) == 0) {

the !number_bits(1) == 0 doesn't do what we'd expect. clang-tidy says: "Logical not is only applied to the left hand side of this comparison" and suggests changing it to !(number_bits(1) == 0) which is to say number_bits(1) == 1. But it's not clear what we were trying to do here at all

@mattgodbolt mattgodbolt added bug Something isn't working code-cruft Internal code cleanups labels Oct 1, 2020
@mattgodbolt
Copy link
Owner Author

Came across this again...anyone have a guess at the original intention?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code-cruft Internal code cleanups
Projects
None yet
Development

No branches or pull requests

1 participant