--- deliantra/server/common/button.C 2007/06/04 13:04:00 1.35 +++ deliantra/server/common/button.C 2007/11/08 19:43:23 1.40 @@ -1,25 +1,24 @@ /* - * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. + * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team + * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team * Copyright (©) 1992,2007 Frank Tore Johansen * - * 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. + * Deliantra 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 3 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 Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . * - * The authors can be reached via e-mail to + * The authors can be reached via e-mail to */ #include @@ -62,6 +61,7 @@ /* if the criteria isn't appropriate, don't do anything */ if (state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_PUSH)) continue; + if (!state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_RELEASE)) continue; @@ -69,6 +69,10 @@ { case GATE: case HOLE: + if (!tmp->active) + tmp->play_sound (tmp->sound + ? tmp->sound + : sound_find (tmp->type == GATE ? "trigger_gate" : "trigger_hole")); tmp->value = tmp->stats.maxsp ? !state : state; tmp->set_speed (0.5); break; @@ -81,6 +85,7 @@ case SIGN: if (!tmp->stats.food || tmp->last_eat < tmp->stats.food) { + tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_sign")); new_info_map (NDI_UNIQUE | NDI_NAVY, tmp->map, tmp->msg); if (tmp->stats.food) tmp->last_eat++; @@ -88,6 +93,7 @@ break; case ALTAR: + tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_altar")); tmp->value = 1; SET_ANIMATION (tmp, tmp->value); update_object (tmp, UP_OBJ_FACE); @@ -95,6 +101,7 @@ case BUTTON: case PEDESTAL: + tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_button")); tmp->value = state; SET_ANIMATION (tmp, tmp->value); update_object (tmp, UP_OBJ_FACE); @@ -105,6 +112,8 @@ break; case TIMED_GATE: + if (!tmp->active) + tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_gate")); tmp->set_speed (tmp->arch->speed); tmp->value = tmp->arch->value; tmp->stats.sp = 1; @@ -143,6 +152,7 @@ break; case TRIGGER_MARKER: + //tmp->play_sound (tmp->sound ? tmp->sound : sound_find ("trigger_marker")); move_marker (tmp); break; @@ -316,18 +326,21 @@ int check_altar_sacrifice (const object *altar, const object *sacrifice) { - if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) && sacrifice->type != PLAYER) + if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) + && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) + && sacrifice->type != PLAYER) { + if (strcmp (ARCH_SACRIFICE (altar), "money") == 0 + && sacrifice->type == MONEY + && sacrifice->nrof * sacrifice->value >= NROF_SACRIFICE (altar)) + return 1; + 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)))) + || strstr (query_base_name (sacrifice, 0), ARCH_SACRIFICE (altar))) && 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 0;