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.3 by root, Sun Sep 3 08:05:39 2006 UTC vs.
Revision 1.6 by root, Wed Sep 27 00:36:08 2006 UTC

1/*
2 * static char *rcsid_player_c =
3 * "$Id: player.C,v 1.3 2006/09/03 08:05:39 root 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 26
27void
32void free_player(player *pl) { 28free_player (player *pl)
29{
33 30
34 if (first_player!=pl) { 31 if (first_player != pl)
32 {
35 player *prev=first_player; 33 player *prev = first_player;
34
36 while(prev!=NULL&&prev->next!=NULL&&prev->next!=pl) 35 while (prev != NULL && prev->next != NULL && prev->next != pl)
37 prev=prev->next; 36 prev = prev->next;
37
38 if(prev->next!=pl) { 38 if (prev->next != pl)
39 {
39 LOG(llevError,"Free_player: Can't find previous player.\n"); 40 LOG (llevError, "Free_player: Can't find previous player.\n");
40 exit(1); 41 exit (1);
41 } 42 }
42 prev->next=pl->next;
43 } else first_player=pl->next;
44 43
45 if(pl->ob != NULL) { 44 prev->next = pl->next;
46 if (!QUERY_FLAG(pl->ob, FLAG_REMOVED)) remove_ob(pl->ob);
47 free_object(pl->ob);
48 } 45 }
49 /* Clear item stack */ 46 else
50 if (pl->stack_items) free( pl->stack_items ); 47 first_player = pl->next;
51 48
52 free(pl->socket.faces_sent); 49 if (pl->ob)
50 {
51 if (!QUERY_FLAG (pl->ob, FLAG_REMOVED))
52 remove_ob (pl->ob);
53 53
54 pl->ob->contr = 0;
55 pl->ob->destroy ();
56 }
57
58 /* Clear item stack */
59 if (pl->stack_items)
60 free (pl->stack_items);
61
62 free (pl->socket.faces_sent);
63
54 delete pl; 64 delete pl;
55} 65}
56 66
57 67
58/* Determine if the attacktype represented by the 68/* Determine if the attacktype represented by the
59 * specified attack-number is enabled for dragon players. 69 * specified attack-number is enabled for dragon players.
60 * A dragon player (quetzal) can gain resistances for 70 * A dragon player (quetzal) can gain resistances for
61 * all enabled attacktypes. 71 * all enabled attacktypes.
62 */ 72 */
73int
63int atnr_is_dragon_enabled(int attacknr) { 74atnr_is_dragon_enabled (int attacknr)
75{
64 if (attacknr == ATNR_MAGIC || attacknr == ATNR_FIRE || 76 if (attacknr == ATNR_MAGIC || attacknr == ATNR_FIRE ||
65 attacknr == ATNR_ELECTRICITY || attacknr == ATNR_COLD || 77 attacknr == ATNR_ELECTRICITY || attacknr == ATNR_COLD || attacknr == ATNR_ACID || attacknr == ATNR_POISON)
66 attacknr == ATNR_ACID || attacknr == ATNR_POISON)
67 return 1; 78 return 1;
68 return 0; 79 return 0;
69} 80}
70 81
71/* 82/*
72 * returns true if the adressed object 'ob' is a player 83 * returns true if the adressed object 'ob' is a player
73 * of the dragon race. 84 * of the dragon race.
74 */ 85 */
86int
75int is_dragon_pl(const object* op) { 87is_dragon_pl (const object *op)
76 if (op != NULL && op->type == PLAYER && op->arch != NULL 88{
77 && op->arch->clone.race != NULL && 89 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; 90 return 1;
80 return 0; 91 return 0;
81} 92}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines