Mailing List
Home
Forum Home
Mac Game - Mac game development
Rivers of MUD - a Diku and Merc based multiuser dungeon
SMAUG
Subjects
Getting UDP through NAT/firewalls/whatever for a game
Getting UDP through NAT/firewalls/whatever for a game
QuickTime errors
Python script as stand alone MUD server
Various sound problems
Fragment Shaders & GL TEXTURE RECTANGLE EXT
Timers and global variables
Re: Language and platform for Text MUD server
Apparent acquisition of Yantis (mysupersales) by IDE
HID keyboard
Getting UDP through NAT/firewalls/whatever for a game
Microsoft Sparkle
Director MX
Congratulations Horizons
Yet more problems fullscreen mode
Apple Dev Kitchen Them 's tasty vittles, Maw!
NSOpenGLContext, Pbuffers, and drawables
More DCR "theft " naughtiness
dynamic sprite creation and imaging lingo
Re: Find stuff in Flash array?
Effects of skill imbalances?
QuickTime errors
Rom 2 4/Quickmud Enhancement/Bug fix
Working with XML files/CFURL
smooth scrolling/subpixel tweening
RE: (Ron help me?) Flash text
Flash Racing
MudDev FAQ 2
Browser based games
Installing GLUT
Special character in Flash XML
 
Original code snag

Original code snag

2004-09-17       - By Olcerin Aristiis

 Back
Reply:     1     2     3     4  

If someone has a moment to glance at this I'd
appreciate it. I created some code to add "limit
timers" to spell_smaug fields so that we could place a
timer on ch upon successful use of skill/spell and the
code won't allow them to use it again until the timer
has run down. It assigns timer type by using sn +
10000 and saves to prevent user logging out to thwart
wait time. Anyways...the problem. The code for the
actual mechanics of it all went off well, but now I've
created a do_function that should remove all the
"limit timers" and it's causing seg fault error crash.
I realize that it's probably occurring because a
pointer is being accessed that doesn't exist, but I
can't figure out why. Here is the portion of the code
that is supposed to do the deed, hopefully it's
something easily spottable I'm overlooking since I've
been at this a full day and that is completely
possible now. What's baffling me, is I used the exact
same 'for' procedure in act_wiz.c, do_mstat to display
the flags, and in save.c, save_char_obj to save the
flags, not to mention it just mirrors what is used to
find timers in get_timerptr. It only crashes here. As
I said it's probably something totally lame that I'm
overlooking, but after 14 hours sitting here I'm ready
to bear my soul to the world :P

-Hopefully Yahoo won't screw my formatting too bad to
read here :/ There are several seemingly not needed
ifchecks here, but it's all result of trying to get
the durn thing to stop kerplunking. I've put this same
function on www.bladeoftheancients.com/duh.txt if this
is unreadable. THANKS!
//code follows

/* Simple function for affect removal on command - Olc
*/
void do_unaff ( CHAR_DATA *ch, char *argument )
{
  char arg [MAX_INPUT_LENGTH];
  AFFECT_DATA *paf;
  CHAR_DATA *victim = NULL;
  TIMER *timer = NULL;

  argument = one_argument( argument, arg );

   if( ch->level < LEVEL_IMPLEMENTOR || IS_NPC(ch) )
/* change to whatever... */
    return;
  if( arg[0] == '\0' )
  {
    send_to_char( "Syntax: unaff <target>\n\r", ch );
    return;
  }
   if( (victim = get_char_room(ch, arg)) == NULL )
   {
       send_to_char( "They're not here.\n\r", ch );
       return;
   }
  /* This is crashing at the first reference to timer
within the for statement */
//   if( !str_cmp(argument, "timer") )
//   {
//     if( !ch || !victim )
//     {
//       bug("do_unaff(timer): bad ch and/or victim!");
//       return;
//     }
//     bool fnd = FALSE;
//     for( timer = victim->first_timer; timer; timer =
timer->next )
//     {
//       if( !timer || !timer->type ) // <-- ----CRASH :(
//         continue;
//       if( timer->type > 10000 ) //<-- ---- ---If above
2 lines not there, CRASH here.
//       {
//         fnd = TRUE;
//         int type = timer->type;
//         remove_timer(victim, type);
//       }
//     }
//     if(fnd)
//     {
//       send_to_char("You feel the powers of divine
intervention affecting you!\n\r", victim);
//       send_to_char("Ok.\n\r", ch);
//       return;
//     }
//   }
  while( (paf = victim->last_affect) != NULL )
     affect_remove( victim, paf );
  update_aris(victim);
/* Removed by Olc */
/*   argument = one_argument( argument, arg2 );
  if( !str_cmp(arg2, "all") )
  {
    int x;
    for(x = 0; x < MAX_AFFECTED_BY; x++)
       if( xIS_SET(victim->affected_by, x) )
        xREMOVE_BIT(ch->affected_by, x);
  } */
  send_to_char( "Done.\n\r", ch );
  return;
}
// end code



=====
"All paid jobs absorb and degrade the mind."
Aristotle


   
__ ____ ____ ____ ____ ____ ___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com