PennMUSH Community

Changeset 1209

Show
Ignore:
Timestamp:
01/26/08 08:02:34 (10 months ago)
Author:
shawnw
Message:

Bug fixes for queue pids

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/devel/src/cque.c

    r1208 r1209  
    302302  tmp->left = 0; 
    303303  tmp->cause = cause; 
     304  tmp->flags = 0; 
    304305  for (a = 0; a < 10; a++) 
    305306    if (!global_eval_context.wnxt[a]) 
     
    420421  tmp->semattr = NULL; 
    421422  tmp->next = NULL; 
     423  tmp->flags = 0; 
    422424  for (a = 0; a < 10; a++) { 
    423425    if (!global_eval_context.wnxt[a]) 
     
    10171019  /* Now adjust it in the wait queue. Not a clever approach, but I 
    10181020     wrote it at 3 am and clever was not an option. */ 
     1021  found = false; 
    10191022  for (tmp = qwait, last = NULL; tmp; last = tmp, tmp = tmp->next) { 
    10201023    if (tmp == q) { 
     
    10231026      else 
    10241027    qwait = qwait->next; 
    1025  
    1026       break; 
    1027     } 
    1028   } 
    1029   found = false; 
    1030   for (tmp = qwait, last = NULL; tmp; last = tmp, tmp = tmp->next) { 
    1031     if (tmp->left > q->left) { 
    1032       if (last) { 
    1033     last->next = q; 
    1034     q->next = tmp; 
    1035       } else { 
    1036     q->next = qwait; 
    1037     qwait = q; 
    1038       } 
    10391028      found = true; 
    10401029      break; 
    10411030    } 
    10421031  } 
    1043   if (!found) { 
    1044     if (last)  
    1045       last->next = q; 
    1046     else 
    1047       qwait = q; 
    1048     q->next = NULL; 
     1032  if (found) { 
     1033    found = false; 
     1034    for (tmp = qwait, last = NULL; tmp; last = tmp, tmp = tmp->next) { 
     1035      if (tmp->left > q->left) { 
     1036        if (last) { 
     1037          last->next = q; 
     1038          q->next = tmp; 
     1039        } else { 
     1040          q->next = qwait; 
     1041          qwait = q; 
     1042        } 
     1043        found = true; 
     1044        break; 
     1045      } 
     1046    } 
     1047    if (!found) { 
     1048      if (last)  
     1049        last->next = q; 
     1050      else 
     1051        qwait = q; 
     1052      q->next = NULL; 
     1053    } 
    10491054  } 
    10501055 
     
    10591064  for (tmp = q_ptr; tmp; tmp = tmp->next) { 
    10601065    (*tot)++; 
    1061     if (tmp->flags & QUEUE_HALTED) 
    1062       continue
    1063     if (!GoodObject(tmp->player)) 
     1066    if (tmp->flags & QUEUE_HALTED)  
     1067      (*del)++
     1068    else if (!GoodObject(tmp->player)) 
    10641069      (*del)++; 
    10651070    else if (q_all || (Owner(tmp->player) == victim)) { 
     
    11611166    notify_format(player, 
    11621167                  T 
    1163                   ("Totals: Player...%d/%d[%ddel]  Object...%d/%d[%ddel]  Wait...%d/%d  Semaphore...%d/%d"), 
    1164                   pq, tpq, dpq, oq, toq, doq, wq, twq, sq, tsq); 
     1168                  ("Totals: Player...%d/%d[%ddel]  Object...%d/%d[%ddel]  Wait...%d/%d[%ddel]  Semaphore...%d/%d"), 
     1169                  pq, tpq, dpq, oq, toq, doq, wq, twq, dwq, sq, tsq); 
    11651170  } 
    11661171}