… | |
… | |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #include <global.h> |
24 | #include <global.h> |
25 | #include <funcpoint.h> |
25 | #include <funcpoint.h> |
26 | |
|
|
27 | void |
|
|
28 | free_player (player *pl) |
|
|
29 | { |
|
|
30 | if (first_player != pl) |
|
|
31 | { |
|
|
32 | player *prev = first_player; |
|
|
33 | |
|
|
34 | while (prev != NULL && prev->next != NULL && prev->next != pl) |
|
|
35 | prev = prev->next; |
|
|
36 | |
|
|
37 | if (prev->next != pl) |
|
|
38 | { |
|
|
39 | LOG (llevError, "Free_player: Can't find previous player.\n"); |
|
|
40 | exit (1); |
|
|
41 | } |
|
|
42 | |
|
|
43 | prev->next = pl->next; |
|
|
44 | } |
|
|
45 | else |
|
|
46 | first_player = pl->next; |
|
|
47 | |
|
|
48 | if (pl->ob) |
|
|
49 | { |
|
|
50 | pl->ob->contr = 0; |
|
|
51 | pl->ob->destroy (); |
|
|
52 | } |
|
|
53 | |
|
|
54 | if (pl->ns) |
|
|
55 | { |
|
|
56 | pl->ns->send_packet ("goodbye"); |
|
|
57 | pl->ns->flush (); |
|
|
58 | pl->ns->pl = 0; |
|
|
59 | pl->ns->destroy (); |
|
|
60 | } |
|
|
61 | |
|
|
62 | /* Clear item stack */ |
|
|
63 | if (pl->stack_items) |
|
|
64 | free (pl->stack_items); |
|
|
65 | |
|
|
66 | delete pl; |
|
|
67 | } |
|
|
68 | |
|
|
69 | |
26 | |
70 | /* Determine if the attacktype represented by the |
27 | /* Determine if the attacktype represented by the |
71 | * specified attack-number is enabled for dragon players. |
28 | * specified attack-number is enabled for dragon players. |
72 | * A dragon player (quetzal) can gain resistances for |
29 | * A dragon player (quetzal) can gain resistances for |
73 | * all enabled attacktypes. |
30 | * all enabled attacktypes. |