Player is defined as:
Object *Player ;
Player = new(Object) ;
delete Player;
Which means it is a pointer to start with so:
Deus->Create_Object ( Player, 1000, 600 ) ;
Deus->Set_Collision_Data ( Player ) ;
Deus->Set_Object_Stats ( Player ) ;
Sends the addy of Player into the Deus functions which is why:
dbText ( 140, 25 , Player->ImageName1 ) ;
dbText ( 140, 50 , dbStr ( Player->SpriteNumber ) ) ;
dbText ( 140, 75 , dbStr ( Player->RenderOrder ) ) ;
dbText ( 140, 100, dbStr ( Player->XPos ) ) ;
dbText ( 140, 125, dbStr ( Player->YPos ) ) ;
dbText ( 140, 150, dbStr ( Player->QuadNum ) ) ;
dbText ( 140, 175, dbStr ( Player->H1Top ) ) ;
dbText ( 140, 200, dbStr ( Player->H1Bottom ) ) ;
dbText ( 140, 225, dbStr ( Player->H1Left ) ) ;
dbText ( 140, 250, dbStr ( Player->H1Right ) ) ;
dbText ( 140, 275, dbStr ( Player->PHY ) ) ;
dbText ( 140, 300, dbStr ( Player->MEN ) ) ;
dbText ( 140, 325, dbStr ( Player->DEX ) ) ;
Shows me the updated contents of Player post Deus function calls within the following IF statements:
if ( dbControlKey () && Display == 0 )
{
Deus->Create_Object ( Player, 1000, 600 ) ;
Deus->Set_Collision_Data ( Player ) ;
Deus->Set_Object_Stats ( Player ) ;
Display = 1 ;
}
if ( Display == 1 )
{
dbText ( 140, 25 , Player->ImageName1 ) ;
dbText ( 140, 50 , dbStr ( Player->SpriteNumber ) ) ;
dbText ( 140, 75 , dbStr ( Player->RenderOrder ) ) ;
dbText ( 140, 100, dbStr ( Player->XPos ) ) ;
dbText ( 140, 125, dbStr ( Player->YPos ) ) ;
dbText ( 140, 150, dbStr ( Player->QuadNum ) ) ;
dbText ( 140, 175, dbStr ( Player->H1Top ) ) ;
dbText ( 140, 200, dbStr ( Player->H1Bottom ) ) ;
dbText ( 140, 225, dbStr ( Player->H1Left ) ) ;
dbText ( 140, 250, dbStr ( Player->H1Right ) ) ;
dbText ( 140, 275, dbStr ( Player->PHY ) ) ;
dbText ( 140, 300, dbStr ( Player->MEN ) ) ;
dbText ( 140, 325, dbStr ( Player->DEX ) ) ;
}
Which runs the setting code only once.
As far as I can tell this can't be sending a copy because the object is permanently updated. Can't be sure if I'm sending the object itself or not but as Player is created as a pointer and received as an Addy reference by Deus I don't see how it can be. Additionally the Deus functions are Voids so they don't return anything so if I was sending the object it would not be updated as the object is not returned from Deus. It's address is sent, the object is modded (not returned) and then after the Deus functions have been called, the main accesses the object again and has clearly been updated. If it hadn't been the program would have either shown rubbish or crashed as the variables of the class have not been updated since creation.
It's working fine now anyway since I changed:
void Create_Object ( Object *Obj, int PosX, int PosY )
Within Deus (the Maestro class) to:
void Maestro::Create_Object ( Object *Obj, int PosX, int PosY )
We are here and it is now.