delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/25/20:25:36

Message-ID: <36D576A9.7FA01817@xyz.net>
From: =?iso-8859-1?Q?Bj=F8rn?= Hansen <viking AT xyz DOT net>
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: mouse problem
Lines: 42
NNTP-Posting-Host: 207.14.89.134
X-Trace: news6.ispnews.com 919991691 207.14.89.134 (Thu, 25 Feb 1999 20:14:51 EDT)
NNTP-Posting-Date: Thu, 25 Feb 1999 20:14:51 EDT
Date: Thu, 25 Feb 1999 16:13:30 +0000
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm writing a game and I have a function that looks like this:

---------------------------------------------------------------------------------------

int *get_orders(void)
{
 int *neworders,
     x=mouse_x,
     y=mouse_y;

 if (mouse_b & 1)     //left button used to select
     {
     neworders[0]=x;
     neworders[1]=y;
     neworders[2]=SELECT;
     }
 else if (mouse_b & 2)  //right button used to move/attack
     {
     neworders[0]=mouse_x;
     neworders[1]=mouse_y;
     neworders[2]=MOVE;
     }
 else
     return NULL;
 return neworders;
}
---------------------------------------------------------------------------------------

now everything works well as long as I don't click the mouse.  If I do
the program crashes(SIGSEV type error).  If I comment out the
    neworders[0]=x;
    neworders[1]=y;
part it doesn't crash my program so I would assume that means it has
something to do with assigning the mouse_x and mouse_y values to
neworders(I'm not sure I did this right either though).  RHIDE tells me
there is a call frame traceback error in a nother function(when I use
the "run" option in rhide) and call allegro's scroll_screen function.
does anyone have any ideas on what I am doing wrong?  And what other
info do you need to know to figgure it out?

Bjørn

- Raw text -


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