… | |
… | |
20 | |
20 | |
21 | 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 |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #define NUM_OUTPUT_BUFS 5 |
24 | #define NUM_OUTPUT_BUFS 5 |
25 | typedef struct { |
25 | struct Output_Buf { |
26 | shstr buf; /* Actual string pointer */ |
26 | shstr buf; /* Actual string pointer */ |
27 | uint32 first_update; /* First time this message was stored */ |
27 | uint32 first_update; /* First time this message was stored */ |
28 | uint16 count; /* How many times we got this message */ |
28 | uint16 count; /* How many times we got this message */ |
29 | } Output_Buf; |
29 | }; |
30 | |
|
|
31 | |
30 | |
32 | /* 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 |
33 | * anyways. |
32 | * anyways. |
34 | */ |
33 | */ |
35 | enum rangetype { |
34 | enum rangetype { |
… | |
… | |
100 | sint64 total_exp; |
99 | sint64 total_exp; |
101 | uint32 kills; |
100 | uint32 kills; |
102 | } partylist; |
101 | } partylist; |
103 | |
102 | |
104 | // memsettable part of player |
103 | // memsettable part of player |
105 | struct player_memset : zero_initialised |
104 | struct player_pod |
106 | { |
105 | { |
107 | object *ob; /* The object representing the player */ |
106 | object *ob; /* The object representing the player */ |
108 | 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 */ |
109 | rangetype shoottype; /* Which range-attack is being used by player */ |
108 | rangetype shoottype; /* Which range-attack is being used by player */ |
110 | bowtype_t bowtype; /* which firemode? */ |
109 | bowtype_t bowtype; /* which firemode? */ |
… | |
… | |
129 | sint8 last_level; /* Last level we sent to client */ |
128 | sint8 last_level; /* Last level we sent to client */ |
130 | |
129 | |
131 | /* 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 */ |
132 | uint32 braced:1; /* Will not move if braced, only attack */ |
131 | uint32 braced:1; /* Will not move if braced, only attack */ |
133 | uint32 tmp_invis:1; /* Will invis go away when we attack ? */ |
132 | uint32 tmp_invis:1; /* Will invis go away when we attack ? */ |
134 | shstr invis_race; /* What race invisible to? */ |
|
|
135 | 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 */ |
136 | uint32 fire_on:1; /* Player should fire object, not move */ |
134 | uint32 fire_on:1; /* Player should fire object, not move */ |
137 | 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 */ |
138 | 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 */ |
139 | 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. */ |
… | |
… | |
195 | /* but we will have to get password first */ |
193 | /* but we will have to get password first */ |
196 | /* so we have to remember which party to */ |
194 | /* so we have to remember which party to */ |
197 | /* join */ |
195 | /* join */ |
198 | char search_str[MAX_BUF]; /* Item we are looking for */ |
196 | char search_str[MAX_BUF]; /* Item we are looking for */ |
199 | sint16 encumbrance; /* How much our player is encumbered */ |
197 | sint16 encumbrance; /* How much our player is encumbered */ |
200 | Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */ |
|
|
201 | uint16 outputs_sync; /* How often to print, no matter what */ |
198 | uint16 outputs_sync; /* How often to print, no matter what */ |
202 | uint16 outputs_count; /* Print if this count is exceeded */ |
199 | uint16 outputs_count; /* Print if this count is exceeded */ |
203 | object *mark; /* marked object */ |
200 | object *mark; /* marked object */ |
204 | uint32 mark_count; /* count of mark object */ |
201 | uint32 mark_count; /* count of mark object */ |
205 | /* Special DM fields */ |
202 | /* Special DM fields */ |
206 | tag_t* stack_items; /* Item stack for patch/dump/... commands */ |
203 | tag_t* stack_items; /* Item stack for patch/dump/... commands */ |
207 | int stack_position; /* Current stack position, 0 for no item */ |
204 | int stack_position; /* Current stack position, 0 for no item */ |
208 | }; |
205 | }; |
209 | |
206 | |
210 | typedef struct pl : player_memset, attachable<struct pl> |
207 | typedef struct pl : zero_initialised, attachable<struct pl>, player_pod |
211 | { |
208 | { |
212 | static data_type get_dt () { return DT_PLAYER; } |
|
|
213 | |
|
|
214 | struct pl *next; /* Pointer to next player, NULL if this is last */ |
209 | struct pl *next; /* Pointer to next player, NULL if this is last */ |
215 | NewSocket socket; /* Socket information for this player */ |
210 | NewSocket socket; /* Socket information for this player */ |
|
|
211 | Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */ |
|
|
212 | shstr invis_race; /* What race invisible to? */ |
|
|
213 | |
|
|
214 | void clear () |
|
|
215 | { |
|
|
216 | memset (static_cast<player_pod *>(this), 0, sizeof (player_pod)); |
|
|
217 | attachable_clear (); |
|
|
218 | invis_race = 0; |
|
|
219 | |
|
|
220 | for (int i = 0; i < NUM_OUTPUT_BUFS; i++) |
|
|
221 | outputs[i].buf = 0; |
|
|
222 | } |
216 | } player; |
223 | } player; |
217 | |
224 | |
|
|
225 | |