ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/button.C
(Generate patch)

Comparing deliantra/server/common/button.C (file contents):
Revision 1.34 by root, Mon Jun 4 12:19:08 2007 UTC vs.
Revision 1.38 by elmex, Tue Jul 31 18:28:46 2007 UTC

1/* 1/*
2 * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. 2 * This file is part of Crossfire TRT, the Roguelike Realtime MORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team 4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Crossfire TRT is free software; you can redistribute it and/or modify it 8 * Crossfire TRT is free software: you can redistribute it and/or modify
9 * under the terms of the GNU General Public License as published by the Free 9 * it under the terms of the GNU General Public License as published by
10 * Software Foundation; either version 2 of the License, or (at your option) 10 * the Free Software Foundation, either version 3 of the License, or
11 * any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, but 13 * This program is distributed in the hope that it will be useful,
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License along 18 * You should have received a copy of the GNU General Public License
19 * with Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * 20 *
22 * The authors can be reached via e-mail to <crossfire@schmorp.de> 21 * The authors can be reached via e-mail to <crossfire@schmorp.de>
23 */ 22 */
24 23
25#include <global.h> 24#include <global.h>
60 object *tmp = ol->ob; 59 object *tmp = ol->ob;
61 60
62 /* if the criteria isn't appropriate, don't do anything */ 61 /* if the criteria isn't appropriate, don't do anything */
63 if (state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_PUSH)) 62 if (state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_PUSH))
64 continue; 63 continue;
64
65 if (!state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_RELEASE)) 65 if (!state && !QUERY_FLAG (tmp, FLAG_ACTIVATE_ON_RELEASE))
66 continue; 66 continue;
67 67
68 switch (tmp->type) 68 switch (tmp->type)
69 { 69 {
79 break; 79 break;
80 80
81 case SIGN: 81 case SIGN:
82 if (!tmp->stats.food || tmp->last_eat < tmp->stats.food) 82 if (!tmp->stats.food || tmp->last_eat < tmp->stats.food)
83 { 83 {
84 tmp->play_sound (tmp->sound);
84 new_info_map (NDI_UNIQUE | NDI_NAVY, tmp->map, tmp->msg); 85 new_info_map (NDI_UNIQUE | NDI_NAVY, tmp->map, tmp->msg);
85 if (tmp->stats.food) 86 if (tmp->stats.food)
86 tmp->last_eat++; 87 tmp->last_eat++;
87 } 88 }
88 break; 89 break;
103 case MOOD_FLOOR: 104 case MOOD_FLOOR:
104 do_mood_floor (tmp, source); 105 do_mood_floor (tmp, source);
105 break; 106 break;
106 107
107 case TIMED_GATE: 108 case TIMED_GATE:
108 tmp->set_speed (tmp->arch->clone.speed); 109 tmp->set_speed (tmp->arch->speed);
109 tmp->value = tmp->arch->clone.value; 110 tmp->value = tmp->arch->value;
110 tmp->stats.sp = 1; 111 tmp->stats.sp = 1;
111 tmp->stats.hp = tmp->stats.maxhp; 112 tmp->stats.hp = tmp->stats.maxhp;
112 /* Handle multipart gates. We copy the value for the other parts 113 /* Handle multipart gates. We copy the value for the other parts
113 * from the head - this ensures that the data will consistent 114 * from the head - this ensures that the data will consistent
114 */ 115 */
314 */ 315 */
315 316
316int 317int
317check_altar_sacrifice (const object *altar, const object *sacrifice) 318check_altar_sacrifice (const object *altar, const object *sacrifice)
318{ 319{
319 if (!QUERY_FLAG (sacrifice, FLAG_ALIVE) && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED) && sacrifice->type != PLAYER) 320 if (!QUERY_FLAG (sacrifice, FLAG_ALIVE)
321 && !QUERY_FLAG (sacrifice, FLAG_IS_LINKED)
322 && sacrifice->type != PLAYER)
320 { 323 {
324 if (strcmp (ARCH_SACRIFICE (altar), "money") == 0
325 && sacrifice->type == MONEY
326 && sacrifice->nrof * sacrifice->value >= NROF_SACRIFICE (altar))
327 return 1;
328
321 if ((ARCH_SACRIFICE (altar) == sacrifice->arch->archname 329 if ((ARCH_SACRIFICE (altar) == sacrifice->arch->archname
322 || ARCH_SACRIFICE (altar) == sacrifice->name 330 || ARCH_SACRIFICE (altar) == sacrifice->name
323 || ARCH_SACRIFICE (altar) == sacrifice->slaying 331 || ARCH_SACRIFICE (altar) == sacrifice->slaying
324 || (!strcmp (ARCH_SACRIFICE (altar), query_base_name (sacrifice, 0)))) 332 || strstr (query_base_name (sacrifice, 0), ARCH_SACRIFICE (altar)))
325 && NROF_SACRIFICE (altar) <= (sacrifice->nrof ? sacrifice->nrof : 1)) 333 && NROF_SACRIFICE (altar) <= (sacrifice->nrof ? sacrifice->nrof : 1))
326 return 1;
327
328 if (strcmp (ARCH_SACRIFICE (altar), "money") == 0
329 && sacrifice->type == MONEY && sacrifice->nrof * sacrifice->value >= NROF_SACRIFICE (altar))
330 return 1; 334 return 1;
331 } 335 }
332 336
333 return 0; 337 return 0;
334} 338}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines