Code: Select all
bullets[i] = bullets[count]; //bullets[i] remains unchanged
Code: Select all
Bullet& Bullet::operator=( const Bullet& p_bullet )
{
if( this != &p_bullet )
{
// this ALSO REMAINS UNCHANGED AFTER THIS CALL TO =
(Object)*this = (Object)p_bullet;
double tempDir = ( p_bullet.getDirection() );
SDL_Rect tempRect;
tempRect.x = this->getLoc()->x;
tempRect.y = this->getLoc()->y;
this->define( p_bullet.ownedBy , tempRect , tempDir , p_bullet.m_type );
}
return *this;
}
Code: Select all
Object& Object::operator=( const Object& p_newObject )
{
if( this != &p_newObject )
{
size = p_newObject.size;
collisionRect = p_newObject.collisionRect;
midpoint.x = p_newObject.midpoint.x;
midpoint.y = p_newObject.midpoint.y;
// AT THIS POINT THE VALUES ARE SUCCESSFULLY CHANGED, BUT THIS DOES NOT CARRY THROUGH AFTER THE RETURN
clip.x = p_newObject.clip.x;
clip.y = p_newObject.clip.y;
clip.w = p_newObject.clip.w;
clip.h = p_newObject.clip.h;
imageName = p_newObject.imageName;
usingClip = p_newObject.usingClip;
active = p_newObject.active;
sizeCoefficient = p_newObject.sizeCoefficient;
}
return *this;
}
Code: Select all
Bullet 0 out of bounds at 1335 , 619. Replacing with Bullet 4 at 711 , 619
Old Object: 711 , 619
New Object: 711 , 619
New Bullet: 1335 , 619
After = Call: 1335 , 619
So I know that my Object::operator=() function is broken, and it's unclear from the data I have whether my Bullet::operator=() works. Any help?