--- deliantra/server/common/button.C 2006/08/13 17:16:00 1.1 +++ deliantra/server/common/button.C 2006/08/29 08:01:35 1.2 @@ -1,6 +1,6 @@ /* * static char *rcsid_button_c = - * "$Id: button.C,v 1.1 2006/08/13 17:16:00 elmex Exp $"; + * "$Id: button.C,v 1.2 2006/08/29 08:01:35 root Exp $"; */ /* @@ -46,107 +46,107 @@ /* LOG(llevDebug, "push_button: %s (%d)\n", op->name, op->count); */ for (ol = get_button_links(op); ol; ol = ol->next) { - if (!ol->ob || ol->ob->count != ol->id) { - LOG(llevError, "Internal error in push_button (%s).\n", op->name); - continue; - } - /* a button link object can become freed when the map is saving. As - * a map is saved, objects are removed and freed, and if an object is - * on top of a button, this function is eventually called. If a map - * is getting moved out of memory, the status of buttons and levers - * probably isn't important - it will get sorted out when the map is - * re-loaded. As such, just exit this function if that is the case. - */ + if (!ol->ob || ol->ob->count != ol->id) { + LOG(llevError, "Internal error in push_button (%s).\n", op->name); + continue; + } + /* a button link object can become freed when the map is saving. As + * a map is saved, objects are removed and freed, and if an object is + * on top of a button, this function is eventually called. If a map + * is getting moved out of memory, the status of buttons and levers + * probably isn't important - it will get sorted out when the map is + * re-loaded. As such, just exit this function if that is the case. + */ - if (QUERY_FLAG(ol->ob, FLAG_FREED)) return; - tmp = ol->ob; + if (QUERY_FLAG(ol->ob, FLAG_FREED)) return; + tmp = ol->ob; - /* if the criteria isn't appropriate, don't do anything */ - if (op->value && !QUERY_FLAG(tmp, FLAG_ACTIVATE_ON_PUSH)) continue; - if (!op->value && !QUERY_FLAG(tmp, FLAG_ACTIVATE_ON_RELEASE)) continue; - - switch(tmp->type) { - - case GATE: - case HOLE: - tmp->value=tmp->stats.maxsp?!op->value:op->value; - tmp->speed=0.5; - update_ob_speed(tmp); - break; - - case CF_HANDLE: - SET_ANIMATION(tmp, (tmp->value=tmp->stats.maxsp?!op->value:op->value)); - update_object(tmp,UP_OBJ_FACE); - break; - - case SIGN: - if (!tmp->stats.food || tmp->last_eat < tmp->stats.food) { - new_info_map(NDI_UNIQUE | NDI_NAVY,tmp->map,tmp->msg); - if (tmp->stats.food) tmp->last_eat++; - } - break; - - case ALTAR: - tmp->value = 1; - SET_ANIMATION(tmp, tmp->value); - update_object(tmp,UP_OBJ_FACE); - break; - - case BUTTON: - case PEDESTAL: - tmp->value=op->value; - SET_ANIMATION(tmp, tmp->value); - update_object(tmp,UP_OBJ_FACE); - break; - - case MOOD_FLOOR: - do_mood_floor(tmp, op); - break; - - case TIMED_GATE: - tmp->speed = tmp->arch->clone.speed; - update_ob_speed(tmp); /* original values */ - tmp->value = tmp->arch->clone.value; - tmp->stats.sp = 1; - tmp->stats.hp = tmp->stats.maxhp; - /* Handle multipart gates. We copy the value for the other parts - * from the head - this ensures that the data will consistent - */ - for (tmp=tmp->more; tmp!=NULL; tmp=tmp->more) { - tmp->speed = tmp->head->speed; - tmp->value = tmp->head->value; - tmp->stats.sp = tmp->head->stats.sp; - tmp->stats.hp = tmp->head->stats.hp; - update_ob_speed(tmp); - } - break; - - case DIRECTOR: - case FIREWALL: - if(!QUERY_FLAG(tmp,FLAG_ANIMATE)&&tmp->type==FIREWALL) move_firewall(tmp); - else { - if ((tmp->stats.sp += tmp->stats.maxsp) > 8) /* next direction */ - tmp->stats.sp = ((tmp->stats.sp-1)%8)+1; - animate_turning(tmp); - } - break; - - case TELEPORTER: - move_teleporter(tmp); - break; - - case CREATOR: - move_creator(tmp); - break; - - case TRIGGER_MARKER: - move_marker(tmp); - break; - - case DUPLICATOR: - move_duplicator(tmp); - break; - } + /* if the criteria isn't appropriate, don't do anything */ + if (op->value && !QUERY_FLAG(tmp, FLAG_ACTIVATE_ON_PUSH)) continue; + if (!op->value && !QUERY_FLAG(tmp, FLAG_ACTIVATE_ON_RELEASE)) continue; + + switch(tmp->type) { + + case GATE: + case HOLE: + tmp->value=tmp->stats.maxsp?!op->value:op->value; + tmp->speed=0.5; + update_ob_speed(tmp); + break; + + case CF_HANDLE: + SET_ANIMATION(tmp, (tmp->value=tmp->stats.maxsp?!op->value:op->value)); + update_object(tmp,UP_OBJ_FACE); + break; + + case SIGN: + if (!tmp->stats.food || tmp->last_eat < tmp->stats.food) { + new_info_map(NDI_UNIQUE | NDI_NAVY,tmp->map,tmp->msg); + if (tmp->stats.food) tmp->last_eat++; + } + break; + + case ALTAR: + tmp->value = 1; + SET_ANIMATION(tmp, tmp->value); + update_object(tmp,UP_OBJ_FACE); + break; + + case BUTTON: + case PEDESTAL: + tmp->value=op->value; + SET_ANIMATION(tmp, tmp->value); + update_object(tmp,UP_OBJ_FACE); + break; + + case MOOD_FLOOR: + do_mood_floor(tmp, op); + break; + + case TIMED_GATE: + tmp->speed = tmp->arch->clone.speed; + update_ob_speed(tmp); /* original values */ + tmp->value = tmp->arch->clone.value; + tmp->stats.sp = 1; + tmp->stats.hp = tmp->stats.maxhp; + /* Handle multipart gates. We copy the value for the other parts + * from the head - this ensures that the data will consistent + */ + for (tmp=tmp->more; tmp!=NULL; tmp=tmp->more) { + tmp->speed = tmp->head->speed; + tmp->value = tmp->head->value; + tmp->stats.sp = tmp->head->stats.sp; + tmp->stats.hp = tmp->head->stats.hp; + update_ob_speed(tmp); + } + break; + + case DIRECTOR: + case FIREWALL: + if(!QUERY_FLAG(tmp,FLAG_ANIMATE)&&tmp->type==FIREWALL) move_firewall(tmp); + else { + if ((tmp->stats.sp += tmp->stats.maxsp) > 8) /* next direction */ + tmp->stats.sp = ((tmp->stats.sp-1)%8)+1; + animate_turning(tmp); + } + break; + + case TELEPORTER: + move_teleporter(tmp); + break; + + case CREATOR: + move_creator(tmp); + break; + + case TRIGGER_MARKER: + move_marker(tmp); + break; + + case DUPLICATOR: + move_duplicator(tmp); + break; + } } } @@ -164,56 +164,56 @@ /* LOG(llevDebug, "update_button: %s (%d)\n", op->name, op->count); */ for (ol = get_button_links(op); ol; ol = ol->next) { - if (!ol->ob || ol->ob->count != ol->id) { - LOG(llevDebug, "Internal error in update_button (%s).\n", op->name); - continue; - } - tmp = ol->ob; - if (tmp->type==BUTTON) { - for(ab=tmp->above,tot=0;ab!=NULL;ab=ab->above) - /* Bug? The pedestal code below looks for the head of - * the object, this bit doesn't. I'd think we should check - * for head here also. Maybe it also makese sense to - * make the for ab=tmp->above loop common, and alter - * behaviour based on object within that loop? - */ - - /* Basically, if the move_type matches that on what the - * button wants, we count it. The second check is so that - * objects don't move (swords, etc) will count. Note that - * this means that more work is needed to make buttons - * that are only triggered by flying objects. - */ - if ((ab->move_type & tmp->move_on) || ab->move_type==0 ) - tot+=ab->weight*(ab->nrof?ab->nrof:1)+ab->carrying; - - tmp->value=(tot>=tmp->weight)?1:0; - if(tmp->value) - any_down=1; - } else if (tmp->type == PEDESTAL) { - tmp->value = 0; - for(ab=tmp->above; ab!=NULL; ab=ab->above) { - head = ab->head ? ab->head : ab; - /* Same note regarding move_type for buttons above apply here. */ - if ( ((head->move_type & tmp->move_on) || ab->move_type==0) && - (head->race==tmp->slaying || - ((head->type==SPECIAL_KEY) && (head->slaying==tmp->slaying)) || - (!strcmp (tmp->slaying, "player") && - head->type == PLAYER))) - tmp->value = 1; - } - if(tmp->value) - any_down=1; - } + if (!ol->ob || ol->ob->count != ol->id) { + LOG(llevDebug, "Internal error in update_button (%s).\n", op->name); + continue; + } + tmp = ol->ob; + if (tmp->type==BUTTON) { + for(ab=tmp->above,tot=0;ab!=NULL;ab=ab->above) + /* Bug? The pedestal code below looks for the head of + * the object, this bit doesn't. I'd think we should check + * for head here also. Maybe it also makese sense to + * make the for ab=tmp->above loop common, and alter + * behaviour based on object within that loop? + */ + + /* Basically, if the move_type matches that on what the + * button wants, we count it. The second check is so that + * objects don't move (swords, etc) will count. Note that + * this means that more work is needed to make buttons + * that are only triggered by flying objects. + */ + if ((ab->move_type & tmp->move_on) || ab->move_type==0 ) + tot+=ab->weight*(ab->nrof?ab->nrof:1)+ab->carrying; + + tmp->value=(tot>=tmp->weight)?1:0; + if(tmp->value) + any_down=1; + } else if (tmp->type == PEDESTAL) { + tmp->value = 0; + for(ab=tmp->above; ab!=NULL; ab=ab->above) { + head = ab->head ? ab->head : ab; + /* Same note regarding move_type for buttons above apply here. */ + if ( ((head->move_type & tmp->move_on) || ab->move_type==0) && + (head->race==tmp->slaying || + ((head->type==SPECIAL_KEY) && (head->slaying==tmp->slaying)) || + (!strcmp (tmp->slaying, "player") && + head->type == PLAYER))) + tmp->value = 1; + } + if(tmp->value) + any_down=1; + } } if(any_down) /* If any other buttons were down, force this to remain down */ - op->value=1; + op->value=1; /* If this button hasn't changed, don't do anything */ if (op->value != old_value) { - SET_ANIMATION(op, op->value); - update_object(op, UP_OBJ_FACE); - push_button(op); /* Make all other buttons the same */ + SET_ANIMATION(op, op->value); + update_object(op, UP_OBJ_FACE); + push_button(op); /* Make all other buttons the same */ } } @@ -228,11 +228,11 @@ for (ol = obp->link; ol; ol = ol->next) { if (!ol->ob || ol->ob->count != ol->id) { LOG(llevError, "Internal error in update_button (%s (%dx%d):%d, connected %ld).\n", - ol->ob?ol->ob->name:"null", - ol->ob?ol->ob->x:-1, - ol->ob?ol->ob->y:-1, - ol->id, - obp->value); + ol->ob?ol->ob->name:"null", + ol->ob?ol->ob->x:-1, + ol->ob?ol->ob->y:-1, + ol->id, + obp->value); continue; } if (ol->ob->type==BUTTON || ol->ob->type==PEDESTAL) @@ -261,7 +261,7 @@ if (++op->state >= NUM_ANIMATIONS(op)/8) op->state=0; SET_ANIMATION(op, (op->stats.sp-1) * NUM_ANIMATIONS(op) / 8 + - op->state); + op->state); update_object(op,UP_OBJ_FACE); } @@ -287,14 +287,14 @@ { if ((ARCH_SACRIFICE(altar) == sacrifice->arch->name || ARCH_SACRIFICE(altar) == sacrifice->name || - ARCH_SACRIFICE(altar) == sacrifice->slaying || - (!strcmp(ARCH_SACRIFICE(altar),query_base_name(sacrifice,0)))) - && NROF_SACRIFICE(altar) <= (sacrifice->nrof?sacrifice->nrof:1)) - return 1; + ARCH_SACRIFICE(altar) == sacrifice->slaying || + (!strcmp(ARCH_SACRIFICE(altar),query_base_name(sacrifice,0)))) + && NROF_SACRIFICE(altar) <= (sacrifice->nrof?sacrifice->nrof:1)) + return 1; if (strcmp (ARCH_SACRIFICE(altar), "money") == 0 && sacrifice->type == MONEY && sacrifice->nrof * sacrifice->value >= NROF_SACRIFICE(altar)) - return 1; + return 1; } return 0; } @@ -328,11 +328,11 @@ * has been dropped. */ if (!strcmp(ARCH_SACRIFICE(altar), "money")) { - int number=NROF_SACRIFICE(altar) / (*sacrifice)->value; + int number=NROF_SACRIFICE(altar) / (*sacrifice)->value; - /* Round up any sacrifices. Altars don't make change either */ - if (NROF_SACRIFICE(altar) % (*sacrifice)->value) number++; - *sacrifice = decrease_ob_nr (*sacrifice, number); + /* Round up any sacrifices. Altars don't make change either */ + if (NROF_SACRIFICE(altar) % (*sacrifice)->value) number++; + *sacrifice = decrease_ob_nr (*sacrifice, number); } else *sacrifice = decrease_ob_nr (*sacrifice, NROF_SACRIFICE(altar)); @@ -346,17 +346,17 @@ { op->stats.wc = state; if (state) { - use_trigger(op); - if (op->stats.exp > 0) /* check sanity */ - op->speed = 1.0 / op->stats.exp; - else - op->speed = 1.0; - update_ob_speed(op); - op->speed_left = -1; + use_trigger(op); + if (op->stats.exp > 0) /* check sanity */ + op->speed = 1.0 / op->stats.exp; + else + op->speed = 1.0; + update_ob_speed(op); + op->speed_left = -1; } else { use_trigger(op); - op->speed = 0; - update_ob_speed(op); + op->speed = 0; + update_ob_speed(op); } } @@ -380,130 +380,130 @@ int in_movement = op->stats.wc || op->speed; switch (op->type) { - case TRIGGER_BUTTON: - if (op->weight > 0) { - if (cause) { - for (tmp = op->above; tmp; tmp = tmp->above) - /* Comment reproduced from update_buttons(): */ - /* Basically, if the move_type matches that on what the - * button wants, we count it. The second check is so that - * objects that don't move (swords, etc) will count. Note that - * this means that more work is needed to make buttons - * that are only triggered by flying objects. - */ - - if ((tmp->move_type & op->move_on) || tmp->move_type==0) { - tot += tmp->weight * (tmp->nrof ? tmp->nrof : 1) - + tmp->carrying; - } - if (tot >= op->weight) - push = 1; - if (op->stats.ac == push) - return 0; - op->stats.ac = push; + case TRIGGER_BUTTON: + if (op->weight > 0) { + if (cause) { + for (tmp = op->above; tmp; tmp = tmp->above) + /* Comment reproduced from update_buttons(): */ + /* Basically, if the move_type matches that on what the + * button wants, we count it. The second check is so that + * objects that don't move (swords, etc) will count. Note that + * this means that more work is needed to make buttons + * that are only triggered by flying objects. + */ + + if ((tmp->move_type & op->move_on) || tmp->move_type==0) { + tot += tmp->weight * (tmp->nrof ? tmp->nrof : 1) + + tmp->carrying; + } + if (tot >= op->weight) + push = 1; + if (op->stats.ac == push) + return 0; + op->stats.ac = push; if (NUM_ANIMATIONS(op) > 1) { SET_ANIMATION (op, push); update_object (op, UP_OBJ_FACE); } - if (in_movement || ! push) - return 0; - } - trigger_move (op, push); - } - return 0; - - case TRIGGER_PEDESTAL: - if (cause) { - for (tmp = op->above; tmp; tmp = tmp->above) { - object *head = tmp->head ? tmp->head : tmp; - - /* See comment in TRIGGER_BUTTON about move_types */ - if (((head->move_type & op->move_on) || head->move_type==0) - && (head->race==op->slaying || - (!strcmp (op->slaying, "player") && head->type == PLAYER))) { - push = 1; - break; - } - } - if (op->stats.ac == push) - return 0; - op->stats.ac = push; + if (in_movement || ! push) + return 0; + } + trigger_move (op, push); + } + return 0; + + case TRIGGER_PEDESTAL: + if (cause) { + for (tmp = op->above; tmp; tmp = tmp->above) { + object *head = tmp->head ? tmp->head : tmp; + + /* See comment in TRIGGER_BUTTON about move_types */ + if (((head->move_type & op->move_on) || head->move_type==0) + && (head->race==op->slaying || + (!strcmp (op->slaying, "player") && head->type == PLAYER))) { + push = 1; + break; + } + } + if (op->stats.ac == push) + return 0; + op->stats.ac = push; if (NUM_ANIMATIONS(op) > 1) { SET_ANIMATION (op, push); update_object (op, UP_OBJ_FACE); } - update_object(op,UP_OBJ_FACE); - if (in_movement || ! push) - return 0; - } - trigger_move (op, push); - return 0; - - case TRIGGER_ALTAR: - if (cause) { - if (in_movement) - return 0; - if (operate_altar (op, &cause)) { + update_object(op,UP_OBJ_FACE); + if (in_movement || ! push) + return 0; + } + trigger_move (op, push); + return 0; + + case TRIGGER_ALTAR: + if (cause) { + if (in_movement) + return 0; + if (operate_altar (op, &cause)) { if (NUM_ANIMATIONS(op) > 1) { SET_ANIMATION (op, 1); update_object(op, UP_OBJ_FACE); } - if (op->last_sp >= 0) { - trigger_move (op, 1); - if (op->last_sp > 0) - op->last_sp = -op->last_sp; - } - else { - /* for trigger altar with last_sp, the ON/OFF - * status (-> +/- value) is "simulated": - */ - op->value = !op->value; - trigger_move (op, 1); - op->last_sp = -op->last_sp; - op->value = !op->value; - } - return cause == NULL; - } else { - return 0; - } - } else { + if (op->last_sp >= 0) { + trigger_move (op, 1); + if (op->last_sp > 0) + op->last_sp = -op->last_sp; + } + else { + /* for trigger altar with last_sp, the ON/OFF + * status (-> +/- value) is "simulated": + */ + op->value = !op->value; + trigger_move (op, 1); + op->last_sp = -op->last_sp; + op->value = !op->value; + } + return cause == NULL; + } else { + return 0; + } + } else { if (NUM_ANIMATIONS(op) > 1) { SET_ANIMATION (op, 0); update_object(op, UP_OBJ_FACE); } - - /* If trigger_altar has "last_sp > 0" set on the map, - * it will push the connected value only once per sacrifice. - * Otherwise (default), the connected value will be - * pushed twice: First by sacrifice, second by reset! -AV - */ - if (!op->last_sp) - trigger_move (op, 0); - else { - op->stats.wc = 0; - op->value = !op->value; - op->speed = 0; - update_ob_speed(op); - } - } - return 0; - - case TRIGGER: - if (cause) { - if (in_movement) - return 0; - push = 1; - } + + /* If trigger_altar has "last_sp > 0" set on the map, + * it will push the connected value only once per sacrifice. + * Otherwise (default), the connected value will be + * pushed twice: First by sacrifice, second by reset! -AV + */ + if (!op->last_sp) + trigger_move (op, 0); + else { + op->stats.wc = 0; + op->value = !op->value; + op->speed = 0; + update_ob_speed(op); + } + } + return 0; + + case TRIGGER: + if (cause) { + if (in_movement) + return 0; + push = 1; + } if (NUM_ANIMATIONS(op) > 1) { SET_ANIMATION (op, push); update_object(op, UP_OBJ_FACE); } - trigger_move (op, push); - return 1; + trigger_move (op, push); + return 1; - default: - LOG(llevDebug, "Unknown trigger type: %s (%d)\n", op->name, op->type); - return 0; + default: + LOG(llevDebug, "Unknown trigger type: %s (%d)\n", op->name, op->type); + return 0; } } @@ -516,7 +516,7 @@ return; } if (!editor) button->path_attuned = connected; /* peterm: I need this so I can rebuild - a connected map from a template map. */ + a connected map from a template map. */ /* LOG(llevDebug,"adding button %s (%d)\n", button->name, connected);*/ SET_FLAG(button,FLAG_IS_LINKED); @@ -618,7 +618,7 @@ object *tmp2; for (tmp = GET_MAP_OB(op->map, op->x, op->y); tmp; tmp=tmp->above) - if (QUERY_FLAG(tmp, FLAG_MONSTER)) break; + if (QUERY_FLAG(tmp, FLAG_MONSTER)) break; /* doesn't effect players, and if there is a player on this space, won't also * be a monster here. @@ -626,57 +626,57 @@ if (!tmp || tmp->type == PLAYER) return; switch(op->last_sp) { - case 0: /* furious--make all monsters mad */ - if(QUERY_FLAG(tmp, FLAG_UNAGGRESSIVE)) - CLEAR_FLAG(tmp, FLAG_UNAGGRESSIVE); - if(QUERY_FLAG(tmp, FLAG_FRIENDLY)) { - CLEAR_FLAG(tmp, FLAG_FRIENDLY); - remove_friendly_object(tmp); - tmp->attack_movement = 0; - /* lots of checks here, but want to make sure we don't - * dereference a null value - */ - if (tmp->type == GOLEM && tmp->owner && tmp->owner->type==PLAYER && - tmp->owner->contr->ranges[range_golem]==tmp) { - tmp->owner->contr->ranges[range_golem]=NULL; - tmp->owner->contr->golem_count = 0; - } - tmp->owner = 0; - } - break; - case 1: /* angry -- get neutral monsters mad */ + case 0: /* furious--make all monsters mad */ + if(QUERY_FLAG(tmp, FLAG_UNAGGRESSIVE)) + CLEAR_FLAG(tmp, FLAG_UNAGGRESSIVE); + if(QUERY_FLAG(tmp, FLAG_FRIENDLY)) { + CLEAR_FLAG(tmp, FLAG_FRIENDLY); + remove_friendly_object(tmp); + tmp->attack_movement = 0; + /* lots of checks here, but want to make sure we don't + * dereference a null value + */ + if (tmp->type == GOLEM && tmp->owner && tmp->owner->type==PLAYER && + tmp->owner->contr->ranges[range_golem]==tmp) { + tmp->owner->contr->ranges[range_golem]=NULL; + tmp->owner->contr->golem_count = 0; + } + tmp->owner = 0; + } + break; + case 1: /* angry -- get neutral monsters mad */ if(QUERY_FLAG(tmp, FLAG_UNAGGRESSIVE)&& - !QUERY_FLAG(tmp, FLAG_FRIENDLY)) + !QUERY_FLAG(tmp, FLAG_FRIENDLY)) CLEAR_FLAG(tmp, FLAG_UNAGGRESSIVE); - break; - case 2: /* calm -- pacify unfriendly monsters */ + break; + case 2: /* calm -- pacify unfriendly monsters */ if(!QUERY_FLAG(tmp, FLAG_UNAGGRESSIVE)) - SET_FLAG(tmp, FLAG_UNAGGRESSIVE); - break; - case 3: /* make all monsters fall asleep */ - if(!QUERY_FLAG(tmp, FLAG_SLEEP)) - SET_FLAG(tmp, FLAG_SLEEP); - break; - case 4: /* charm all monsters */ - - if(op == op2) break; /* only if 'connected' */ - - for(tmp2=get_map_ob(op2->map,op2->x,op2->y); /* finding an owner */ + SET_FLAG(tmp, FLAG_UNAGGRESSIVE); + break; + case 3: /* make all monsters fall asleep */ + if(!QUERY_FLAG(tmp, FLAG_SLEEP)) + SET_FLAG(tmp, FLAG_SLEEP); + break; + case 4: /* charm all monsters */ + + if(op == op2) break; /* only if 'connected' */ + + for(tmp2=get_map_ob(op2->map,op2->x,op2->y); /* finding an owner */ tmp2->type!=PLAYER;tmp2=tmp2->above) if(tmp2->above==NULL) break; if (tmp2->type != PLAYER) break; - set_owner(tmp,tmp2); - SET_FLAG(tmp,FLAG_MONSTER); - tmp->stats.exp = 0; - SET_FLAG(tmp, FLAG_FRIENDLY); + set_owner(tmp,tmp2); + SET_FLAG(tmp,FLAG_MONSTER); + tmp->stats.exp = 0; + SET_FLAG(tmp, FLAG_FRIENDLY); add_friendly_object (tmp); - tmp->attack_movement = PETMOVE; - break; + tmp->attack_movement = PETMOVE; + break; - default: - break; + default: + break; } } @@ -694,19 +694,19 @@ /* First check the object itself. */ if((trig->stats.hp && (op->type == trig->stats.hp)) - || (trig->slaying && (op->slaying == trig->slaying)) - || (trig->race && (op->arch->name == trig->race))) - return op; + || (trig->slaying && (op->slaying == trig->slaying)) + || (trig->race && (op->arch->name == trig->race))) + return op; for(tmp=op->inv; tmp; tmp=tmp->below) { - if (tmp->inv) { - ret=check_inv_recursive(tmp, trig); - if (ret) return ret; - } - else if((trig->stats.hp && (tmp->type == trig->stats.hp)) - || (trig->slaying && (tmp->slaying == trig->slaying)) - || (trig->race && (tmp->arch->name == trig->race))) - return tmp; + if (tmp->inv) { + ret=check_inv_recursive(tmp, trig); + if (ret) return ret; + } + else if((trig->stats.hp && (tmp->type == trig->stats.hp)) + || (trig->slaying && (tmp->slaying == trig->slaying)) + || (trig->race && (tmp->arch->name == trig->race))) + return tmp; } return NULL; } @@ -726,12 +726,12 @@ if(op->type != PLAYER) return; match = check_inv_recursive(op,trig); if (match && trig->last_sp) { - if(trig->last_heal) - decrease_ob(match); - use_trigger(trig); + if(trig->last_heal) + decrease_ob(match); + use_trigger(trig); } else if (!match && !trig->last_sp) - use_trigger(trig); + use_trigger(trig); } @@ -746,9 +746,9 @@ if (!map) return; for (obp = map->buttons; obp; obp = obp->next) { - for (ol=obp->link; ol; ol=ol->next) { - if (ol->id!=ol->ob->count) - LOG(llevError,"verify_button_links: object %s on list is corrupt (%d!=%d)\n",ol->ob->name, ol->id, ol->ob->count); - } + for (ol=obp->link; ol; ol=ol->next) { + if (ol->id!=ol->ob->count) + LOG(llevError,"verify_button_links: object %s on list is corrupt (%d!=%d)\n",ol->ob->name, ol->id, ol->ob->count); + } } }