--- deliantra/server/include/player.h 2006/08/29 08:01:36 1.10 +++ deliantra/server/include/player.h 2006/09/05 18:59:18 1.14 @@ -1,9 +1,4 @@ /* - * static char *rcsid_player_h = - * "$Id$"; - */ - -/* CrossFire, A Multiplayer game for X-windows Copyright (C) 2002 Mark Wedel & Crossfire Development Team @@ -27,12 +22,11 @@ */ #define NUM_OUTPUT_BUFS 5 -typedef struct { - const char *buf; /* Actual string pointer */ +struct Output_Buf { + shstr buf; /* Actual string pointer */ uint32 first_update; /* First time this message was stored */ uint16 count; /* How many times we got this message */ -} Output_Buf; - +}; /* wand/rod/horn rolled into range_misc. They all use the same body location * anyways. @@ -107,7 +101,7 @@ } partylist; // memsettable part of player -struct player_memset +struct player_pod { object *ob; /* The object representing the player */ mapstruct *loading; /* When entering a map in progress of loading, not really used */ @@ -136,7 +130,6 @@ /* Try to put all the bitfields together - saves some small amount of memory */ uint32 braced:1; /* Will not move if braced, only attack */ uint32 tmp_invis:1; /* Will invis go away when we attack ? */ - const char *invis_race; /* What race invisible to? */ uint32 do_los:1; /* If true, need to call update_los() in draw(), and clear */ uint32 fire_on:1; /* Player should fire object, not move */ uint32 run_on:1; /* Player should keep moving in dir until run is off */ @@ -202,7 +195,6 @@ /* join */ char search_str[MAX_BUF]; /* Item we are looking for */ sint16 encumbrance; /* How much our player is encumbered */ - Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */ uint16 outputs_sync; /* How often to print, no matter what */ uint16 outputs_count; /* Print if this count is exceeded */ object *mark; /* marked object */ @@ -212,11 +204,22 @@ int stack_position; /* Current stack position, 0 for no item */ }; -typedef struct pl : player_memset, attachable +typedef struct pl : zero_initialised, attachable, player_pod { - static data_type get_dt () { return DT_PLAYER; } - struct pl *next; /* Pointer to next player, NULL if this is last */ NewSocket socket; /* Socket information for this player */ + Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */ + shstr invis_race; /* What race invisible to? */ + + void clear () + { + memset (static_cast(this), 0, sizeof (player_pod)); + attachable_clear (); + invis_race = 0; + + for (int i = 0; i < NUM_OUTPUT_BUFS; i++) + outputs[i].buf = 0; + } } player; +