delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/05/05:46:09

From: "Iliyan Jeliazkov" <iliyanjeliazkov AT unn DOT unisys DOT com>
To: dyoon AT home DOT com
cc: djgpp AT delorie DOT com
Message-ID: <002565BE.003B1EC3.00@BBFIRST.BB.UNISYS.COM>
Date: Thu, 5 Mar 1998 10:47:48 +0000
Subject: Re: constructors + djgpp/allegro
Mime-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019