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.4 by root, Sun Sep 10 16:00:23 2006 UTC vs.
Revision 1.10 by root, Sat Dec 16 03:08:25 2006 UTC

1
2/*
3 * static char *rcsid_player_c =
4 * "$Id: player.C,v 1.4 2006/09/10 16:00:23 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
22 16
23 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
24 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 20
27 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>
28*/ 22*/
29 23
30#include <global.h> 24#include <global.h>
31#include <funcpoint.h> 25#include <funcpoint.h>
32 26
33void 27void
34free_player (player *pl) 28free_player (player *pl)
35{ 29{
36
37 if (first_player != pl) 30 if (first_player != pl)
38 { 31 {
39 player *prev = first_player; 32 player *prev = first_player;
40 33
41 while (prev != NULL && prev->next != NULL && prev->next != pl) 34 while (prev != NULL && prev->next != NULL && prev->next != pl)
42 prev = prev->next; 35 prev = prev->next;
36
43 if (prev->next != pl) 37 if (prev->next != pl)
44 { 38 {
45 LOG (llevError, "Free_player: Can't find previous player.\n"); 39 LOG (llevError, "Free_player: Can't find previous player.\n");
46 exit (1); 40 exit (1);
47 } 41 }
42
48 prev->next = pl->next; 43 prev->next = pl->next;
49 } 44 }
50 else 45 else
51 first_player = pl->next; 46 first_player = pl->next;
52 47
53 if (pl->ob != NULL) 48 if (pl->ob)
54 { 49 {
55 if (!QUERY_FLAG (pl->ob, FLAG_REMOVED)) 50 pl->ob->contr = 0;
56 remove_ob (pl->ob); 51 pl->ob->destroy ();
57 free_object (pl->ob);
58 } 52 }
53
54 if (pl->socket)
55 {
56 pl->socket->pl = 0;
57 pl->socket->send_packet ("goodbye");
58 pl->socket->destroy ();
59 }
60
59 /* Clear item stack */ 61 /* Clear item stack */
60 if (pl->stack_items) 62 if (pl->stack_items)
61 free (pl->stack_items); 63 free (pl->stack_items);
62
63 free (pl->socket.faces_sent);
64 64
65 delete pl; 65 delete pl;
66} 66}
67 67
68 68
75atnr_is_dragon_enabled (int attacknr) 75atnr_is_dragon_enabled (int attacknr)
76{ 76{
77 if (attacknr == ATNR_MAGIC || attacknr == ATNR_FIRE || 77 if (attacknr == ATNR_MAGIC || attacknr == ATNR_FIRE ||
78 attacknr == ATNR_ELECTRICITY || attacknr == ATNR_COLD || attacknr == ATNR_ACID || attacknr == ATNR_POISON) 78 attacknr == ATNR_ELECTRICITY || attacknr == ATNR_COLD || attacknr == ATNR_ACID || attacknr == ATNR_POISON)
79 return 1; 79 return 1;
80
80 return 0; 81 return 0;
81} 82}
82 83
83/* 84/*
84 * returns true if the adressed object 'ob' is a player 85 * returns true if the adressed object 'ob' is a player

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines