Advertisement Jump to content
Sign in to follow this  
_Vicious_

Implicit conversion changed sign of value

This topic is 1798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Andreas,

 

here I am again with another question :)

 

The following code produces a warning which says "Implicit conversion changed sign of value":

       
if ( ( G_PointContents( spawn.origin ) & CONTENTS_NODROP ) != 0 )
...

 

G_PointContents's declaration is:

 

int G_PointContents( const Vec3 &in origin )

 

and CONTENTS_NODROP is an enum. Changing the line to read:

 

if ( ( G_PointContents( spawn.origin ) & uint( CONTENTS_NODROP ) ) != 0 )

 

fixes the warning. Why casting an enum to unsigned int fixes the warning, while G_PointContents is obviously a signed integer?

Share this post


Link to post
Share on other sites
Advertisement

Hm, after updating to WIP Angelscript version, I get loads of the following errors:

dm.as 275:33: No conversion from 'uint' to 'uint' available.
^5ANGELSCRIPT:

legacy/quake1.as 86:1: Compiling void light_fluoro_use(Entity@, Entity@, Entity@)
^1ERROR:

legacy/quake1.as 91:23: No conversion from 'int' to 'int' available.
^3WARNING:

Share this post


Link to post
Share on other sites
void item_weapon( Entity @ent )
{
	if( (ent.spawnFlags & WEAPON_ROCKET) == WEAPON_ROCKET )
	{
		if( (ent.spawnFlags & WEAPON_BIG) == WEAPON_BIG )
			GENERIC_SpawnItem( ent, AMMO_ROCKETS );
		else
			GENERIC_SpawnItem( ent, AMMO_WEAK_ROCKETS );	
	}
	else if( (ent.spawnFlags & WEAPON_SPIKES) == WEAPON_SPIKES )
	{
		if( (ent.spawnFlags & WEAPON_BIG) == WEAPON_BIG )
			GENERIC_SpawnItem( ent, AMMO_PLASMA );		
		else
			GENERIC_SpawnItem( ent, AMMO_WEAK_PLASMA );
	}	
	else if( (ent.spawnFlags & WEAPON_SHOTGUN) == WEAPON_SHOTGUN )
	{
		if( (ent.spawnFlags & WEAPON_BIG) == WEAPON_BIG )
			GENERIC_SpawnItem( ent, AMMO_SHELLS );
		else
			GENERIC_SpawnItem( ent, AMMO_WEAK_SHELLS );
	}
}

Basically, each '(ent.spawnFlags & WEAPON_ROCKET) == WEAPON_ROCKET'-style comparison throughout the source code results in compilation error.

 

WEAPON_ROCKET again is an enum, spawnflags is an integer property.

Edited by _Vicious_

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!