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 clang tidy error in condition.cpp #72670

Merged
merged 2 commits into from
Mar 29, 2024

Conversation

GuardianDll
Copy link
Member

Summary

None

Purpose of change

Fix clang tidy, and make the field work as it should work

Describe the solution

If not terrain, then search furniture

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` EOC: Effects On Condition Anything concerning Effects On Condition astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Mar 28, 2024
@GuardianDll
Copy link
Member Author

Ok clang do not like this solution, i'll check what's going on later, unless someone knows what's the problem

@GuardianDll GuardianDll marked this pull request as draft March 28, 2024 07:51
@PatrikLundell
Copy link
Contributor

I'd expect you'd need to change the right side to a furn_id if you change the left side to one.

@GuardianDll
Copy link
Member Author

i copied the code from conditional_t::func f_map_ter_furn_with_flag, and it has it like this also

if( terrain ) {
return get_map().ter( loc )->has_flag( furn_type.evaluate( d ) );
} else {
return get_map().furn( loc )->has_flag( furn_type.evaluate( d ) );
}

@PatrikLundell
Copy link
Contributor

Well, in the source you copied both ter and furn happen to have flag operations returning the same type. The code you tried to correct, however, has a left and a right side of the ter_id type, and you changed only the left one.
I'd expect the string mess on the right side to be either a terrain string or a furniture string, with the first branch trying to convert it to a ter_id, while the second one ought to have tried to convert it to furn_id.
This compiles locally for me:
return get_map().furn( loc ) == furn_id( furn_type.evaluate( d ) );

@GuardianDll
Copy link
Member Author

compiled, tested, seems to work

@GuardianDll GuardianDll marked this pull request as ready for review March 28, 2024 16:37
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 28, 2024
@Maleclypse Maleclypse merged commit 81c53bb into CleverRaven:master Mar 29, 2024
28 of 39 checks passed
@GuardianDll GuardianDll deleted the identical_then_and_else branch April 10, 2024 06:55
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` EOC: Effects On Condition Anything concerning Effects On Condition json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants