Difference for server/main.c from version 1.7 to 1.8


version 1.7 version 1.8
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_main_c =   * static char *rcsid_main_c =
  *    "$Id: main.c,v 1.7 2000/04/07 03:26:25 cvs Exp $";   *    "$Id: main.c,v 1.8 2000/05/21 21:41:45 jec Exp $";
  */   */
   
 /*  /*
Line 543
 
Line 543
       }        }
 }  }
   
 #if 0  
 /* process_events has been extended to take a map arguement, and  
  * if that is non null, only process objects on that map.  As such,  
  * process_map is no longer needed.  
  */  
 /*  
  * process_map(map): works like process_events(), but it only processes  
  * objects within the map 'map'.  
  */  
   
 void process_map(mapstruct *map) {  
   int flag;  
   object *op, *next;  
   
   process_players1(map);  
   
   for(op=objects;op!=NULL;op=next) {  
     if(QUERY_FLAG(op, FLAG_FREED)) { /* Was this object somehow freed as a result of */  
                        /* the actions of the previous object? */   
       flag=0;  
       break;  
     }  
     next=op->next;  
   
     if(op->map!=map || op->type == PLAYER)  
       continue;  
   
     if (op->last_anim>=op->anim_speed && op->anim_speed != 0) {  
       animate_object(op);  
       op->last_anim=1;  
     } else op->last_anim++;   
 #ifdef CASTING_TIME  
     if (op->casting > 0){  
       op->casting--;  
     }  
 #endif  
     if(op->speed_left>0) {  
       --op->speed_left;  
       if(process_object(op))  
         continue;  
     }  
   }  
 /* Now go through all objects and give them new speed */  
   for(op=objects;op!=NULL;op=op->next)  
     if(op->map==map&&op->speed&&op->speed_left<=0)  
       op->speed_left+=op->speed>0?op->speed:-op->speed;  
   
   process_players2(map);  
 }  
 #endif  
   
 /* process_players1 and process_players2 do all the player related stuff.  /* process_players1 and process_players2 do all the player related stuff.
  * I moved it out of process events and process_map.  This was to some   * I moved it out of process events and process_map.  This was to some
  * extent for debugging as well as to get a better idea of the time used   * extent for debugging as well as to get a better idea of the time used
Line 688
 
Line 637
 #define SPEED_DEBUG  #define SPEED_DEBUG
   
   
 void process_events(mapstruct *map) {  void process_events (mapstruct *map)
   {
   object *op, *next;    object *op, *next;
     object marker;
   
  process_players1(map);   process_players1(map);
   
  for (op=active_objects; op!=NULL; op=next) {    /* Put marker object at beginning of active list */
     if(QUERY_FLAG(op, FLAG_FREED)) { /* Was this object somehow freed as a result of */    marker.active_next = active_objects;
                        /* the actions of the previous object? */     if (marker.active_next)
       LOG(llevDebug,"Free object on list, process_events\n");      marker.active_next->active_prev = &marker;
       next=op->active_next;    marker.active_prev = NULL;
  continue; /* If we have a free object, any values it might    active_objects = &marker;
     * have are likely garbage.  breaking is probabyl  
     * best, but let as at least continue and hope    while (marker.active_next)
     * for the best    {
     */      op = marker.active_next;
 /*      break;*/  
       /* Move marker forward - swap op and marker */
       op->active_prev = marker.active_prev;
       if (op->active_prev)
         op->active_prev->active_next = op;
       else
         active_objects = op;
       marker.active_next = op->active_next;
       if (marker.active_next)
         marker.active_next->active_prev = &marker;
       marker.active_prev = op;
       op->active_next = &marker;
   
       /* Now process op */
       if (QUERY_FLAG (op, FLAG_FREED)) {
         LOG (llevError, "BUG: process_events(): Free object on list\n");
         op->speed = 0;
         update_ob_speed (op);
         continue;
     }      }
   
     next=op->active_next;      if ( ! op->speed) {
         LOG (llevError, "BUG: process_events(): Object %s has no speed, "
              "but is on active list\n", op->arch->name);
         update_ob_speed (op);
         continue;
       }
   
     if (op->map == NULL && op->env == NULL && op->name &&      if (op->map == NULL && op->env == NULL && op->name &&
         op->type!=MAP && map==NULL)          op->type!=MAP && map==NULL)
     {      {
       LOG(llevError, "Object without map or inventory: %s (%d)\n",        LOG (llevError, "BUG: process_events(): Object without map or "
              "inventory is on active list: %s (%d)\n",
               op->name, op->count);                op->name, op->count);
         op->speed = 0;
         update_ob_speed (op);
       continue;        continue;
     }      }
   
     if (map!=NULL && op->map!=map)      if (map!=NULL && op->map!=map)
  continue;   continue;
   
     if(!op->speed) {  
       /* This is not a real problem, unless it repeats for the the same  
        * object.  IF it just gets printed once, it likely means that that  
        * object was killed/changed by the previous object  
        */  
       LOG(llevDebug, "Object %s has no speed, but is on active list\n",  
  op->arch->name);  
       continue;  
     }  
   
 /* Eneq(@csd.uu.se): Handle archetype-field anim_speed differently when  /* Eneq(@csd.uu.se): Handle archetype-field anim_speed differently when
    it comes to the animation. If we have a value on this we don't animate it     it comes to the animation. If we have a value on this we don't animate it
    at speed-events. */     at speed-events. */
Line 736
 
Line 703
     if (op->anim_speed && op->last_anim>=op->anim_speed) {      if (op->anim_speed && op->last_anim>=op->anim_speed) {
       animate_object(op);        animate_object(op);
       op->last_anim=1;        op->last_anim=1;
     } else op->last_anim++;       } else {
         op->last_anim++;
       }
   
     if(op->speed_left>0) {      if(op->speed_left>0) {
       --op->speed_left;        --op->speed_left;
       process_object(op);        process_object(op);
     }      }
   
 #ifdef CASTING_TIME  #ifdef CASTING_TIME
     if (op->casting > 0)      if (op->casting > 0)
       op->casting--;        op->casting--;
 #endif  #endif
     if (op->speed_left <= 0)      if (op->speed_left <= 0)
  op->speed_left+=(op->speed>0?op->speed:-op->speed);        op->speed_left += FABS (op->speed);
   }    }
   
     /* Remove marker object from active list */
     if (marker.active_prev != NULL)
       marker.active_prev->active_next = NULL;
     else
       active_objects = NULL;
   
   process_players2(map);    process_players2(map);
 }  }
   
 void clean_tmp_files() {  void clean_tmp_files() {
   mapstruct *m;    mapstruct *m;
   
   LOG(llevError,"Cleaning up...\n");    LOG(llevInfo,"Cleaning up...\n");
   
   /* We save the maps - it may not be intuitive why, but if there are unique    /* We save the maps - it may not be intuitive why, but if there are unique
    * items, we need to save the map so they get saved off.  Perhaps we should     * items, we need to save the map so they get saved off.  Perhaps we should


Legend:
line(s) removed in v.1.7 
line(s) changed
 line(s) added in v.1.8

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:36