Game: CS:GO
SM version: 1.10.0.6392
MM version: 1.11.0-dev+1127
So, basically after spending a significant amount of time on finding the bug in code I've realized that a method for enum struct that returns boolean value doesn't return proper value. Both returnTrue() and returnFalse() methods return false in this case. Returning of int values works fine.
Example code:
Code:
enum struct Example {
int x; // useless, added here just to compile it. enum struct requires at least 1 field.
bool returnTrue() {
return true;
}
bool returnFalse() {
return false;
}
int return0() {
return 0;
}
int return1() {
return 1;
}
int return12345() {
return 12345;
}
}
void printBool(bool value) {
PrintToChatAll("bool value: %s", value ? "true" : "false");
}
void test() {
Example example;
printBool(example.returnTrue());
printBool(example.returnFalse());
PrintToChatAll("0 = %i", example.return0());
PrintToChatAll("1 = %i", example.return1());
PrintToChatAll("12345 = %i", example.return12345());
}
Expected output:
Code:
bool value: true
bool value: false
0 = 0
1 = 1
12345 = 12345
In-game output:
Code:
bool value: false <----------------- ???
bool value: false
0 = 0
1 = 1
12345 = 12345
A method returns false no matter what you really pass in the return statement.
In the original code, where I found the bug, a method always
returned true, so something is really wrong here.