Mail Archives: djgpp/1998/03/05/05:46:09
What's the declaration for myship and data in the expression?
image = (BITMAP*)data[myship].dat;
Please respond to dyoon AT home DOT com
To: djgpp AT delorie DOT com
cc: (bcc: Iliyan Jeliazkov/WWIS/UK/Unisys)
Subject: constructors + djgpp/allegro
Ok, I had a pretty strange thing happen in my program the other day.
I changed the way I constructed an object and this caused my program
to just hang. Here are the two ways I constructed them...
//method one
//first i define some stuff up here...and then....
class myship
{
int x, y;
BITMAP* image;
myship(int newX, int newY)
{
x = newX;
y = newY;
image = (BITMAP*)data[myship].dat;
}
}
//method two
class myship
{
int x, y;
BITMAP* image;
myship(int newX, int newY) :
x( newX ), y( newY ), image( (BITMAP*)data[myship].dat )
{ }
}
//////////////////////
Now the ONLY change in my source code that I make are these two
constructors. When I use method one, everything works fine, when
I use method 2, the program hangs, it seems to crash actually.
Does anyone know why this is? It might help to know that the
graphics functions I am using are rotate_sprite() and blit().
Any help would be really appreciated.
Daniel Yoon
- Raw text -