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

Add support for boolean operations betwen variants #53690

Closed
wants to merge 1 commit into from

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Oct 11, 2021

Fixes #44688

I had to split variant_op.cpp into multiple files, because of C1128 (file too big for debugging). The files need cleanup.
If you are wondering why the PR is so big, it's because it adds support for and/or between any Variant type, as it was in 3.x.

Also the code is broken. When I try to do any boolean operation in GDScript it fails, saying invalid operand. I don't know why ;_;

@KoBeWi
Copy link
Member Author

KoBeWi commented Oct 12, 2021

Ok, so the problem is basically that the operators are stored in a static array. And for whatever reason, my function _register_variant_operators2(), which is defined in another file, uses a different array, despite it being the same static variable. After some googling it turns out that it's a common problem and static variables should only be defined in cpp files (apparently even header guards don't protect from multiple static definitions).

I have no idea where to put this array so that it properly compiles and works as expected. I give up. I hate C++ ;_;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GDScript: logical and/or between non boolean value cause a parser error
1 participant