| 1 |
root |
1.1 |
/* |
| 2 |
|
|
* static char *rcsid_player_c = |
| 3 |
elmex |
1.2 |
* "$Id$"; |
| 4 |
root |
1.1 |
*/ |
| 5 |
|
|
|
| 6 |
|
|
/* |
| 7 |
|
|
CrossFire, A Multiplayer game for X-windows |
| 8 |
|
|
|
| 9 |
|
|
Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
| 10 |
|
|
Copyright (C) 1992 Frank Tore Johansen |
| 11 |
|
|
|
| 12 |
|
|
This program is free software; you can redistribute it and/or modify |
| 13 |
|
|
it under the terms of the GNU General Public License as published by |
| 14 |
|
|
the Free Software Foundation; either version 2 of the License, or |
| 15 |
|
|
(at your option) any later version. |
| 16 |
|
|
|
| 17 |
|
|
This program is distributed in the hope that it will be useful, |
| 18 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
|
|
GNU General Public License for more details. |
| 21 |
|
|
|
| 22 |
|
|
You should have received a copy of the GNU General Public License |
| 23 |
|
|
along with this program; if not, write to the Free Software |
| 24 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 25 |
|
|
|
| 26 |
|
|
The authors can be reached via e-mail at crossfire-devel@real-time.com |
| 27 |
|
|
*/ |
| 28 |
|
|
|
| 29 |
|
|
#include <global.h> |
| 30 |
|
|
#include <funcpoint.h> |
| 31 |
|
|
|
| 32 |
|
|
void free_player(player *pl) { |
| 33 |
|
|
|
| 34 |
|
|
if (first_player!=pl) { |
| 35 |
|
|
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 |
|
|
|
| 45 |
|
|
if(pl->ob != NULL) { |
| 46 |
|
|
if (!QUERY_FLAG(pl->ob, FLAG_REMOVED)) remove_ob(pl->ob); |
| 47 |
|
|
free_object(pl->ob); |
| 48 |
|
|
} |
| 49 |
|
|
/* Clear item stack */ |
| 50 |
|
|
if (pl->stack_items) free( pl->stack_items ); |
| 51 |
|
|
|
| 52 |
|
|
free(pl->socket.faces_sent); |
| 53 |
|
|
|
| 54 |
|
|
CFREE(pl); |
| 55 |
|
|
} |
| 56 |
|
|
|
| 57 |
|
|
|
| 58 |
|
|
/* Determine if the attacktype represented by the |
| 59 |
|
|
* specified attack-number is enabled for dragon players. |
| 60 |
|
|
* A dragon player (quetzal) can gain resistances for |
| 61 |
|
|
* all enabled attacktypes. |
| 62 |
|
|
*/ |
| 63 |
|
|
int atnr_is_dragon_enabled(int attacknr) { |
| 64 |
|
|
if (attacknr == ATNR_MAGIC || attacknr == ATNR_FIRE || |
| 65 |
|
|
attacknr == ATNR_ELECTRICITY || attacknr == ATNR_COLD || |
| 66 |
|
|
attacknr == ATNR_ACID || attacknr == ATNR_POISON) |
| 67 |
|
|
return 1; |
| 68 |
|
|
return 0; |
| 69 |
|
|
} |
| 70 |
|
|
|
| 71 |
|
|
/* |
| 72 |
|
|
* returns true if the adressed object 'ob' is a player |
| 73 |
|
|
* of the dragon race. |
| 74 |
|
|
*/ |
| 75 |
|
|
int is_dragon_pl(object* op) { |
| 76 |
|
|
if (op != NULL && op->type == PLAYER && op->arch != NULL |
| 77 |
|
|
&& op->arch->clone.race != NULL && |
| 78 |
|
|
strcmp(op->arch->clone.race, "dragon")==0) |
| 79 |
|
|
return 1; |
| 80 |
|
|
return 0; |
| 81 |
|
|
} |