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 | |
33 | void |
27 | void |
34 | free_player (player *pl) |
28 | free_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 | |
59 | /* Clear item stack */ |
54 | /* Clear item stack */ |
60 | if (pl->stack_items) |
55 | if (pl->stack_items) |
61 | free (pl->stack_items); |
56 | free (pl->stack_items); |
62 | |
57 | |
63 | free (pl->socket.faces_sent); |
58 | pl->socket->status = Ns_Dead; |
|
|
59 | pl->socket->pl = 0; |
64 | |
60 | |
65 | delete pl; |
61 | delete pl; |
66 | } |
62 | } |
67 | |
63 | |
68 | |
64 | |