Difference for common/loader.l from version 1.69 to 1.70


version 1.69 version 1.70
Line 1
 
Line 1
 %{  %{
 /*  /*
  * static char *rcsid_object_c =   * static char *rcsid_object_c =
  *   "$Id: loader.l,v 1.69 2005/10/03 03:29:41 cavesomething Exp $";   *   "$Id: loader.l,v 1.70 2005/11/16 08:16:00 mwedel Exp $";
  */   */
   
 /*  /*
Line 438
 
Line 438
      LOG(llevDebug,"Monster %s has hp set higher than maxhp (%d>%d)\n",       LOG(llevDebug,"Monster %s has hp set higher than maxhp (%d>%d)\n",
  op->name,   op->name,
  op->stats.hp, op->stats.maxhp);   op->stats.hp, op->stats.maxhp);
   
    /* The archs just need to be updated for this */
    if (op->move_type ==0) op->move_type = MOVE_WALK;
     }      }
     if ((QUERY_FLAG(op,FLAG_GENERATOR)) && QUERY_FLAG(op,FLAG_CONTENT_ON_GEN)){      if ((QUERY_FLAG(op,FLAG_GENERATOR)) && QUERY_FLAG(op,FLAG_CONTENT_ON_GEN)){
         /* Generator will duplicate it's content as part of the          /* Generator will duplicate it's content as part of the
Line 448
 
Line 451
         flag_inv(op,FLAG_IS_A_TEMPLATE);          flag_inv(op,FLAG_IS_A_TEMPLATE);
     }      }
   
       /* Handle player movers.  We use move_type for player movers
        * because they operate on their own time (move_on
        * would potentially cause them to be triggered when someone steps
        * on them).  If move_type is set, presume person knows what they
        * are doing, otherwise, set move_type based on maxhp value.
        */
       if (op->type == PLAYERMOVER) {
    if (!op->move_type) {
        if (op->stats.maxhp) {
    op->move_type = MOVE_ALL;
    op->stats.maxhp=0;
        } else {
    op->move_type = MOVE_WALK;
        }
    }
       }
   
 }  }
   
 /* This extracts the key/value from the yytext field -  /* This extracts the key/value from the yytext field -
Line 677
 
Line 697
  }   }
      }       }
 ^speed_left{S}    op->speed_left = FVAL;  ^speed_left{S}    op->speed_left = FVAL;
 ^slow_move{S}     { SET_SLOW_PENALTY(op,FVAL);  ^slow_move{S}     { op->move_slow |= MOVE_WALK;
  SET_FLAG(op, FLAG_SLOW_MOVE);   op->move_slow_penalty = FVAL;
      }       }
 ^title{S}     { char *y=yval();  ^title{S}     { char *y=yval();
  if (*y=='\0') LOG(llevError,"Title without value.\n");   if (*y=='\0') LOG(llevError,"Title without value.\n");
Line 735
 
Line 755
 ^unpaid{S}     SET_OR_CLEAR_FLAG(op, FLAG_UNPAID, IVAL);  ^unpaid{S}     SET_OR_CLEAR_FLAG(op, FLAG_UNPAID, IVAL);
 ^need_an{S}     { /* not used - just ignore */ }  ^need_an{S}     { /* not used - just ignore */ }
 ^need_ie{S}     { /* not used - jsut ignore */ }  ^need_ie{S}     { /* not used - jsut ignore */ }
 ^no_pick{S}     SET_OR_CLEAR_FLAG(op, FLAG_NO_PICK, IVAL);  
 ^no_pass{S}     SET_OR_CLEAR_FLAG(op, FLAG_NO_PASS, IVAL);  
 ^is_animated{S}     SET_OR_CLEAR_FLAG(op, FLAG_ANIMATE, IVAL);  ^is_animated{S}     SET_OR_CLEAR_FLAG(op, FLAG_ANIMATE, IVAL);
 ^walk_on{S}     SET_OR_CLEAR_FLAG(op, FLAG_WALK_ON, IVAL);  ^no_pick{S}     SET_OR_CLEAR_FLAG(op, FLAG_NO_PICK, IVAL);
 ^walk_off{S}     SET_OR_CLEAR_FLAG(op, FLAG_WALK_OFF, IVAL);  
 ^fly_on{S}     SET_OR_CLEAR_FLAG(op, FLAG_FLY_ON, IVAL);  %{ /* These are all legacy - any new objects should use the move_ .. values */
 ^fly_off{S}     SET_OR_CLEAR_FLAG(op, FLAG_FLY_OFF, IVAL);  %}
 ^flying{S}     SET_OR_CLEAR_FLAG(op, FLAG_FLYING, IVAL);  ^no_pass{S}     { if (IVAL) op->move_block = MOVE_ALL; else op->move_block=0; }
   ^walk_on{S}     { if (IVAL) op->move_on |= MOVE_WALK; else op->move_on &= ~MOVE_WALK; }
   ^walk_off{S}     { if (IVAL) op->move_off |= MOVE_WALK; else op->move_off &= ~MOVE_WALK; }
   ^fly_on{S}     { if (IVAL) op->move_on |= MOVE_FLY_LOW; else op->move_on &= ~MOVE_FLY_LOW; }
   ^fly_off{S}     { if (IVAL) op->move_off |= MOVE_FLY_LOW; else op->move_off &= ~MOVE_FLY_LOW; }
   ^flying{S}     { if (IVAL) op->move_type |= MOVE_FLY_LOW; else op->move_type &= ~MOVE_FLY_LOW; }
   
   %{ /* These are the new values */
   %}
   ^move_block{S}     op->move_block = IVAL;
   ^move_type{S}     op->move_type = IVAL;
   ^move_on{S}     op->move_on = IVAL;
   ^move_off{S}     op->move_off = IVAL;
   ^move_slow{S}     op->move_slow = IVAL;
   ^move_slow_penalty{S}     op->move_slow_penalty = FVAL;
   
   
 ^monster{S}     SET_OR_CLEAR_FLAG(op, FLAG_MONSTER, IVAL);  ^monster{S}     SET_OR_CLEAR_FLAG(op, FLAG_MONSTER, IVAL);
 ^neutral{S}     SET_OR_CLEAR_FLAG(op, FLAG_NEUTRAL, IVAL);  ^neutral{S}     SET_OR_CLEAR_FLAG(op, FLAG_NEUTRAL, IVAL);
 ^no_attack{S}     SET_OR_CLEAR_FLAG(op, FLAG_NO_ATTACK, IVAL);  ^no_attack{S}     SET_OR_CLEAR_FLAG(op, FLAG_NO_ATTACK, IVAL);
