1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
|
|
4 | * Copyright (©) 2018 Marc Alexander Lehmann / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
8 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
12 | * option) any later version. |
12 | * |
13 | * |
13 | * This program is distributed in the hope that it will be useful, |
14 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
17 | * GNU General Public License for more details. |
17 | * |
18 | * |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * You should have received a copy of the Affero GNU General Public License |
19 | * and the GNU General Public License along with this program. If not, see |
20 | * and the GNU General Public License along with this program. If not, see |
20 | * <http://www.gnu.org/licenses/>. |
21 | * <http://www.gnu.org/licenses/>. |
21 | * |
22 | * |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | * The authors can be reached via e-mail to <support@deliantra.net> |
23 | */ |
24 | */ |
24 | |
25 | |
25 | /** |
26 | /** |
26 | * \file |
27 | * \file |
… | |
… | |
46 | * |
47 | * |
47 | ******************************************************************************/ |
48 | ******************************************************************************/ |
48 | |
49 | |
49 | /** |
50 | /** |
50 | * This is a similar to query_name, but returns flags |
51 | * This is a similar to query_name, but returns flags |
51 | * to be sent to client. |
52 | * to be sent to client. |
52 | */ |
53 | */ |
53 | unsigned int |
54 | static unsigned int |
54 | query_flags (object *op) |
55 | query_flags (object *op) |
55 | { |
56 | { |
56 | unsigned int flags = 0; |
57 | unsigned int flags = 0; |
57 | |
58 | |
58 | if (QUERY_FLAG (op, FLAG_APPLIED)) |
59 | if (op->flag [FLAG_APPLIED]) |
59 | switch (op->type) |
60 | switch (op->type) |
60 | { |
61 | { |
61 | case BOW: |
62 | case BOW: |
62 | case WAND: |
63 | case WAND: |
63 | case ROD: |
64 | case ROD: |
… | |
… | |
86 | default: |
87 | default: |
87 | flags = a_applied; |
88 | flags = a_applied; |
88 | break; |
89 | break; |
89 | } |
90 | } |
90 | |
91 | |
91 | if (op->type == CONTAINER && ((op->env && op->env->container == op) || (!op->env && QUERY_FLAG (op, FLAG_APPLIED)))) |
92 | if (op->is_open_container ()) |
92 | flags |= F_OPEN; |
93 | flags |= F_OPEN; |
93 | |
94 | |
94 | if (QUERY_FLAG (op, FLAG_KNOWN_CURSED)) |
95 | if (op->flag [FLAG_KNOWN_CURSED]) |
95 | { |
96 | { |
96 | if (QUERY_FLAG (op, FLAG_DAMNED)) |
97 | if (op->flag [FLAG_DAMNED]) |
97 | flags |= F_DAMNED; |
98 | flags |= F_DAMNED; |
98 | else if (QUERY_FLAG (op, FLAG_CURSED)) |
99 | else if (op->flag [FLAG_CURSED]) |
99 | flags |= F_CURSED; |
100 | flags |= F_CURSED; |
100 | } |
101 | } |
101 | |
102 | |
102 | if (QUERY_FLAG (op, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (op, FLAG_IDENTIFIED)) |
103 | if (op->flag [FLAG_KNOWN_MAGICAL] && !op->flag [FLAG_IDENTIFIED]) |
103 | flags |= F_MAGIC; |
104 | flags |= F_MAGIC; |
104 | if (QUERY_FLAG (op, FLAG_UNPAID)) |
105 | if (op->flag [FLAG_UNPAID]) |
105 | flags |= F_UNPAID; |
106 | flags |= F_UNPAID; |
106 | if (QUERY_FLAG (op, FLAG_INV_LOCKED)) |
107 | if (op->flag [FLAG_INV_LOCKED]) |
107 | flags |= F_LOCKED; |
108 | flags |= F_LOCKED; |
108 | |
109 | |
109 | return flags; |
110 | return flags; |
110 | } |
111 | } |
111 | |
112 | |
… | |
… | |
114 | * animation of face to the client. |
115 | * animation of face to the client. |
115 | */ |
116 | */ |
116 | static void |
117 | static void |
117 | add_object_to_socklist (client &ns, packet &sl, object *head) |
118 | add_object_to_socklist (client &ns, packet &sl, object *head) |
118 | { |
119 | { |
119 | char item_n[MAX_BUF]; |
|
|
120 | const char *item_p; |
|
|
121 | |
|
|
122 | int flags = query_flags (head); |
120 | int flags = query_flags (head); |
123 | if (QUERY_FLAG (head, FLAG_NO_PICK)) |
121 | |
|
|
122 | if (head->flag [FLAG_NO_PICK]) |
124 | flags |= F_NOPICK; |
123 | flags |= F_NOPICK; |
125 | |
124 | |
126 | ns.send_face (head->face, -50); |
125 | ns.send_face (head->face, -50); |
127 | ns.flush_fx (); |
|
|
128 | |
126 | |
129 | if (QUERY_FLAG (head, FLAG_ANIMATE) && !ns.anims_sent[head->animation_id]) |
127 | if (head->flag [FLAG_ANIMATE] && !ns.anims_sent[head->animation_id]) |
130 | ns.send_animation (head->animation_id); |
128 | ns.send_animation (head->animation_id); |
131 | |
129 | |
132 | sl << uint32 (head->count) |
130 | sl << uint32 (head->count) |
133 | << uint32 (flags) |
131 | << uint32 (flags) |
134 | << uint32 (QUERY_FLAG (head, FLAG_NO_PICK) ? -1 : head->client_weight ()) |
132 | << uint32 (head->flag [FLAG_NO_PICK] ? -1 : head->client_weight ()) |
135 | << uint32 (head->face); |
133 | << uint32 (head->face); |
136 | |
134 | |
137 | int len; |
|
|
138 | |
|
|
139 | if (!head->custom_name) |
135 | if (!head->custom_name) |
140 | { |
136 | { |
141 | strncpy (item_n, query_base_name (head, 0), 127); |
137 | const char *name; |
142 | item_n[127] = 0; |
138 | uint8 *len = sl.cur++; // patch up length later |
143 | len = strlen (item_n); |
139 | |
144 | item_p = query_base_name (head, 1); |
140 | name = query_base_name (head, 0); sl << data_n (name, min (127, strlen (name))); |
|
|
141 | sl << uint8 (0); |
|
|
142 | name = query_base_name (head, 1); sl << data_n (name, min (127, strlen (name))); |
|
|
143 | |
|
|
144 | *len = sl.cur - len - 1; |
145 | } |
145 | } |
146 | else |
146 | else |
147 | { |
147 | { |
148 | strncpy (item_n, head->custom_name, 127); |
148 | int len = min (127, head->custom_name.length ()); |
149 | item_n[127] = 0; |
|
|
150 | len = strlen (item_n); |
|
|
151 | item_p = head->custom_name; |
|
|
152 | } |
|
|
153 | |
149 | |
154 | strncpy (item_n + len + 1, item_p, 127); |
150 | sl << uint8 (len * 2 + 1) |
155 | item_n[254] = 0; |
151 | << data_n (head->custom_name, len) |
156 | len += strlen (item_n + 1 + len) + 1; |
152 | << uint8 (0) |
|
|
153 | << data_n (head->custom_name, len); |
|
|
154 | } |
157 | |
155 | |
158 | sl << data8 (item_n, len) |
|
|
159 | << uint16 (head->animation_id); |
156 | sl << uint16 (head->animation_id); |
160 | |
157 | |
161 | int anim_speed = !head->flag [FLAG_ANIMATE] ? 0 |
158 | int anim_speed = !head->flag [FLAG_ANIMATE] ? 0 |
162 | : head->anim_speed ? clamp (head->anim_speed, 1, 255) |
159 | : head->anim_speed ? clamp (head->anim_speed, 1, 255) |
163 | : 1. / clamp (fabs (head->speed), 1./255., 1./1.); |
160 | : 1. / clamp (head->speed, 1./255., 1./1.); |
164 | |
161 | |
165 | sl << uint8 (anim_speed) |
162 | sl << uint8 (anim_speed) |
166 | << uint32 (head->nrof); |
163 | << uint32 (head->nrof); |
167 | |
164 | |
168 | if (ns.itemcmd == 2) |
165 | if (ns.itemcmd == 2) |
… | |
… | |
182 | |
179 | |
183 | #define FINGER_UP "finger_up.x11" |
180 | #define FINGER_UP "finger_up.x11" |
184 | #define FINGER_DOWN "finger_down.x11" |
181 | #define FINGER_DOWN "finger_down.x11" |
185 | |
182 | |
186 | /** |
183 | /** |
187 | * Send the look window. Don't need to do animations here |
184 | * Send the look window. Don't need to do animations here |
188 | * This sends all the faces to the client, not just updates. This is |
185 | * This sends all the faces to the client, not just updates. This is |
189 | * because object ordering would otherwise be inconsistent. |
186 | * because object ordering would otherwise be inconsistent. |
190 | */ |
187 | */ |
191 | void |
188 | void |
192 | esrv_draw_look (player *pl) |
189 | esrv_draw_look (player *pl) |
… | |
… | |
197 | { |
194 | { |
198 | LOG (llevDebug, "esrv_draw_look called when update_look was not set (player %s)\n", &ob->name); |
195 | LOG (llevDebug, "esrv_draw_look called when update_look was not set (player %s)\n", &ob->name); |
199 | return; |
196 | return; |
200 | } |
197 | } |
201 | |
198 | |
|
|
199 | if (pl->ns->need_delinv0) |
|
|
200 | { |
|
|
201 | pl->ns->need_delinv0 = 0; |
|
|
202 | pl->ns->send_packet ("delinv 0"); |
|
|
203 | } |
|
|
204 | |
|
|
205 | if (pl->run_on) |
|
|
206 | return; |
|
|
207 | |
202 | pl->ns->update_look = 0; |
208 | pl->ns->update_look = 0; |
|
|
209 | pl->ns->need_delinv0 = 1; |
203 | |
210 | |
204 | if (QUERY_FLAG (ob, FLAG_REMOVED) |
211 | if (ob->flag [FLAG_REMOVED] |
205 | || !ob->map |
212 | || !ob->map |
206 | || ob->map->in_memory != MAP_ACTIVE |
213 | || ob->map->state != MAP_ACTIVE |
207 | || out_of_map (ob->map, ob->x, ob->y)) |
214 | || out_of_map (ob->map, ob->x, ob->y)) |
208 | return; |
215 | return; |
209 | |
|
|
210 | pl->ns->send_packet ("delinv 0"); |
|
|
211 | |
216 | |
212 | packet sl; |
217 | packet sl; |
213 | sl.printf ("item%d ", pl->ns->itemcmd); |
218 | sl.printf ("item%d ", pl->ns->itemcmd); |
214 | |
219 | |
215 | sl << uint32 (0); |
220 | sl << uint32 (0); |
… | |
… | |
282 | dirty = true; |
287 | dirty = true; |
283 | |
288 | |
284 | // if packet got too large, send it and begin a new one |
289 | // if packet got too large, send it and begin a new one |
285 | if (sl.length () > MAXSOCKBUF - MAXITEMLEN) |
290 | if (sl.length () > MAXSOCKBUF - MAXITEMLEN) |
286 | { |
291 | { |
|
|
292 | pl->ns->flush_fx (); |
287 | pl->ns->send_packet (sl); |
293 | pl->ns->send_packet (sl); |
288 | |
294 | |
289 | sl.reset (); |
295 | sl.reset (); |
290 | sl.printf ("item%d ", pl->ns->itemcmd); |
296 | sl.printf ("item%d ", pl->ns->itemcmd); |
291 | sl << uint32 (0); |
297 | sl << uint32 (0); |
… | |
… | |
310 | |
316 | |
311 | dirty = true; |
317 | dirty = true; |
312 | } |
318 | } |
313 | |
319 | |
314 | if (dirty) |
320 | if (dirty) |
|
|
321 | { |
|
|
322 | pl->ns->flush_fx (); |
315 | pl->ns->send_packet (sl); |
323 | pl->ns->send_packet (sl); |
|
|
324 | } |
316 | } |
325 | } |
317 | |
326 | |
318 | /** |
327 | /** |
319 | * Sends whole inventory. |
328 | * Sends whole inventory. |
320 | */ |
329 | */ |
… | |
… | |
352 | * items (especially with some of the bags out there) to |
361 | * items (especially with some of the bags out there) to |
353 | * overflow the buffer. IF so, send multiple item commands. |
362 | * overflow the buffer. IF so, send multiple item commands. |
354 | */ |
363 | */ |
355 | if (sl.length () > MAXSOCKBUF - MAXITEMLEN) |
364 | if (sl.length () > MAXSOCKBUF - MAXITEMLEN) |
356 | { |
365 | { |
|
|
366 | pl->contr->ns->flush_fx (); |
357 | pl->contr->ns->send_packet (sl); |
367 | pl->contr->ns->send_packet (sl); |
358 | |
368 | |
359 | sl.reset (); |
369 | sl.reset (); |
360 | sl.printf ("item%d ", pl->contr->ns->itemcmd); |
370 | sl.printf ("item%d ", pl->contr->ns->itemcmd); |
361 | sl << uint32 (op->count); |
371 | sl << uint32 (op->count); |
… | |
… | |
363 | } |
373 | } |
364 | } |
374 | } |
365 | } |
375 | } |
366 | |
376 | |
367 | if (got_one) |
377 | if (got_one) |
|
|
378 | { |
|
|
379 | pl->contr->ns->flush_fx (); |
368 | pl->contr->ns->send_packet (sl); |
380 | pl->contr->ns->send_packet (sl); |
|
|
381 | } |
369 | } |
382 | } |
370 | |
383 | |
371 | /** |
384 | /** |
372 | * Updates object *op for player *pl. |
385 | * Updates object *op for player *pl. |
373 | * |
386 | * |
… | |
… | |
444 | |
457 | |
445 | if (flags & UPD_ANIMSPEED) |
458 | if (flags & UPD_ANIMSPEED) |
446 | { |
459 | { |
447 | int anim_speed = 0; |
460 | int anim_speed = 0; |
448 | |
461 | |
449 | if (QUERY_FLAG (op, FLAG_ANIMATE)) |
462 | if (op->flag [FLAG_ANIMATE]) |
450 | { |
463 | { |
451 | if (op->anim_speed) |
464 | if (op->anim_speed) |
452 | anim_speed = op->anim_speed; |
465 | anim_speed = op->anim_speed; |
453 | else |
466 | else |
454 | { |
467 | { |
455 | if (fabs (op->speed) < 0.001) |
468 | if (op->speed < 0.001) |
456 | anim_speed = 255; |
469 | anim_speed = 255; |
457 | else if (fabs (op->speed) >= 1.0) |
470 | else if (op->speed >= 1.0) |
458 | anim_speed = 1; |
471 | anim_speed = 1; |
459 | else |
472 | else |
460 | anim_speed = (int) (1.0 / fabs (op->speed)); |
473 | anim_speed = 1. / op->speed; |
461 | } |
474 | } |
462 | |
475 | |
463 | if (anim_speed > 255) |
476 | if (anim_speed > 255) |
464 | anim_speed = 255; |
477 | anim_speed = 255; |
465 | } |
478 | } |
… | |
… | |
494 | |
507 | |
495 | sl << uint32 (op->env ? op->env->count : 0); |
508 | sl << uint32 (op->env ? op->env->count : 0); |
496 | |
509 | |
497 | add_object_to_socklist (*pl->contr->ns, sl, op); |
510 | add_object_to_socklist (*pl->contr->ns, sl, op); |
498 | |
511 | |
|
|
512 | pl->contr->ns->flush_fx (); |
499 | pl->contr->ns->send_packet (sl); |
513 | pl->contr->ns->send_packet (sl); |
500 | } |
514 | } |
501 | |
515 | |
502 | /** |
516 | /** |
503 | * Tells the client to delete an item. |
517 | * Tells the client to delete an item. |
… | |
… | |
524 | |
538 | |
525 | /** |
539 | /** |
526 | * Takes a player and object count (tag) and returns the actual object |
540 | * Takes a player and object count (tag) and returns the actual object |
527 | * pointer, or null if it can't be found. |
541 | * pointer, or null if it can't be found. |
528 | */ |
542 | */ |
529 | object * |
543 | static object * |
530 | esrv_get_ob_from_count (object *pl, tag_t count) |
544 | esrv_get_ob_from_count (object *pl, tag_t count) |
531 | { |
545 | { |
532 | if (pl->count == count) |
546 | if (pl->count == count) |
533 | return pl; |
547 | return pl; |
534 | |
548 | |
535 | for (object *op = pl->inv; op; op = op->below) |
549 | for (object *op = pl->inv; op; op = op->below) |
536 | if (op->count == count) |
550 | if (op->count == count) |
537 | return op; |
551 | return op; |
538 | else if (op->type == CONTAINER && pl->container == op) |
552 | else if (op->type == CONTAINER && pl->container_ () == op) |
539 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
553 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
540 | if (tmp->count == count) |
554 | if (tmp->count == count) |
541 | return tmp; |
555 | return tmp; |
542 | |
556 | |
543 | for (object *op = GET_MAP_OB (pl->map, pl->x, pl->y); op; op = op->above) |
557 | for (object *op = GET_MAP_OB (pl->map, pl->x, pl->y); op; op = op->above) |
544 | if (op->head && op->head->count == count) |
558 | if (op->head && op->head->count == count) |
545 | return op; |
559 | return op; |
546 | else if (op->count == count) |
560 | else if (op->count == count) |
547 | return op; |
561 | return op; |
548 | else if (op->type == CONTAINER && pl->container == op) |
562 | else if (op->type == CONTAINER && pl->container_ () == op) |
549 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
563 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
550 | if (tmp->count == count) |
564 | if (tmp->count == count) |
551 | return tmp; |
565 | return tmp; |
552 | |
566 | |
553 | #if 0 |
567 | #if 0 |
… | |
… | |
594 | { |
608 | { |
595 | std::string s = op->describe (pl->ob); |
609 | std::string s = op->describe (pl->ob); |
596 | |
610 | |
597 | packet sl ("ex"); |
611 | packet sl ("ex"); |
598 | sl << ber32 (tag) |
612 | sl << ber32 (tag) |
599 | << data (*pl->expand_cfpod (s.c_str ())); |
613 | << data_n (*pl->expand_cfpod (s.c_str ())); |
600 | |
614 | |
601 | pl->ns->send_packet (sl); |
615 | pl->ns->send_packet (sl); |
602 | } |
616 | } |
603 | } |
617 | } |
604 | |
618 | |
… | |
… | |
614 | pl->ns->look_position = tag & 0x7fffffff; |
628 | pl->ns->look_position = tag & 0x7fffffff; |
615 | pl->ns->floorbox_update (); |
629 | pl->ns->floorbox_update (); |
616 | return; |
630 | return; |
617 | } |
631 | } |
618 | |
632 | |
|
|
633 | // the object might be legally gone already |
619 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
634 | if (object *op = esrv_get_ob_from_count (pl->ob, tag)) |
620 | |
635 | pl->ob->apply (op, AP_TOGGLE); |
621 | if (!op) |
|
|
622 | { |
|
|
623 | LOG (llevDebug, "Player '%s' tried to apply the unknown object (%d)\n", &pl->ob->name, tag); |
|
|
624 | return; |
|
|
625 | } |
|
|
626 | |
|
|
627 | player_apply (pl->ob, op, 0, 0); |
|
|
628 | } |
636 | } |
629 | |
637 | |
630 | /** Client wants to lock some object. Lets do so. */ |
638 | /** Client wants to lock some object. Lets do so. */ |
631 | void |
639 | void |
632 | LockItem (char *data, int len, player *pl) |
640 | LockItem (char *data, int len, player *pl) |
… | |
… | |
635 | tag_t tag = net_uint32 ((uint8 *)data + 1); |
643 | tag_t tag = net_uint32 ((uint8 *)data + 1); |
636 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
644 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
637 | |
645 | |
638 | if (!op) |
646 | if (!op) |
639 | { |
647 | { |
640 | pl->failmsg ("Could not find object to lock/unlock"); |
648 | pl->failmsgf ("Could not find object %d to lock/unlock", tag); |
641 | return; |
649 | return; |
642 | } |
650 | } |
643 | |
651 | |
644 | if (!flag) |
652 | if (!flag) |
645 | CLEAR_FLAG (op, FLAG_INV_LOCKED); |
653 | op->clr_flag (FLAG_INV_LOCKED); |
646 | else |
654 | else |
647 | SET_FLAG (op, FLAG_INV_LOCKED); |
655 | op->set_flag (FLAG_INV_LOCKED); |
648 | |
656 | |
649 | esrv_update_item (UPD_FLAGS, pl->ob, op); |
657 | esrv_update_item (UPD_FLAGS, pl->ob, op); |
650 | } |
658 | } |
651 | |
659 | |
652 | /** Client wants to mark some object. Lets do so. */ |
660 | /** Client wants to mark some object. Lets do so. */ |
… | |
… | |
656 | tag_t tag = net_uint32 ((uint8 *)data); |
664 | tag_t tag = net_uint32 ((uint8 *)data); |
657 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
665 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
658 | |
666 | |
659 | if (!op) |
667 | if (!op) |
660 | { |
668 | { |
661 | pl->failmsg ("Could not find object to mark"); |
669 | pl->failmsgf ("Could not find object %d to mark", tag); |
662 | return; |
670 | return; |
663 | } |
671 | } |
664 | |
672 | |
665 | pl->mark = op; |
673 | pl->mark = op; |
666 | pl->ob->statusmsg (format ("Marked item %s", query_name (op))); |
674 | pl->ob->statusmsg (format ("Marked item %s", query_name (op))); |
… | |
… | |
692 | { |
700 | { |
693 | mapspace &ms = *pos; |
701 | mapspace &ms = *pos; |
694 | ms.update (); |
702 | ms.update (); |
695 | |
703 | |
696 | buf.printf (" map: %s%+d%+d (%+d%+d)\n" |
704 | buf.printf (" map: %s%+d%+d (%+d%+d)\n" |
697 | " smell %u/%u; flags %x; light %d; block %x; slow %x; on %x; off %x; volume %lld\n\n", |
705 | " smell %u/%u; flags %x; light %d; block %x; slow %x; on %x; off %x; items %d, volume %lld\n\n", |
698 | &pos.m->path, pos.x, pos.y, dx, dy, |
706 | &pos.m->path, pos.x, pos.y, dx, dy, |
699 | (unsigned int)ms.smell, (unsigned int)mapspace::smellcount, ms.flags (), ms.light, |
707 | (unsigned int)ms.smell, (unsigned int)mapspace::smellcount, ms.flags (), ms.light, |
700 | ms.move_block, ms.move_slow, ms.move_on, ms.move_off, (long long)ms.volume () |
708 | ms.move_block, ms.move_slow, ms.move_on, ms.move_off, (int)ms.items (), (long long)ms.volume () |
701 | ); |
709 | ); |
702 | } |
710 | } |
703 | else |
711 | else |
704 | buf << "off-map\n\n"; |
712 | buf << "off-map\n\n"; |
705 | } |
713 | } |
… | |
… | |
713 | else |
721 | else |
714 | { |
722 | { |
715 | if (pos.normalise ()) |
723 | if (pos.normalise ()) |
716 | for (object *tmp = pos->top; tmp; tmp = tmp->below) |
724 | for (object *tmp = pos->top; tmp; tmp = tmp->below) |
717 | { |
725 | { |
718 | if (tmp->invisible && !QUERY_FLAG (ob, FLAG_WIZ)) |
726 | if (tmp->invisible && !ob->flag [FLAG_WIZ]) |
719 | continue; |
727 | continue; |
720 | |
728 | |
721 | if (wiz) |
729 | if (wiz) |
722 | buf.printf (" - %s (%d).\n", query_name (tmp), tmp->count); |
730 | buf.printf (" - %s (%d) %s\n", query_name (tmp), tmp->count, tmp->uuid.c_str ()); |
723 | else |
731 | else |
724 | buf.printf (" - %s.\n", query_name (tmp)); |
732 | buf.printf (" - %s.\n", query_name (tmp)); |
725 | |
733 | |
726 | object *head = tmp->head_ (); |
734 | object *head = tmp->head_ (); |
727 | |
735 | |
728 | if (head->inv) |
736 | if (head->inv) |
729 | if ((head->type != CONTAINER && head->type != FLESH) |
737 | if ((head->type != CONTAINER && head->type != FLESH) |
730 | || QUERY_FLAG (ob, FLAG_WIZ)) |
738 | || ob->flag [FLAG_WIZ]) |
731 | buf << head->query_inventory (ob, " "); |
739 | buf << head->query_inventory (ob, " "); |
732 | |
740 | |
733 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR) && !wiz) /* don't continue under the floor */ |
741 | if (tmp->flag [FLAG_IS_FLOOR] && !wiz) /* don't continue under the floor */ |
734 | break; |
742 | break; |
735 | } |
743 | } |
736 | } |
744 | } |
737 | |
745 | |
738 | if (buf.empty ()) |
746 | if (buf.empty ()) |
… | |
… | |
773 | return; |
781 | return; |
774 | |
782 | |
775 | /* If it is an active container, then we should drop all objects |
783 | /* If it is an active container, then we should drop all objects |
776 | * in the container and not the container itself. |
784 | * in the container and not the container itself. |
777 | */ |
785 | */ |
778 | if (op->inv && QUERY_FLAG (op, FLAG_APPLIED)) |
786 | if (op->inv && op->flag [FLAG_APPLIED]) |
779 | { |
787 | { |
780 | int cnt = MAX_ITEM_PER_DROP; |
788 | int cnt = MAX_ITEM_PER_ACTION; |
781 | |
789 | |
782 | for (object *current = op->inv; current && cnt--; ) |
790 | for (object *current = op->inv; current && cnt--; ) |
783 | { |
791 | { |
784 | object *next = current->below; |
792 | object *next = current->below; |
785 | drop_object (pl, current, 0); |
793 | drop_object (pl, current, 0); |