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

Comparing deliantra/server/include/player.h (file contents):
Revision 1.10 by root, Tue Aug 29 08:01:36 2006 UTC vs.
Revision 1.15 by root, Fri Sep 8 16:51:44 2006 UTC

1/*
2 * static char *rcsid_player_h =
3 * "$Id: player.h,v 1.10 2006/08/29 08:01:36 root Exp $";
4 */
5
6/* 1/*
7 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
8 3
9 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
10 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
25 20
26 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at crossfire-devel@real-time.com
27*/ 22*/
28 23
29#define NUM_OUTPUT_BUFS 5 24#define NUM_OUTPUT_BUFS 5
30typedef struct { 25struct Output_Buf {
31 const char *buf; /* Actual string pointer */ 26 shstr buf; /* Actual string pointer */
32 uint32 first_update; /* First time this message was stored */ 27 uint32 first_update; /* First time this message was stored */
33 uint16 count; /* How many times we got this message */ 28 uint16 count; /* How many times we got this message */
34} Output_Buf; 29};
35
36 30
37/* wand/rod/horn rolled into range_misc. They all use the same body location 31/* wand/rod/horn rolled into range_misc. They all use the same body location
38 * anyways. 32 * anyways.
39 */ 33 */
40enum rangetype { 34enum rangetype {
105 sint64 total_exp; 99 sint64 total_exp;
106 uint32 kills; 100 uint32 kills;
107} partylist; 101} partylist;
108 102
109// memsettable part of player 103// memsettable part of player
110struct player_memset 104struct player_pod
111{ 105{
112 object *ob; /* The object representing the player */ 106 object *ob; /* The object representing the player */
113 mapstruct *loading; /* When entering a map in progress of loading, not really used */ 107 mapstruct *loading; /* When entering a map in progress of loading, not really used */
114 rangetype shoottype; /* Which range-attack is being used by player */ 108 rangetype shoottype; /* Which range-attack is being used by player */
115 bowtype_t bowtype; /* which firemode? */ 109 bowtype_t bowtype; /* which firemode? */
134 sint8 last_level; /* Last level we sent to client */ 128 sint8 last_level; /* Last level we sent to client */
135 129
136 /* Try to put all the bitfields together - saves some small amount of memory */ 130 /* Try to put all the bitfields together - saves some small amount of memory */
137 uint32 braced:1; /* Will not move if braced, only attack */ 131 uint32 braced:1; /* Will not move if braced, only attack */
138 uint32 tmp_invis:1; /* Will invis go away when we attack ? */ 132 uint32 tmp_invis:1; /* Will invis go away when we attack ? */
139 const char *invis_race; /* What race invisible to? */
140 uint32 do_los:1; /* If true, need to call update_los() in draw(), and clear */ 133 uint32 do_los:1; /* If true, need to call update_los() in draw(), and clear */
141 uint32 fire_on:1; /* Player should fire object, not move */ 134 uint32 fire_on:1; /* Player should fire object, not move */
142 uint32 run_on:1; /* Player should keep moving in dir until run is off */ 135 uint32 run_on:1; /* Player should keep moving in dir until run is off */
143 uint32 has_hit:1; /* If set, weapon_sp instead of speed will count */ 136 uint32 has_hit:1; /* If set, weapon_sp instead of speed will count */
144 uint32 name_changed:1; /* If true, the player has set a name. */ 137 uint32 name_changed:1; /* If true, the player has set a name. */
181 sint8 levhp[11]; /* What the player gained on that level */ 174 sint8 levhp[11]; /* What the player gained on that level */
182 sint8 levsp[11]; /* Same for sp */ 175 sint8 levsp[11]; /* Same for sp */
183 sint8 levgrace[11]; /* And same for grace */ 176 sint8 levgrace[11]; /* And same for grace */
184 177
185 char killer[BIG_NAME]; /* Who killed this player. */ 178 char killer[BIG_NAME]; /* Who killed this player. */
186 char last_tell[MAX_NAME]; /* last player that told you something [mids 01/14/2002] */
187 179
188 char write_buf[MAX_BUF]; /* Holds arbitrary input from client */ 180 char write_buf[MAX_BUF]; /* Holds arbitrary input from client */
189 char input_buf[MAX_BUF]; /* Holds command to run */ 181 char input_buf[MAX_BUF]; /* Holds command to run */
190 char password[16]; /* 2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16 */ 182 char password[16]; /* 2 (seed) + 11 (crypted) + 1 (EOS) + 2 (safety) = 16 */
191 183
200 /* but we will have to get password first */ 192 /* but we will have to get password first */
201 /* so we have to remember which party to */ 193 /* so we have to remember which party to */
202 /* join */ 194 /* join */
203 char search_str[MAX_BUF]; /* Item we are looking for */ 195 char search_str[MAX_BUF]; /* Item we are looking for */
204 sint16 encumbrance; /* How much our player is encumbered */ 196 sint16 encumbrance; /* How much our player is encumbered */
205 Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */
206 uint16 outputs_sync; /* How often to print, no matter what */ 197 uint16 outputs_sync; /* How often to print, no matter what */
207 uint16 outputs_count; /* Print if this count is exceeded */ 198 uint16 outputs_count; /* Print if this count is exceeded */
208 object *mark; /* marked object */ 199 object *mark; /* marked object */
209 uint32 mark_count; /* count of mark object */ 200 uint32 mark_count; /* count of mark object */
210 /* Special DM fields */ 201 /* Special DM fields */
211 tag_t* stack_items; /* Item stack for patch/dump/... commands */ 202 tag_t* stack_items; /* Item stack for patch/dump/... commands */
212 int stack_position; /* Current stack position, 0 for no item */ 203 int stack_position; /* Current stack position, 0 for no item */
213}; 204};
214 205
215typedef struct pl : player_memset, attachable<struct pl> 206typedef struct pl : zero_initialised, attachable<struct pl>, player_pod
216{ 207{
217 static data_type get_dt () { return DT_PLAYER; }
218
219 struct pl *next; /* Pointer to next player, NULL if this is last */ 208 struct pl *next; /* Pointer to next player, NULL if this is last */
220 NewSocket socket; /* Socket information for this player */ 209 NewSocket socket; /* Socket information for this player */
210 Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */
211 shstr invis_race; /* What race invisible to? */
212
213 void clear ()
214 {
215 memset (static_cast<player_pod *>(this), 0, sizeof (player_pod));
216 attachable_clear ();
217 invis_race = 0;
218
219 for (int i = 0; i < NUM_OUTPUT_BUFS; i++)
220 outputs[i].buf = 0;
221 }
221} player; 222} player;
222 223
224

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines