Difference for server/pets.c from version 1.5 to 1.6


version 1.5 version 1.6
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_pets_c =   * static char *rcsid_pets_c =
  *    "$Id: pets.c,v 1.5 2001/01/31 07:54:52 cvs Exp $";   *    "$Id: pets.c,v 1.6 2001/02/23 06:06:35 mwedel Exp $";
  */   */
   
 /*  /*
Line 31
 
Line 31
 #include <sproto.h>  #include <sproto.h>
 #endif  #endif
   
 void add_pending_object(object *ob, mapstruct *map) {  
   objectlink *obl;  
   
   if(ob->arch == NULL) {  
     LOG(llevError,"Can't add pending object without arch: %s\n",ob->name);  
     return;  
   }  
   LOG(llevDebug,"Adding pending object %s to %s\n",ob->name,map->path);  
   obl = (objectlink *) malloc(sizeof(objectlink));  
   ob->speed = 0;  
   update_ob_speed(ob);  
   
   obl->ob = ob;  
   obl->next = map->pending;  
   map->pending=obl;  
 }  
   
 void enter_pending_objects(mapstruct *map) {  
   objectlink *obl, *next;  
   object *owner;  
   
   if(map->in_memory != MAP_IN_MEMORY) {  
     LOG(llevError,"Can't enter pending objects: map not in memory.\n");  
     return;  
   }  
   for(obl = map->pending; obl!= NULL; obl = next) {  
     next = obl->next;  
     LOG(llevDebug,"Entering pending %s in %s\n",obl->ob->name,map->path);  
     if(obl->ob->type == PLAYER) {  
       fix_player(obl->ob);  
       insert_ob_in_map(obl->ob,map,NULL);  
     }  
     if (obl->ob->arch != NULL && obl->ob->type != PLAYER) {  
  obl->ob->speed = obl->ob->arch->clone.speed;  
  update_ob_speed(obl->ob);  
     }  
     if((owner = get_owner(obl->ob)) != NULL)  
       follow_owner(obl->ob,owner);  
     if(QUERY_FLAG(obl->ob, FLAG_REMOVED)) {  
       LOG(llevDebug,"follow_owner didn't help.\n");  
       insert_ob_in_map(obl->ob,map,NULL);  
     }  
     free(obl);  
   }  
   map->pending = NULL;  
 }  
   
 object *get_pet_enemy(object * pet){  object *get_pet_enemy(object * pet){
   object         *owner, *tmp;    object         *owner, *tmp;
   int             i;    int             i;
Line 147
 
Line 100
     if(obl->ob->type != PLAYER && QUERY_FLAG(obl->ob,FLAG_FRIENDLY) &&      if(obl->ob->type != PLAYER && QUERY_FLAG(obl->ob,FLAG_FRIENDLY) &&
        (owner = get_owner(obl->ob)) != NULL && owner->map != obl->ob->map)         (owner = get_owner(obl->ob)) != NULL && owner->map != obl->ob->map)
     {      {
       if(owner->map == NULL || owner->map->in_memory != MAP_IN_MEMORY) {   /* follow owner checks map status for us */
         object *ob = obl->ob;  
  /* a bit of a hack, but necessary.  IF a player is cycling through many  
  * maps very quickly, it is possible that a monster can be caught in  
  * limbo (being transferred to some other map.)  This should fix  
  * that problem.  
  */  
  if (!QUERY_FLAG(ob, FLAG_REMOVED)) {  
           remove_ob(ob);  
  }  
         if(owner->map != NULL) {  
           add_pending_object(ob, owner->map);  
           continue;  
         }  
         LOG(llevMonster,"(pet no map)..");  
         remove_friendly_object(ob);  
         free_object(ob);  
         continue;  
       }  
       follow_owner(obl->ob,owner);        follow_owner(obl->ob,owner);
       if(QUERY_FLAG(obl->ob, FLAG_REMOVED) && FABS(obl->ob->speed) > MIN_ACTIVE_SPEED) {        if(QUERY_FLAG(obl->ob, FLAG_REMOVED) && FABS(obl->ob->speed) > MIN_ACTIVE_SPEED) {
         object *ob = obl->ob;          object *ob = obl->ob;
Line 188
 
Line 123
     return;      return;
   }    }
   if(owner->map->in_memory != MAP_IN_MEMORY) {    if(owner->map->in_memory != MAP_IN_MEMORY) {
     LOG(llevMonster,"Map loading, adding pending object (%s).\n",ob->name);      LOG(llevError,"Owner of the pet not on a map in memory!?\n");
     add_pending_object(ob,owner->map);  
     return;      return;
   }    }
   dir = find_free_spot(ob->arch, owner->map,    dir = find_free_spot(ob->arch, owner->map,


Legend:
line(s) removed in v.1.5 
line(s) changed
 line(s) added in v.1.6

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