--- deliantra/server/common/button.C 2007/04/24 12:32:14 1.29 +++ deliantra/server/common/button.C 2007/06/04 12:19:08 1.34 @@ -1,25 +1,25 @@ /* - * CrossFire, A Multiplayer game + * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. * - * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team - * Copyright (C) 2002 Mark Wedel & Crossfire Development Team - * Copyright (C) 1992 Frank Tore Johansen + * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team + * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992,2007 Frank Tore Johansen * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Crossfire TRT is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * The authors can be reached via e-mail at + * You should have received a copy of the GNU General Public License along + * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * The authors can be reached via e-mail to */ #include @@ -112,12 +112,12 @@ /* 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; tmp = tmp->more) + for (object *part = tmp->more; part; part = part->more) { - tmp->value = tmp->head->value; - tmp->stats.sp = tmp->head->stats.sp; - tmp->stats.hp = tmp->head->stats.hp; - tmp->set_speed (tmp->head->speed); + part->value = tmp->value; + part->stats.sp = tmp->stats.sp; + part->stats.hp = tmp->stats.hp; + part->set_speed (tmp->speed); } break; @@ -129,6 +129,7 @@ { if ((tmp->stats.sp += tmp->stats.maxsp) > 8) /* next direction */ tmp->stats.sp = ((tmp->stats.sp - 1) % 8) + 1; + animate_turning (tmp); } break; @@ -252,7 +253,7 @@ tmp->value = 0; for (ab = tmp->above; ab != NULL; ab = ab->above) { - head = ab->head ? ab->head : ab; + head = ab->head_ (); /* 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 || @@ -260,6 +261,7 @@ (!strcmp (tmp->slaying, "player") && head->type == PLAYER))) tmp->value = 1; } + if (tmp->value) any_down = 1; } @@ -316,10 +318,10 @@ { if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) && sacrifice->type != PLAYER) { - 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)))) + if ((ARCH_SACRIFICE (altar) == sacrifice->arch->archname + || 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; @@ -456,7 +458,7 @@ { for (tmp = op->above; tmp; tmp = tmp->above) { - object *head = tmp->head ? tmp->head : tmp; + object *head = tmp->head_ (); /* See comment in TRIGGER_BUTTON about move_types */ if (((head->move_type & op->move_on) || head->move_type == 0) @@ -466,18 +468,24 @@ 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; @@ -486,6 +494,7 @@ { if (in_movement) return 0; + if (operate_altar (op, &cause)) { if (NUM_ANIMATIONS (op) > 1) @@ -493,6 +502,7 @@ SET_ANIMATION (op, 1); update_object (op, UP_OBJ_FACE); } + if (op->last_sp >= 0) { trigger_move (op, 1); @@ -509,12 +519,11 @@ op->last_sp = -op->last_sp; op->value = !op->value; } + return cause == NULL; } else - { - return 0; - } + return 0; } else { @@ -743,8 +752,8 @@ if (tmp->type == GOLEM && tmp->owner && tmp->owner->type == PLAYER - && tmp->owner->contr->ranges[range_golem] == tmp) - tmp->owner->contr->ranges[range_golem] = 0; + && tmp->owner->contr->golem == tmp) + tmp->owner->contr->golem = 0; tmp->owner = 0; @@ -781,14 +790,17 @@ } break; - case 6: + case 6: // kill monsters if (!QUERY_FLAG (tmp, FLAG_FRIENDLY)) break; // FALL THROUGH - case 5: - get_archetype ("burnout")->insert_at (tmp, source); - tmp->destroy (); + case 5: // kill all alives + if (!tmp->flag [FLAG_PRECIOUS]) + { + get_archetype ("burnout")->insert_at (tmp, source); + tmp->destroy (); + } break; default: @@ -810,7 +822,7 @@ /* 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))) + || (trig->race && (op->arch->archname == trig->race))) return op; for (tmp = op->inv; tmp; tmp = tmp->below) @@ -823,7 +835,7 @@ } else if ((trig->stats.hp && (tmp->type == trig->stats.hp)) || (trig->slaying && (tmp->slaying == trig->slaying)) - || (trig->race && (tmp->arch->name == trig->race))) + || (trig->race && (tmp->arch->archname == trig->race))) return tmp; } return NULL;