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.1 by elmex, Sun Aug 13 17:16:00 2006 UTC vs.
Revision 1.4 by root, Sun Sep 10 16:00:23 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines