ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/player.C
(Generate patch)

Comparing deliantra/server/server/player.C (file contents):
Revision 1.6 by root, Sat Aug 26 23:36:34 2006 UTC vs.
Revision 1.7 by root, Sun Aug 27 16:15:13 2006 UTC

1/* 1/*
2 * static char *rcsid_player_c = 2 * static char *rcsid_player_c =
3 * "$Id: player.C,v 1.6 2006/08/26 23:36:34 root Exp $"; 3 * "$Id: player.C,v 1.7 2006/08/27 16:15:13 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
202static player* get_player(player *p) { 202static player* get_player(player *p) {
203 object *op=arch_to_object(get_player_archetype(NULL)); 203 object *op=arch_to_object(get_player_archetype(NULL));
204 int i; 204 int i;
205 205
206 if (!p) { 206 if (!p) {
207 player *tmp;
208
209 p = (player *) malloc(sizeof(player)); 207 p = (player *) malloc(sizeof(player));
210 if(p==NULL) 208 if(p==NULL)
211 fatal(OUT_OF_MEMORY); 209 fatal(OUT_OF_MEMORY);
212 210
213 /* This adds the player in the linked list. There is extra 211 /* This adds the player in the linked list. There is extra
214 * complexity here because we want to add the new player at the 212 * complexity here because we want to add the new player at the
215 * end of the list - there is in fact no compelling reason that 213 * end of the list - there is in fact no compelling reason that
216 * that needs to be done except for things like output of 214 * that needs to be done except for things like output of
217 * 'who'. 215 * 'who'.
218 */ 216 */
219 tmp=first_player; 217 player *tmp = first_player;
220 while(tmp!=NULL&&tmp->next!=NULL) 218 while(tmp!=NULL&&tmp->next!=NULL)
221 tmp=tmp->next; 219 tmp=tmp->next;
222 if(tmp!=NULL) 220 if(tmp!=NULL)
223 tmp->next=p; 221 tmp->next=p;
224 else 222 else
229 227
230 /* Clears basically the entire player structure except 228 /* Clears basically the entire player structure except
231 * for next and socket. 229 * for next and socket.
232 */ 230 */
233 memset (static_cast<player_memset *>(p), 0, sizeof (player_memset)); 231 memset (static_cast<player_memset *>(p), 0, sizeof (player_memset));
232 p->extendable_init (); //HACK
234 233
235 /* There are some elements we want initialized to non zero value - 234 /* There are some elements we want initialized to non zero value -
236 * we deal with that below this point. 235 * we deal with that below this point.
237 */ 236 */
238 p->party=NULL; 237 p->party=NULL;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines