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

Comparing deliantra/server/server/apply.C (file contents):
Revision 1.199 by sf-marcmagus, Sun Oct 11 05:43:35 2009 UTC vs.
Revision 1.201 by root, Mon Oct 12 14:00:58 2009 UTC

3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License 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 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24#include <cmath> 25#include <cmath>
25 26
100 return 0; 101 return 0;
101 102
102 /* Check for MONEY type is a special hack - it prevents 'nothing needs 103 /* Check for MONEY type is a special hack - it prevents 'nothing needs
103 * identifying' from being printed out more than it needs to be. 104 * identifying' from being printed out more than it needs to be.
104 */ 105 */
105 if (!check_altar_sacrifice (altar, money) || money->type != MONEY) 106 if (!check_altar_sacrifice (altar, money, pl) || money->type != MONEY)
106 return 0; 107 return 0;
107 108
108 /* if the player has a marked item, identify that if it needs to be 109 /* if the player has a marked item, identify that if it needs to be
109 * identified. If it doesn't, then go through the player inventory. 110 * identified. If it doesn't, then go through the player inventory.
110 */ 111 */
111 if (object *marked = find_marked_object (pl)) 112 if (object *marked = find_marked_object (pl))
112 if (!QUERY_FLAG (marked, FLAG_IDENTIFIED) && need_identify (marked)) 113 if (!QUERY_FLAG (marked, FLAG_IDENTIFIED) && need_identify (marked))
113 { 114 {
114 if (operate_altar (altar, &money)) 115 if (operate_altar (altar, &money, pl))
115 { 116 {
116 identify (marked); 117 identify (marked);
117 118
118 buf.printf ("You have %s.\r", long_desc (marked, pl)); 119 buf.printf ("You have %s.\r", long_desc (marked, pl));
119 if (marked->msg) 120 if (marked->msg)
125 126
126 for (object *id = pl->inv; id; id = id->below) 127 for (object *id = pl->inv; id; id = id->below)
127 { 128 {
128 if (!QUERY_FLAG (id, FLAG_IDENTIFIED) && !id->invisible && need_identify (id)) 129 if (!QUERY_FLAG (id, FLAG_IDENTIFIED) && !id->invisible && need_identify (id))
129 { 130 {
130 if (operate_altar (altar, &money)) 131 if (operate_altar (altar, &money, pl))
131 { 132 {
132 identify (id); 133 identify (id);
133 134
134 buf.printf ("You have %s.\r", long_desc (id, pl)); 135 buf.printf ("You have %s.\r", long_desc (id, pl));
135 if (id->msg) 136 if (id->msg)
1060{ 1061{
1061 /* Only players can make sacrifices on spell casting altars. */ 1062 /* Only players can make sacrifices on spell casting altars. */
1062 if (altar->inv && (!originator || originator->type != PLAYER)) 1063 if (altar->inv && (!originator || originator->type != PLAYER))
1063 return 0; 1064 return 0;
1064 1065
1065 if (operate_altar (altar, &sacrifice)) 1066 if (operate_altar (altar, &sacrifice, originator))
1066 { 1067 {
1067 /* Simple check. Unfortunately, it means you can't cast magic bullet 1068 /* Simple check. Unfortunately, it means you can't cast magic bullet
1068 * with an altar. We call it a Potion - altars are stationary - it 1069 * with an altar. We call it a Potion - altars are stationary - it
1069 * is up to map designers to use them properly. 1070 * is up to map designers to use them properly.
1070 */ 1071 */
1465 break; 1466 break;
1466 1467
1467 case TRIGGER_BUTTON: 1468 case TRIGGER_BUTTON:
1468 case TRIGGER_PEDESTAL: 1469 case TRIGGER_PEDESTAL:
1469 case TRIGGER_ALTAR: 1470 case TRIGGER_ALTAR:
1470 check_trigger (trap, victim); 1471 check_trigger (trap, victim, originator);
1471 break; 1472 break;
1472 1473
1473 case DEEP_SWAMP: 1474 case DEEP_SWAMP:
1474 walk_on_deep_swamp (trap, victim); 1475 walk_on_deep_swamp (trap, victim);
1475 break; 1476 break;
2595 update_object (op, UP_OBJ_FACE); 2596 update_object (op, UP_OBJ_FACE);
2596 push_button (op, who); 2597 push_button (op, who);
2597 return 1; 2598 return 1;
2598 2599
2599 case TRIGGER: 2600 case TRIGGER:
2600 if (check_trigger (op, who)) 2601 if (check_trigger (op, who, who))
2601 { 2602 {
2602 who->statusmsg ("You turn the handle."); 2603 who->statusmsg ("You turn the handle.");
2603 who->play_sound (sound_find ("turn_handle")); 2604 who->play_sound (sound_find ("turn_handle"));
2604 } 2605 }
2605 else 2606 else
3786 } 3787 }
3787 3788
3788 for (mapspace *ms = spaces + size (); ms-- > spaces; ) 3789 for (mapspace *ms = spaces + size (); ms-- > spaces; )
3789 for (object *tmp = ms->bot; tmp; tmp = tmp->above) 3790 for (object *tmp = ms->bot; tmp; tmp = tmp->above)
3790 if (tmp->above && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL)) 3791 if (tmp->above && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL))
3791 check_trigger (tmp, tmp->above); 3792 check_trigger (tmp, tmp->above, tmp->above);
3792} 3793}
3793 3794
3794/** 3795/**
3795 * Handles player eating food that temporarily changes status (resistances, stats). 3796 * Handles player eating food that temporarily changes status (resistances, stats).
3796 * This used to call cast_change_attr(), but 3797 * This used to call cast_change_attr(), but

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines