ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/player.C
Revision: 1.3
Committed: Sun Sep 3 08:05:39 2006 UTC (17 years, 8 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.2: +2 -2 lines
Log Message:
for some unexplicable reasons, it seems to run after fixing the obvious errors

File Contents

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