mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-12-06 02:40:23 -08:00
Fixed boolean setters for Structs (#8041)
This commit is contained in:
parent
a3a071e520
commit
2c103c157a
1 changed files with 3 additions and 3 deletions
|
|
@ -97,14 +97,14 @@ public class StructProcess extends BaseProcessor{
|
|||
}
|
||||
|
||||
//[setter] + [constructor building]
|
||||
if(varType == TypeName.BOOLEAN){
|
||||
if(isBool){
|
||||
cons.append(" | (").append(varName).append(" ? ").append("1L << ").append(offset).append("L : 0)");
|
||||
|
||||
//bools: single bit, needs special case to clear things
|
||||
setter.beginControlFlow("if(value)");
|
||||
setter.addStatement("return ($T)(($L & ~(1L << $LL)))", structType, structParam, offset);
|
||||
setter.nextControlFlow("else");
|
||||
setter.addStatement("return ($T)(($L & ~(1L << $LL)) | (1L << $LL))", structType, structParam, offset, offset);
|
||||
setter.nextControlFlow("else");
|
||||
setter.addStatement("return ($T)(($L & ~(1L << $LL)))", structType, structParam, offset);
|
||||
setter.endControlFlow();
|
||||
}else if(varType == TypeName.FLOAT){
|
||||
cons.append(" | (").append("(").append(structType).append(")").append("Float.floatToIntBits(").append(varName).append(") << ").append(offset).append("L)");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue