Been having a memory problem/leak with my mud for sometime now, and I think
I tracked it down, or am atlease closer. It's affecting my strikes pointer
to end up being 0x20, I looked over all of it's code and it should be
working fine, plus I've had it do it to people who don't use strikes. So I
belive it's the pointer above the strikes, I'm pretty possitive it is cause
to test it I put a void *junkpointer inbetween the strikes and the pointer
above it and the problem stoped. My problem is I think with the dots, we do
the dots much like an affect:

 dot.ch = ch;
 dot.duration = ((level/2)+1); //seconds
 dot.damage = (level/5);
 dot.dam_type =  DAM_NEGATIVE;
 dot.interval = 3;
 dot.sn = sn;
 dot.life_drain = FALSE;
 dot_to_char( victim, &dot ); // Hope I got everything...

Now where I think is the problem is in the dot_to_char:

void dot_to_char( CHAR_DATA *ch, DOT_DATA *dot )
{
 DOT_DATA *new_dot;

 if ( dot->duration == 0 )
 {
  bug( "dot_to_char: Zero duration DOT.", 0 );
  return;
 }

 for (new_dot = ch->DOTs; new_dot != NULL; new_dot = new_dot->next)
 {
  if (new_dot->sn == dot->sn)
  {
   new_dot->damage = UMAX(new_dot->damage, dot->damage);
   new_dot += dot->duration;
   return;
  }
 }

 new_dot = new_dot_data();
 *new_dot = *dot;

 new_dot->ileft = new_dot->interval;

 new_dot->next = ch->DOTs;
 ch->DOTs = new_dot;
 return;
}

Ok my question is here, see that *new_dot = *dot. Will that copy the dot.ch
if dot.ch was a pointer to the ch who cast the dot? Or could that be causing
me heart ache? Heres a little more code for you so you can see how it all is
working, if you see anything I missed please let me know. Thanks a head of
time.

DOT_DATA *new_dot_data()
{
 static DOT_DATA dot_zero;
 DOT_DATA *dot;

 if ( !dot_free )
  dot = (DOT_DATA *) alloc_mem( sizeof( DOT_DATA ) );
 else
 {
  dot = dot_free;
  dot_free = dot_free->next;
 }
 *dot = dot_zero;

 return dot;
}

Sarix
Realms of the Forgotten
http://www.rotf.net port 500 or http://www.rotf.net:5001/


Reply via email to