|
From: Crossfire C. r. messages.
<cro...@li...> - 2020-11-28 16:16:28
|
Revision: 21569
http://sourceforge.net/p/crossfire/code/21569
Author: silvernexus
Date: 2020-11-28 16:16:25 +0000 (Sat, 28 Nov 2020)
Log Message:
-----------
Make spell flavor text not appear on unidentified items. Also fix lack of book name when examining an unidentified spellbook.
Modified Paths:
--------------
server/trunk/ChangeLog
server/trunk/server/c_object.c
server/trunk/types/spellbook/spellbook.c
Modified: server/trunk/ChangeLog
===================================================================
--- server/trunk/ChangeLog 2020-11-27 15:39:44 UTC (rev 21568)
+++ server/trunk/ChangeLog 2020-11-28 16:16:25 UTC (rev 21569)
@@ -1,3 +1,9 @@
+2020-11-28 Daniel Hawkins
+ * types/spellbook/spellbook.c: Make sure an unidentified spellbook at least tells you
+ what you can already see in the viewport, rather than "That is: " without a name.
+ * server/c_object.c: Prevent the flavor text for magic to appear when the item is not
+ yet identified.
+
2020-11-27 Daniel Hawkins
* server/skills.c: Make trapped doors detonate traps when lockpicked on the first attempt.
Modified: server/trunk/server/c_object.c
===================================================================
--- server/trunk/server/c_object.c 2020-11-27 15:39:44 UTC (rev 21568)
+++ server/trunk/server/c_object.c 2020-11-28 16:16:25 UTC (rev 21569)
@@ -1574,7 +1574,8 @@
"Unfortunately the scroll is damaged and unreadable.");
break;
}
- if (skill->clone.msg) {
+ // Only print the flavor text once we have identified.
+ if (is_identified(tmp) && skill->clone.msg) {
StringBuffer *sb = stringbuffer_new();
stringbuffer_append_string(sb, skill->clone.msg);
stringbuffer_trim_whitespace(sb);
@@ -1592,7 +1593,8 @@
case WAND:
case ROD:
case POTION:
- if (tmp->inv && tmp->inv->msg) {
+ // Only print the flavor text once we have identified.
+ if (is_identified(tmp) && tmp->inv && tmp->inv->msg) {
// If the embedded spell has a msg, display it here so that the
// player knows what it does before they actually read/use the item.
// Strip trailing newlines so that the output of examine() is
@@ -1644,24 +1646,22 @@
}
/* Where to wear this item */
for (i = 0; i < NUM_BODY_LOCATIONS; i++) {
- if (tmp->body_info[i] < -1) {
- if (op->body_info[i])
- draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE,
- "It goes %s (%d)",
+ if (tmp->body_info[i]) {
+ if (op->body_info[i]) {
+ if (tmp->body_info[i] < -1) {
+ draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE,
+ "%s %s (%d)", tmp->nrof > 1 ? "They go" : "It goes",
body_locations[i].use_name, -tmp->body_info[i]);
- else
- draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE,
- "It goes %s",
- body_locations[i].nonuse_name);
- } else if (tmp->body_info[i]) {
- if (op->body_info[i])
- draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE,
- "It goes %s",
+ } else {
+ draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE,
+ "%s %s", tmp->nrof > 1 ? "They go" : "It goes",
body_locations[i].use_name);
- else
+ }
+ } else {
draw_ext_info_format(NDI_UNIQUE, 0, op, MSG_TYPE_COMMAND, MSG_TYPE_COMMAND_EXAMINE,
- "It goes %s",
+ "%s %s", tmp->nrof > 1 ? "They go" : "It goes",
body_locations[i].nonuse_name);
+ }
}
}
Modified: server/trunk/types/spellbook/spellbook.c
===================================================================
--- server/trunk/types/spellbook/spellbook.c 2020-11-27 15:39:44 UTC (rev 21568)
+++ server/trunk/types/spellbook/spellbook.c 2020-11-28 16:16:25 UTC (rev 21569)
@@ -150,7 +150,16 @@
static void spellbook_type_describe(
const ob_methods *context, const object *book, const object *observer,
const int use_media_tags, char *buf, size_t size) {
- if (!is_identified(book)) return;
+ if (!is_identified(book)) {
+ /* Without querying the name, spellbooks end up examining
+ * as "That is:", with no name at all
+ * This should tell the player just as little as the inventory view.
+ *
+ * SilverNexus 2020-11-28
+ */
+ query_name(book, buf, size-1);
+ return;
+ }
size_t len;
/* TODO check if this generates the "of foo" so we don't end up with
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|