• Advertisement
Sign in to follow this  

temporary address warning help

This topic is 2899 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 all, im currently working on the iPhone and using objective C and im getting this error which im not sure how to get rid of. it says warning: taking address of temporary. here is the code related to it. my data struct
typedef struct 
{
	DS2DVector	Position;
	float		orientation;
	
	int			ID;
} packetData;

my class which holds 2 declared array's of the struct
@interface PhaseManager : NSObject 
{
	//current phase
	DSPhase				*currentPhase;
	//Dictionary of scenes
	NSMutableDictionary *Phases;
	//Global aloha for fading screens
	float				globalAlpha;
	//view for each phase to access
	DSGLView			*glView;
	
	//access to the network controller
	DSGameKitController		*GKController;
	bool					peerIsConnected;
	packetData				tankInfo[2]; ///////HERE////////
	packetData				bulletInfo[2];////////HERE///////
	int						playerID;
	
	bool				isPaused;
}

@property( nonatomic, retain ) DSPhase		*currentPhase;
@property( nonatomic, retain ) DSGLView		*glView;
@property( readonly ) bool					isPaused;
@property( readonly )DSGameKitController	*GKController;
@property( assign )bool						peerIsConnected;




+ (PhaseManager*)sharedPhaseManager;
- ( void )addPhaseToDictionary:( DSPhase* )Phase withKey:( NSString* )aKey;
- ( DSPhase* )getPhaseWithKey:( NSString* )aPhaseKey;
- ( BOOL )setCurrentPhaseWithKey:(NSString*)aPhaseKey;
- ( BOOL )unloadPhaseWithKey:( NSString* )aPhaseKey;
- ( void )setIsPaused:( bool )paused;

- ( packetData )getTankInfo:( int )tankNumber; 
- ( packetData )getBulletInfo:( int )bulletNumber; 
- ( void )setDataPacket:( int )ID ofPlayer:( int )player position:( DS2DVector )pos orientation:(float)orientation;


@end

and this is where im getting the warning
	[_phaseManager setDataPacket:0 ofPlayer:0 position:playerLocation orientation:0];//tank
	[_phaseManager setDataPacket:1 ofPlayer:0 position:playerLocation orientation:0];//bullet
	
	[_phaseManager setDataPacket:0 ofPlayer:1 position:playerLocation orientation:0];//tank
	[_phaseManager setDataPacket:1 ofPlayer:1 position:playerLocation orientation:M_PI];//bullet
	
	packetData *d = &[_phaseManager getTankInfo:0];///////WARNING HERE//////////

here is the getTankinfo function
- ( packetData )getTankInfo:( int )tankNumber
{
	return tankInfo[tankNumber];
}

that packet is going to be sent over bluetooth on the iphone's...so i cant have it talking about temporary variables and losing data on me. If it wont, anyone know how to get rid of the error? cheers

Share this post


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

  • Advertisement