Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

[901] Cast from float to bool error that shouldn't be there

5 replies · 1,646 views · Started 24 December 2008

This code:

if(Game->LItems[level]&LI_COMPASS != 0){
//etc

Causes the compiler to flag up a 'cast from float to bool' error.
Not a warning, an error. Script does not compile.

However, this code:

int a = Game->LItems[level]&LI_COMPASS;
if(a != 0){

Does not.

The first one shouldn't either.

What you see:

if( (Game->LItems[level] & LI_COMPASS) != 0) {
//etc

What the compiler sees:

if( Game->LItems[level] & (LI_COMPASS != 0)) {
//etc

I think the AND operator should have a higher priority than comparison, but it clearly does not.

OK, nevermind this one.
Not a bug.

EDIT:
But I can't seem to find the 'change thread icon' whatsit.