Difference for server/player.c from version 1.147 to 1.148


version 1.147 version 1.148
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_player_c =   * static char *rcsid_player_c =
  *   "$Id: player.c,v 1.147 2004/02/29 02:46:28 temitchell Exp $";   *   "$Id: player.c,v 1.148 2004/03/24 08:15:17 mwedel Exp $";
  */   */
   
 /*  /*
Line 1006
 
Line 1006
   
 void flee_player(object *op) {  void flee_player(object *op) {
   int dir,diff;    int dir,diff;
       rv_vector rv;
   
   if(op->stats.hp < 0) {    if(op->stats.hp < 0) {
     LOG(llevDebug, "Fleeing player is dead.\n");      LOG(llevDebug, "Fleeing player is dead.\n");
     CLEAR_FLAG(op, FLAG_SCARED);      CLEAR_FLAG(op, FLAG_SCARED);
     return;      return;
   }    }
   
   if(op->enemy==NULL) {    if(op->enemy==NULL) {
     LOG(llevDebug,"Fleeing player had no enemy.\n");      LOG(llevDebug,"Fleeing player had no enemy.\n");
     CLEAR_FLAG(op, FLAG_SCARED);      CLEAR_FLAG(op, FLAG_SCARED);
Line 1021
 
Line 1024
     CLEAR_FLAG(op, FLAG_SCARED);      CLEAR_FLAG(op, FLAG_SCARED);
     return;      return;
   }    }
   dir=absdir(4+find_dir_2(op->x-op->enemy->x,op->y-op->enemy->y));      get_rangevector(op, op->enemy, &rv, 0);
   
       dir=absdir(4+rv.direction);
   for(diff=0;diff<3;diff++) {    for(diff=0;diff<3;diff++) {
     int m=1-(RANDOM()&2);      int m=1-(RANDOM()&2);
     if(move_ob(op,absdir(dir+diff*m),op)||      if(move_ob(op,absdir(dir+diff*m),op)||
Line 2017
 
Line 2022
  return 0;   return 0;
   
     /* Sanity check: make sure dir is valid */      /* Sanity check: make sure dir is valid */
     if ( ( dir < 0 ) || ( dir >= 9 ) )      if ( ( dir < 0 ) || ( dir >= 9 ) ) {
         {  
         LOG( llevError, "move_player: invalid direction %d\n", dir);          LOG( llevError, "move_player: invalid direction %d\n", dir);
         return 0;          return 0;
         }          }
Line 2080
 
Line 2084
  }   }
     }      }
   
       if (QUERY_FLAG(op, FLAG_SCARED)) {
    flee_player(op);
    /* If player is still scared, that is his action for this tick */
    if (QUERY_FLAG(op, FLAG_SCARED)) {
        op->speed_left--;
        return 0;
    }
       }
   
     /* I've been seeing crashes where the golem has been destroyed, but      /* I've been seeing crashes where the golem has been destroyed, but
      * the player object still points to the defunct golem.  The code that       * the player object still points to the defunct golem.  The code that
      * destroys the golem looks correct, and it doesn't always happen, so       * destroys the golem looks correct, and it doesn't always happen, so


Legend:
line(s) removed in v.1.147 
line(s) changed
 line(s) added in v.1.148

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