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.2 by root, Tue Aug 29 08:01:35 2006 UTC vs.
Revision 1.13 by pippijn, Sat Jan 6 14:42:29 2007 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines