ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/player.C
Revision: 1.4
Committed: Sun Sep 10 16:00:23 2006 UTC (17 years, 8 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.3: +38 -26 lines
Log Message:
indent

File Contents

# User Rev Content
1 root 1.4
2 elmex 1.1 /*
3     * static char *rcsid_player_c =
4 root 1.4 * "$Id: player.C,v 1.3 2006-09-03 08:05:39 root Exp $";
5 elmex 1.1 */
6    
7     /*
8     CrossFire, A Multiplayer game for X-windows
9    
10     Copyright (C) 2002 Mark Wedel & Crossfire Development Team
11     Copyright (C) 1992 Frank Tore Johansen
12    
13     This program is free software; you can redistribute it and/or modify
14     it under the terms of the GNU General Public License as published by
15     the Free Software Foundation; either version 2 of the License, or
16     (at your option) any later version.
17    
18     This program is distributed in the hope that it will be useful,
19     but WITHOUT ANY WARRANTY; without even the implied warranty of
20     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21     GNU General Public License for more details.
22    
23     You should have received a copy of the GNU General Public License
24     along with this program; if not, write to the Free Software
25     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26    
27     The authors can be reached via e-mail at crossfire-devel@real-time.com
28     */
29    
30     #include <global.h>
31     #include <funcpoint.h>
32    
33 root 1.4 void
34     free_player (player *pl)
35     {
36    
37     if (first_player != pl)
38     {
39     player *prev = first_player;
40    
41     while (prev != NULL && prev->next != NULL && prev->next != pl)
42     prev = prev->next;
43     if (prev->next != pl)
44     {
45     LOG (llevError, "Free_player: Can't find previous player.\n");
46     exit (1);
47 root 1.2 }
48 root 1.4 prev->next = pl->next;
49     }
50     else
51     first_player = pl->next;
52 elmex 1.1
53 root 1.4 if (pl->ob != NULL)
54     {
55     if (!QUERY_FLAG (pl->ob, FLAG_REMOVED))
56     remove_ob (pl->ob);
57     free_object (pl->ob);
58 elmex 1.1 }
59 root 1.4 /* Clear item stack */
60     if (pl->stack_items)
61     free (pl->stack_items);
62 elmex 1.1
63 root 1.4 free (pl->socket.faces_sent);
64 elmex 1.1
65 root 1.4 delete pl;
66 elmex 1.1 }
67    
68    
69     /* Determine if the attacktype represented by the
70     * specified attack-number is enabled for dragon players.
71     * A dragon player (quetzal) can gain resistances for
72     * all enabled attacktypes.
73     */
74 root 1.4 int
75     atnr_is_dragon_enabled (int attacknr)
76     {
77 elmex 1.1 if (attacknr == ATNR_MAGIC || attacknr == ATNR_FIRE ||
78 root 1.4 attacknr == ATNR_ELECTRICITY || attacknr == ATNR_COLD || attacknr == ATNR_ACID || attacknr == ATNR_POISON)
79 elmex 1.1 return 1;
80     return 0;
81     }
82    
83     /*
84     * returns true if the adressed object 'ob' is a player
85     * of the dragon race.
86     */
87 root 1.4 int
88     is_dragon_pl (const object *op)
89     {
90     if (op != NULL && op->type == PLAYER && op->arch != NULL && op->arch->clone.race != NULL && strcmp (op->arch->clone.race, "dragon") == 0)
91 elmex 1.1 return 1;
92     return 0;
93     }