Line 804
 
Line 838
 ^tear_down{S}     SET_OR_CLEAR_FLAG(op, FLAG_TEAR_DOWN, IVAL);  ^tear_down{S}     SET_OR_CLEAR_FLAG(op, FLAG_TEAR_DOWN, IVAL);
 ^luck{S}      op->stats.luck = IVAL;  ^luck{S}      op->stats.luck = IVAL;
 ^run_away{S}     op->run_away = IVAL;  ^run_away{S}     op->run_away = IVAL;
 ^pass_thru{S}     SET_OR_CLEAR_FLAG(op, FLAG_PASS_THRU, IVAL);  
 ^can_pass_thru{S}   SET_OR_CLEAR_FLAG(op, FLAG_CAN_PASS_THRU, IVAL);  
 ^pick_up{S}     op->pick_up = IVAL;  ^pick_up{S}     op->pick_up = IVAL;
 ^item_power{S}     op->item_power = IVAL;  ^item_power{S}     op->item_power = IVAL;
 ^gen_sp_armour{S}   op->gen_sp_armour = IVAL;  ^gen_sp_armour{S}   op->gen_sp_armour = IVAL;
Line 1356
 
Line 1388
  */   */
 static char *flag_names[NUM_FLAGS+1] = {  static char *flag_names[NUM_FLAGS+1] = {
 "alive", "wiz", NULL, NULL, "was_wiz", "applied", "unpaid",  "alive", "wiz", NULL, NULL, "was_wiz", "applied", "unpaid",
 "can_use_shield", "no_pick", "walk_on", "no_pass",              /* 10 */  "can_use_shield", "no_pick", NULL /* walk_on*/, NULL /* no_pass */, /* 10 */
 "is_animated", NULL, "flying", "monster", "friendly", "generator",  "is_animated", NULL /* slow_move */,
   NULL /* flying */, "monster", "friendly", "generator",
 "is_thrown", "auto_apply", "treasure", "player sold",   /* 20 */  "is_thrown", "auto_apply", "treasure", "player sold",   /* 20 */
 "see_invisible", "can_roll", "overlay_floor",  "see_invisible", "can_roll", "overlay_floor",
 "is_turnable", "walk_off", "fly_on",  "is_turnable", NULL /* walk_off */, NULL /* fly_on */,
 "fly_off", "is_used_up", "identified", "reflecting",            /* 30 */  NULL /*fly_off*/, "is_used_up", "identified", "reflecting", /* 30 */
 "changing", "splitting", "hitback", "startequip",  "changing", "splitting", "hitback", "startequip",
 "blocksview", "undead", "scared", "unaggressive",  "blocksview", "undead", "scared", "unaggressive",
 "reflect_missile", "reflect_spell",                             /* 40 */  "reflect_missile", "reflect_spell",                             /* 40 */
 "no_magic", "no_fix_player", "is_lightable", "tear_down", "run_away",  "no_magic", "no_fix_player", "is_lightable", "tear_down",
 "pass_thru", "can_pass_thru", "pick_up", "unique", "no_drop",   /* 50 */  "run_away", NULL /*pass_thru */, NULL /*can_pass_thru*/,
  NULL, "can_cast_spell", "can_use_scroll", "can_use_range",  "pick_up", "unique", "no_drop", /* 50 */
   NULL /* wizcast*/, "can_cast_spell", "can_use_scroll", "can_use_range",
 "can_use_bow",  "can_use_armour", "can_use_weapon",  "can_use_bow",  "can_use_armour", "can_use_weapon",
 "can_use_ring", "has_ready_range", "has_ready_bow",             /* 60 */  "can_use_ring", "has_ready_range", "has_ready_bow",             /* 60 */
 "xrays", NULL, "is_floor", "lifesave", "no_strength", "sleep",  "xrays", NULL, "is_floor", "lifesave", "no_strength", "sleep",
Line 1809
 
Line 1843
  FAST_SAVE_LONG(fastbuf,"gen_sp_armour ",op->gen_sp_armour,14);   FAST_SAVE_LONG(fastbuf,"gen_sp_armour ",op->gen_sp_armour,14);
     }      }
   
   if (!COMPARE_FLAGS(op,op2))      if (op->move_type != op2->move_type) {
    FAST_SAVE_LONG(fastbuf,"move_type ",op->move_type,10);
       }
   
       if (op->move_block != op2->move_block) {
    FAST_SAVE_LONG(fastbuf,"move_block ",op->move_block,11);
       }
   
       if (op->move_on != op2->move_on) {
    FAST_SAVE_LONG(fastbuf,"move_on ",op->move_on,8);
       }
   
       if (op->move_off != op2->move_off) {
    FAST_SAVE_LONG(fastbuf,"move_off ",op->move_off,9);
       }
       if (op->move_slow != op2->move_slow) {
    FAST_SAVE_LONG(fastbuf,"move_slow ",op->move_slow,10);
       }
   
       if (op->move_slow_penalty != op2->move_slow_penalty) {
    FAST_SAVE_LONG(fastbuf,"move_slow_penalty ",op->move_slow_penalty,18);
       }
   
       if (!COMPARE_FLAGS(op,op2)) {
     for (tmp=0; tmp <= NUM_FLAGS; tmp++) {      for (tmp=0; tmp <= NUM_FLAGS; tmp++) {
       if (flag_names[tmp] && (QUERY_FLAG(op, tmp) != QUERY_FLAG(op2, tmp))) {        if (flag_names[tmp] && (QUERY_FLAG(op, tmp) != QUERY_FLAG(op2, tmp))) {
  ADD_STRINGLINE_ENTRY(fastbuf,flag_names[tmp],QUERY_FLAG(op, tmp)?" 1":" 0",flag_lens[tmp]);   ADD_STRINGLINE_ENTRY(fastbuf,flag_names[tmp],QUERY_FLAG(op, tmp)?" 1":" 0",flag_lens[tmp]);
       }        }
     }          }   
   /* The old code was buggy - it would lose custom SLOW_PENALTY if the archetype  
    * had a different slow_penalty (eg, when saving, it would also reset to the  
    * archetype value.  
    */  
   if (QUERY_FLAG(op, FLAG_SLOW_MOVE)) {  
     if (!QUERY_FLAG(op2, FLAG_SLOW_MOVE) || SLOW_PENALTY(op) != SLOW_PENALTY(op2)) {  
  FAST_SAVE_DOUBLE(fastbuf,"slow_move ",SLOW_PENALTY(op),10);  
     }  
   }    }
   
   /* Save body locations */    /* Save body locations */
Line 1835
 
Line 1884
   FINISH_FASTCAT(fastbuf);    FINISH_FASTCAT(fastbuf);
   if(buf[0]=='\0')/*did not cat anything...*/    if(buf[0]=='\0')/*did not cat anything...*/
     return NULL;      return NULL;
   
   return buf;    return buf;
 }  }
   
Line 1946
 
Line 1996
     }      }
     return NULL;      return NULL;
 }  }
   
   
   
   
   
   


Legend:
line(s) removed in v.1.69 
line(s) changed
 line(s) added in v.1.70

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