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

Comparing deliantra/server/common/player.C (file contents):
Revision 1.1 by elmex, Sun Aug 13 17:16:00 2006 UTC vs.
Revision 1.12 by root, Fri Dec 22 16:34:00 2006 UTC

1/*
2 * static char *rcsid_player_c =
3 * "$Id: player.C,v 1.1 2006/08/13 17:16:00 elmex Exp $";
4 */
5
6/* 1/*
7 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
8 3
9 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
10 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
21 16
22 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
24 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 20
26 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at <crossfire@schmorp.de>
27*/ 22*/
28 23
29#include <global.h> 24#include <global.h>
30#include <funcpoint.h> 25#include <funcpoint.h>
31
32void free_player(player *pl) {
33
34 if (first_player!=pl) {
35 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 } else first_player=pl->next;
44
45 if(pl->ob != NULL) {
46 if (!QUERY_FLAG(pl->ob, FLAG_REMOVED)) remove_ob(pl->ob);
47 free_object(pl->ob);
48 }
49 /* Clear item stack */
50 if (pl->stack_items) free( pl->stack_items );
51
52 free(pl->socket.faces_sent);
53
54 CFREE(pl);
55}
56
57 26
58/* Determine if the attacktype represented by the 27/* Determine if the attacktype represented by the
59 * specified attack-number is enabled for dragon players. 28 * specified attack-number is enabled for dragon players.
60 * A dragon player (quetzal) can gain resistances for 29 * A dragon player (quetzal) can gain resistances for
61 * all enabled attacktypes. 30 * all enabled attacktypes.
62 */ 31 */
32int
63int atnr_is_dragon_enabled(int attacknr) { 33atnr_is_dragon_enabled (int attacknr)
34{
64 if (attacknr == ATNR_MAGIC || attacknr == ATNR_FIRE || 35 if (attacknr == ATNR_MAGIC || attacknr == ATNR_FIRE ||
65 attacknr == ATNR_ELECTRICITY || attacknr == ATNR_COLD || 36 attacknr == ATNR_ELECTRICITY || attacknr == ATNR_COLD || attacknr == ATNR_ACID || attacknr == ATNR_POISON)
66 attacknr == ATNR_ACID || attacknr == ATNR_POISON)
67 return 1; 37 return 1;
38
68 return 0; 39 return 0;
69} 40}
70 41
71/* 42/*
72 * returns true if the adressed object 'ob' is a player 43 * returns true if the adressed object 'ob' is a player
73 * of the dragon race. 44 * of the dragon race.
74 */ 45 */
46int
75int is_dragon_pl(const object* op) { 47is_dragon_pl (const object *op)
76 if (op != NULL && op->type == PLAYER && op->arch != NULL 48{
77 && op->arch->clone.race != NULL && 49 if (op != NULL && op->type == PLAYER && op->arch != NULL && op->arch->clone.race != NULL && strcmp (op->arch->clone.race, "dragon") == 0)
78 strcmp(op->arch->clone.race, "dragon")==0)
79 return 1; 50 return 1;
80 return 0; 51 return 0;
81} 52}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines