… | |
… | |
108 | uint32 kills; |
108 | uint32 kills; |
109 | }; |
109 | }; |
110 | |
110 | |
111 | ACC_CLASS (player) |
111 | ACC_CLASS (player) |
112 | |
112 | |
113 | // memsettable part of player |
113 | struct player : zero_initialised, refcounted, attachable<player> |
114 | struct player_pod |
|
|
115 | { |
114 | { |
|
|
115 | player *ACC (RW, next); /* Pointer to next player, NULL if this is last */ |
|
|
116 | client *ACC (RO, ns); /* Socket information for this player */ |
116 | object_ptr ACC (RW, ob); /* The object representing the player */ |
117 | object_ptr ACC (RW, ob); /* The object representing the player */ |
117 | maptile *loading; /* When entering a map in progress of loading, not really used */ |
118 | maptile *loading; /* When entering a map in progress of loading, not really used */ |
118 | rangetype shoottype; /* Which range-attack is being used by player */ |
119 | rangetype shoottype; /* Which range-attack is being used by player */ |
119 | bowtype_t bowtype; /* which firemode? */ |
120 | bowtype_t bowtype; /* which firemode? */ |
120 | petmode_t petmode; /* which petmode? */ |
121 | petmode_t petmode; /* which petmode? */ |
… | |
… | |
140 | uint32 ACC (RO, tmp_invis):1; /* Will invis go away when we attack ? */ |
141 | uint32 ACC (RO, tmp_invis):1; /* Will invis go away when we attack ? */ |
141 | uint32 ACC (RO, do_los):1; /* If true, need to call update_los() in draw(), and clear */ |
142 | uint32 ACC (RO, do_los):1; /* If true, need to call update_los() in draw(), and clear */ |
142 | uint32 ACC (RO, fire_on):1; /* Player should fire object, not move */ |
143 | uint32 ACC (RO, fire_on):1; /* Player should fire object, not move */ |
143 | uint32 ACC (RO, run_on):1; /* Player should keep moving in dir until run is off */ |
144 | uint32 ACC (RO, run_on):1; /* Player should keep moving in dir until run is off */ |
144 | uint32 ACC (RO, has_hit):1; /* If set, weapon_sp instead of speed will count */ |
145 | uint32 ACC (RO, has_hit):1; /* If set, weapon_sp instead of speed will count */ |
145 | uint32 ACC (RO, name_changed):1; /* If true, the player has set a name. */ |
|
|
146 | uint32 ACC (RO, peaceful):1; /* If set, won't attack friendly creatures */ |
146 | uint32 ACC (RO, peaceful):1; /* If set, won't attack friendly creatures */ |
147 | uint32 ACC (RO, hidden):1; /* If True, player (DM) is hidden from view */ |
147 | uint32 ACC (RO, hidden):1; /* If True, player (DM) is hidden from view */ |
148 | uint32 ACC (RO, explore):1; /* if True, player is in explore mode */ |
148 | uint32 ACC (RO, explore):1; /* if True, player is in explore mode */ |
149 | |
149 | |
150 | object_ptr last_skill_ob[NUM_SKILLS]; /* the exp object */ |
150 | object_ptr last_skill_ob[NUM_SKILLS]; /* the exp object */ |
… | |
… | |
196 | object_ptr ACC (RW, mark); /* marked object */ |
196 | object_ptr ACC (RW, mark); /* marked object */ |
197 | /* Special DM fields */ |
197 | /* Special DM fields */ |
198 | tag_t *stack_items; /* Item stack for patch/dump/... commands */ |
198 | tag_t *stack_items; /* Item stack for patch/dump/... commands */ |
199 | int ACC (RW, stack_position); /* Current stack position, 0 for no item */ |
199 | int ACC (RW, stack_position); /* Current stack position, 0 for no item */ |
200 | sint8 blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]; /* array showing what spaces */ |
200 | sint8 blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]; /* array showing what spaces */ |
201 | /* the player can see. For maps smaller than */ |
201 | /* the player can see. For maps smaller than */ |
202 | /* MAP_CLIENT_.., the upper left is used */ |
202 | /* MAP_CLIENT_.., the upper left is used */ |
203 | }; |
|
|
204 | |
203 | |
205 | struct player : zero_initialised, attachable<player>, player_pod |
|
|
206 | { |
|
|
207 | player *ACC (RW, next); /* Pointer to next player, NULL if this is last */ |
|
|
208 | client *ACC (RO, ns); /* Socket information for this player */ |
|
|
209 | shstr ACC (RW, invis_race); /* What race invisible to? */ |
204 | shstr ACC (RW, invis_race); /* What race invisible to? */ |
210 | bool ACC (RW, enable_save); |
205 | bool ACC (RW, enable_save); |
211 | Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */ |
206 | Output_Buf outputs[NUM_OUTPUT_BUFS]; /* holds output strings to client */ |
212 | |
207 | |
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 | } |
|
|
222 | |
|
|
223 | static player *create (); |
208 | static player *create (); |
224 | static player *load (const char *path); |
209 | static player *load (const char *path); |
225 | void save (bool final = false); |
210 | void save (bool final = false); |
226 | |
211 | |
227 | void connect (client *ns); |
212 | void connect (client *ns); |