… | |
… | |
561 | * returned is good forever.) However, it makes printing statements that |
561 | * returned is good forever.) However, it makes printing statements that |
562 | * use several names much easier (don't need to store them to temp variables.) |
562 | * use several names much easier (don't need to store them to temp variables.) |
563 | * |
563 | * |
564 | * It is used extensively within messages, so should return only a prose |
564 | * It is used extensively within messages, so should return only a prose |
565 | * and short description of the item. |
565 | * and short description of the item. |
|
|
566 | * It is also used by examine/ex and similar functions. |
566 | */ |
567 | */ |
567 | const char * |
568 | const char * |
568 | query_name (const object *op) |
569 | query_name (const object *op) |
569 | { |
570 | { |
570 | int len = 0; |
571 | int len = 0; |
… | |
… | |
686 | * and sending to client. |
687 | * and sending to client. |
687 | * If plural is set, we generate the plural name of this. |
688 | * If plural is set, we generate the plural name of this. |
688 | * |
689 | * |
689 | * It is sometimes used to display messages, and usually only used to match stuff, |
690 | * It is sometimes used to display messages, and usually only used to match stuff, |
690 | * so maybe this function should be removed. |
691 | * so maybe this function should be removed. |
|
|
692 | * It is also used for client-side inventory/item descriptions. |
691 | */ |
693 | */ |
692 | const char * |
694 | const char * |
693 | query_base_name (const object *op, int plural) |
695 | query_base_name (const object *op, int plural) |
694 | { |
696 | { |
695 | if ((!plural && !op->name) || (plural && !op->name_pl)) |
697 | if ((!plural && !op->name) || (plural && !op->name_pl)) |
696 | return "(null)"; |
698 | return "(null)"; |
697 | |
699 | |
698 | if (!op->nrof && !op->weight && !op->title && !is_magical (op)) |
700 | if (!op->nrof && !op->weight && !op->title && !is_magical (op) |
|
|
701 | && op->type != EXIT) |
699 | return op->name; /* To speed things up (or make things slower?) */ |
702 | return op->name; /* To speed things up (or make things slower?) */ |
700 | |
703 | |
701 | static dynbuf_text buf; buf.clear (); |
704 | static dynbuf_text buf; buf.clear (); |
702 | |
705 | |
703 | #if 0 |
706 | #if 0 |
… | |
… | |
763 | /* Note that the resolution this provides for players really isn't |
766 | /* Note that the resolution this provides for players really isn't |
764 | * very good. Any player with a speed greater than .67 will |
767 | * very good. Any player with a speed greater than .67 will |
765 | * fall into the 'lightning fast movement' category. |
768 | * fall into the 'lightning fast movement' category. |
766 | */ |
769 | */ |
767 | if (op->has_active_speed ()) |
770 | if (op->has_active_speed ()) |
768 | switch ((int)((fabs (op->speed)) * 15.)) |
771 | switch ((int)(op->speed * 15.)) |
769 | { |
772 | { |
770 | case 0: |
773 | case 0: |
771 | buf << "(very slow movement)"; |
774 | buf << "(very slow movement)"; |
772 | break; |
775 | break; |
773 | case 1: |
776 | case 1: |
… | |
… | |
843 | if (op->stats.luck) |
846 | if (op->stats.luck) |
844 | buf.printf ("(luck%+d)", op->stats.luck); |
847 | buf.printf ("(luck%+d)", op->stats.luck); |
845 | } |
848 | } |
846 | |
849 | |
847 | /* describe attacktypes */ |
850 | /* describe attacktypes */ |
848 | if (is_dragon_pl (op)) |
851 | if (op->is_dragon ()) |
849 | { |
852 | { |
850 | /* for dragon players display the attacktypes from clawing skill |
853 | /* for dragon players display the attacktypes from clawing skill |
851 | * Break apart the for loop - move the comparison checking down - |
854 | * Break apart the for loop - move the comparison checking down - |
852 | * this makes it more readable. |
855 | * this makes it more readable. |
853 | */ |
856 | */ |
… | |
… | |
1152 | |
1155 | |
1153 | buf.add_abilities ("Attacks", op->attacktype); |
1156 | buf.add_abilities ("Attacks", op->attacktype); |
1154 | /* resistance on flesh is only visible for quetzals. If |
1157 | /* resistance on flesh is only visible for quetzals. If |
1155 | * non flesh, everyone can see its resistances |
1158 | * non flesh, everyone can see its resistances |
1156 | */ |
1159 | */ |
1157 | if (op->type != FLESH || (owner && is_dragon_pl (owner))) |
1160 | if (op->type != FLESH || (owner && owner->is_dragon ())) |
1158 | buf << describe_resistance (op, 0); |
1161 | buf << describe_resistance (op, 0); |
1159 | |
1162 | |
1160 | buf.add_paths ("Attuned", op->path_attuned); |
1163 | buf.add_paths ("Attuned", op->path_attuned); |
1161 | buf.add_paths ("Repelled", op->path_repelled); |
1164 | buf.add_paths ("Repelled", op->path_repelled); |
1162 | buf.add_paths ("Denied", op->path_denied); |
1165 | buf.add_paths ("Denied", op->path_denied); |
… | |
… | |
1189 | { |
1192 | { |
1190 | static dynbuf_text buf; buf.clear (); |
1193 | static dynbuf_text buf; buf.clear (); |
1191 | |
1194 | |
1192 | for (object *tmp = inv; tmp; tmp = tmp->below) |
1195 | for (object *tmp = inv; tmp; tmp = tmp->below) |
1193 | if (who && QUERY_FLAG (who, FLAG_WIZ)) |
1196 | if (who && QUERY_FLAG (who, FLAG_WIZ)) |
1194 | buf.printf ("%s- %-28.28s (%5d) %-8s\n", indent, tmp->query_name (), tmp->count, tmp->query_weight ()); |
1197 | buf.printf ("%s- %-28.28s %-8s (%9d) %s\n", indent, tmp->query_name (), tmp->query_weight (), tmp->count, tmp->uuid.c_str ()); |
1195 | else if (!tmp->invisible && (type == CONTAINER || QUERY_FLAG (tmp, FLAG_APPLIED))) |
1198 | else if (!tmp->invisible && (type == CONTAINER || QUERY_FLAG (tmp, FLAG_APPLIED))) |
1196 | buf.printf ("%s- %-36.36s %-8s\n", indent, tmp->query_name (), tmp->query_weight ()); |
1199 | buf.printf ("%s- %-36.36s %-8s\n", indent, tmp->query_name (), tmp->query_weight ()); |
1197 | |
1200 | |
1198 | if (buf.size ()) |
1201 | if (buf.size ()) |
1199 | buf.printf ("%s(total weight: %s)\n", indent, query_weight ()); |
1202 | buf.printf ("%s(total weight: %s)\n", indent, query_weight ()); |