Difference for server/apply.c from version 1.136 to 1.137


version 1.136 version 1.137
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_apply_c =   * static char *rcsid_apply_c =
  *   "$Id: apply.c,v 1.136 2005/09/13 19:41:09 akirschbaum Exp $";   *   "$Id: apply.c,v 1.137 2005/09/16 01:02:06 qal21 Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 42
 
Line 42
 #include <math.h>  #include <math.h>
   
 /**  /**
    * Check if op should abort moving victim because of it's race or slaying.
    */
   int should_director_abort(object *op, object *victim)
   {
      int arch_flag, name_flag, race_flag;
      /* Get flags to determine what of arch, name, and race should be checked.
       * This is stored in subtype, and is a bitmask, the LSB is the arch flag,
       * the next is the name flag, and the last is the race flag. Also note,
       * if subtype is set to zero, that also goes to defaults of all affecting
       * it. Examples:
       * subtype 1: only arch
       * subtype 3: arch or name
       * subtype 5: arch or race
       * subtype 7: all three
       */
      if (op->subtype)
      {
        arch_flag = (op->subtype & 1);
        name_flag = (op->subtype & 2);
        race_flag = (op->subtype & 4);
      } else {
        arch_flag = 1;
        name_flag = 1;
        race_flag = 1;
      }
      /* If the director has race set, only affect objects with a arch,
       * name or race that matches.
       */
      if ( (op->race) &&
        ((!(victim->arch && arch_flag && victim->arch->name) || strcmp(op->race, victim->arch->name))) &&
        ((!(victim->name && name_flag) || strcmp(op->race, victim->name))) &&
        ((!(victim->race && race_flag) || strcmp(op->race, victim->race))) ) {
        return 1;
      }
       /* If the director has slaying set, only affect objects where none
        * of arch, name, or race match.
        */
      if ( (op->slaying) && (
        ((victim->arch && arch_flag && victim->arch->name && !strcmp(op->slaying, victim->arch->name))) ||
        ((victim->name && name_flag && !strcmp(op->slaying, victim->name))) ||
        ((victim->race && race_flag && !strcmp(op->slaying, victim->race)))) ) {
        return 1;
      }
      return 0;
   }
   
   /**
  * This handles a player dropping money on an altar to identify stuff.   * This handles a player dropping money on an altar to identify stuff.
  * It'll identify marked item, if none all items up to dropped money.   * It'll identify marked item, if none all items up to dropped money.
  * Return value: 1 if money was destroyed, 0 if not.   * Return value: 1 if money was destroyed, 0 if not.
Line 1328
 
Line 1375
   switch (trap->type)    switch (trap->type)
   {    {
   case PLAYERMOVER:    case PLAYERMOVER:
     if (trap->attacktype && (trap->level || victim->type!=PLAYER)) {      if (trap->attacktype && (trap->level || victim->type!=PLAYER) && !should_director_abort(trap, victim)) {
  if (!trap->stats.maxsp) trap->stats.maxsp=2.0;   if (!trap->stats.maxsp) trap->stats.maxsp=2.0;
  /* Is this correct?  From the docs, it doesn't look like it   /* Is this correct?  From the docs, it doesn't look like it
  * should be divided by trap->speed   * should be divided by trap->speed
Line 1351
 
Line 1398
     goto leave;      goto leave;
   
   case DIRECTOR:    case DIRECTOR:
     if(victim->direction) {      if(victim->direction && !should_director_abort(trap, victim)) {
       victim->direction=trap->stats.sp;        victim->direction=trap->stats.sp;
       update_turn_face(victim);        update_turn_face(victim);
     }      }


Legend:
line(s) removed in v.1.136 
line(s) changed
 line(s) added in v.1.137

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