10.07.2015, 21:14
Just compare it with COLOR_WHITE? What is so hard about that? They're just numbers, after all.
The ~ operator is known as bitwise not, or the one's complement; it inverts all the bits. So when applied to decimal 0, which has 32 bits all set to 0, you get 32 bits set to 1. When converting that to decimal you get decimal -1 or hexadecimal 0xFFFFFFFF, which is coincidentally the color white. So basically that if-statement would return true for anything BUT the color white and is therefore equal to GetPlayerColor != -1.
The ~ operator is known as bitwise not, or the one's complement; it inverts all the bits. So when applied to decimal 0, which has 32 bits all set to 0, you get 32 bits set to 1. When converting that to decimal you get decimal -1 or hexadecimal 0xFFFFFFFF, which is coincidentally the color white. So basically that if-statement would return true for anything BUT the color white and is therefore equal to GetPlayerColor != -1.