From 648085d41fc44431db46d072551d7261010df163 Mon Sep 17 00:00:00 2001 From: kinther Date: Sun, 7 Sep 2025 16:11:05 -0700 Subject: [PATCH] Rename action_desc to main_desc --- lib/world/mob/1.mob | 52 ++++++++++++++++++++++++++++++++++--------- lib/world/obj/1.obj | 9 ++++++++ lib/world/zon/1.zon | 1 + src/act.comm.c | 8 +++---- src/act.informative.c | 28 ++++++++++++++++------- src/act.wizard.c | 6 ++--- src/db.c | 6 ++--- src/genobj.c | 14 ++++++------ src/genolc.c | 4 ++-- src/mail.c | 6 ++--- src/objsave.c | 12 +++++----- src/oedit.c | 20 ++++++++--------- src/spell_parser.c | 20 ++++++++--------- src/structs.h | 2 +- src/utils.h | 2 ++ 15 files changed, 123 insertions(+), 67 deletions(-) diff --git a/lib/world/mob/1.mob b/lib/world/mob/1.mob index 9fb7b15..7e247c7 100644 --- a/lib/world/mob/1.mob +++ b/lib/world/mob/1.mob @@ -16,17 +16,17 @@ Str: 16 Dex: 14 Con: 14 E -L 17 127 1 -L 16 117 1 -L 15 117 1 -L 11 111 1 -L 10 107 1 -L 9 124 1 -L 8 115 1 -L 7 108 1 -L 6 110 1 -L 5 131 1 L 3 118 1 +L 5 131 1 +L 6 110 1 +L 7 108 1 +L 8 115 1 +L 9 124 1 +L 10 107 1 +L 11 111 1 +L 15 117 1 +L 16 117 1 +L 17 127 1 #101 slim lanky human soldier guard~ a slim, lanky human soldier~ @@ -46,4 +46,36 @@ Str: 14 Dex: 18 Con: 14 E +L 17 127 1 +L 16 117 1 +L 15 117 1 +L 11 111 1 +L 10 107 1 +L 9 124 1 +L 8 115 1 +L 7 108 1 +L 6 110 1 +L 5 131 1 +L 3 118 1 +#102 +barkeep stocky bald~ +a stocky, bald barkeep~ +A stocky, bald barkeep stands behind the bar here. +~ +This man is short and stocky, with a cleanly shaven head. Pattern baldness has +taken hold, yet he has a thick and wiry beard that covers most of his face. +Pale blue eyes look bloodshot, and bluish-purple bags hang under them. His +hands are marred with minor cuts and scars from years of working in service to +others. +~ +10 0 0 0 0 0 0 0 0 E +1 20 10 3d12+60 1d1+0 +0 0 +8 8 1 +Str: 18 +Int: 12 +Con: 18 +E +L 14 113 1 +L 9 112 1 $ diff --git a/lib/world/obj/1.obj b/lib/world/obj/1.obj index 02e9a6d..046430c 100644 --- a/lib/world/obj/1.obj +++ b/lib/world/obj/1.obj @@ -254,4 +254,13 @@ A backpack made of thick hide is lying here.~ 15 0 0 0 0 ad 0 0 0 0 0 0 0 75 0 0 0 5 50 0 0 0 +#132 +bar bartop~ +a long, wooden bar~ +A long, wooden bar takes up most of the south side of the room.~ +It's a long wooden bar! +~ +6 0 0 0 0 0 0 0 0 0 0 0 0 +100 8 0 0 +200 0 0 0 0 $~ diff --git a/lib/world/zon/1.zon b/lib/world/zon/1.zon index b08214b..2611b1d 100644 --- a/lib/world/zon/1.zon +++ b/lib/world/zon/1.zon @@ -3,5 +3,6 @@ None.~ City of Tyr~ 100 199 30 2 M 0 100 1 100 (the tall, burly human soldier) +M 0 101 1 100 (a slim, lanky human soldier) S $ diff --git a/src/act.comm.c b/src/act.comm.c index 153e836..376a67c 100644 --- a/src/act.comm.c +++ b/src/act.comm.c @@ -462,16 +462,16 @@ ACMD(do_write) char *backstr = NULL; /* Something on it, display it as that's in input buffer. */ - if (paper->action_description) { - backstr = strdup(paper->action_description); + if (paper->main_description) { + backstr = strdup(paper->main_description); send_to_char(ch, "There's something written on it already:\r\n"); - send_to_char(ch, "%s", paper->action_description); + send_to_char(ch, "%s", paper->main_description); } /* We can write. */ act("$n begins to jot down a note.", TRUE, ch, 0, 0, TO_ROOM); send_editor_help(ch->desc); - string_write(ch->desc, &paper->action_description, MAX_NOTE_LENGTH, 0, backstr); + string_write(ch->desc, &paper->main_description, MAX_NOTE_LENGTH, 0, backstr); } } diff --git a/src/act.informative.c b/src/act.informative.c index 5287b3e..c6bc624 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -54,7 +54,7 @@ static size_t print_object_location(int num, const obj_data *obj, const char_dat /* For show_obj_to_char 'mode'. /-- arbitrary */ #define SHOW_OBJ_LONG 0 #define SHOW_OBJ_SHORT 1 -#define SHOW_OBJ_ACTION 2 +#define SHOW_OBJ_MAIN 2 static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode) { @@ -116,16 +116,24 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod send_to_char(ch, "%s", obj->short_description); break; - case SHOW_OBJ_ACTION: + case SHOW_OBJ_MAIN: + /* Prefer builder-authored look/inspect text (M-Desc) for ANY item type. */ + if (GET_OBJ_MAIN(obj) && *GET_OBJ_MAIN(obj)) { + /* Use the pager so multi-line M-Descs display nicely. */ + page_string(ch->desc, GET_OBJ_MAIN(obj), TRUE); + return; + } + switch (GET_OBJ_TYPE(obj)) { case ITEM_NOTE: - if (obj->action_description) { + if (obj->main_description) { char notebuf[MAX_NOTE_LENGTH + 64]; - - snprintf(notebuf, sizeof(notebuf), "There is something written on it:\r\n\r\n%s", obj->action_description); + snprintf(notebuf, sizeof(notebuf), + "There is something written on it:\r\n\r\n%s", + obj->main_description); page_string(ch->desc, notebuf, TRUE); } else - send_to_char(ch, "It's blank.\r\n"); + send_to_char(ch, "It's blank.\r\n"); return; case ITEM_DRINKCON: @@ -133,7 +141,11 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod break; default: - send_to_char(ch, "You see nothing special.."); + /* Optional: friendlier fallback that names the item. */ + if (obj->short_description && *obj->short_description) + send_to_char(ch, "You see nothing special about %s.", obj->short_description); + else + send_to_char(ch, "You see nothing special.."); break; } break; @@ -709,7 +721,7 @@ static void look_at_target(struct char_data *ch, char *arg) /* If an object was found back in generic_find */ if (bits) { if (!found) - show_obj_to_char(found_obj, ch, SHOW_OBJ_ACTION); + show_obj_to_char(found_obj, ch, SHOW_OBJ_MAIN); else { show_obj_modifiers(found_obj, ch); send_to_char(ch, "\r\n"); diff --git a/src/act.wizard.c b/src/act.wizard.c index 93df109..dd4a0f6 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -999,7 +999,7 @@ static void do_stat_object(struct char_data *ch, struct obj_data *j) CCNRM(ch, C_NRM)); send_to_char(ch, "A-Desc: '%s%s%s'\r\n", CCYEL(ch, C_NRM), - j->action_description ? j->action_description : "", + j->main_description ? j->main_description : "", CCNRM(ch, C_NRM)); if (j->ex_description) { @@ -4233,13 +4233,13 @@ ACMD (do_zcheck) "- has min level set to %d (max %d).\r\n", GET_OBJ_LEVEL(obj), LVL_IMMORT-1); - if (obj->action_description && *obj->action_description && + if (obj->main_description && *obj->main_description && GET_OBJ_TYPE(obj) != ITEM_STAFF && GET_OBJ_TYPE(obj) != ITEM_WAND && GET_OBJ_TYPE(obj) != ITEM_SCROLL && GET_OBJ_TYPE(obj) != ITEM_NOTE && (found=1)) len += snprintf(buf + len, sizeof(buf) - len, - "- has action_description set, but is inappropriate type.\r\n"); + "- has main_description set, but is inappropriate type.\r\n"); /*first check for over-all affections*/ for (affs=0, j = 0; j < MAX_OBJ_AFFECT; j++) diff --git a/src/db.c b/src/db.c index 1d3e4fa..71925b8 100644 --- a/src/db.c +++ b/src/db.c @@ -573,8 +573,8 @@ void destroy_db(void) free(obj_proto[cnt].description); if (obj_proto[cnt].short_description) free(obj_proto[cnt].short_description); - if (obj_proto[cnt].action_description) - free(obj_proto[cnt].action_description); + if (obj_proto[cnt].main_description) + free(obj_proto[cnt].main_description); free_extra_descriptions(obj_proto[cnt].ex_description); /* free script proto list */ @@ -1961,7 +1961,7 @@ char *parse_object(FILE *obj_f, int nr) tmpptr = obj_proto[i].description = fread_string(obj_f, buf2); if (tmpptr && *tmpptr) CAP(tmpptr); - obj_proto[i].action_description = fread_string(obj_f, buf2); + obj_proto[i].main_description = fread_string(obj_f, buf2); /* numeric data */ if (!get_line(obj_f, line)) { diff --git a/src/genobj.c b/src/genobj.c index 34c7b24..3f6017d 100644 --- a/src/genobj.c +++ b/src/genobj.c @@ -204,8 +204,8 @@ int save_objects(zone_rnum zone_num) /* Start running through all objects in this zone. */ for (counter = genolc_zone_bottom(zone_num); counter <= zone_table[zone_num].top; counter++) { if ((realcounter = real_object(counter)) != NOTHING) { - if ((obj = &obj_proto[realcounter])->action_description) { - strncpy(buf, obj->action_description, sizeof(buf) - 1); + if ((obj = &obj_proto[realcounter])->main_description) { + strncpy(buf, obj->main_description, sizeof(buf) - 1); strip_cr(buf); } else *buf = '\0'; @@ -307,8 +307,8 @@ void free_object_strings(struct obj_data *obj) free(obj->description); if (obj->short_description) free(obj->short_description); - if (obj->action_description) - free(obj->action_description); + if (obj->main_description) + free(obj->main_description); if (obj->ex_description) free_ex_descriptions(obj->ex_description); } @@ -324,8 +324,8 @@ void free_object_strings_proto(struct obj_data *obj) free(obj->description); if (obj->short_description && obj->short_description != obj_proto[robj_num].short_description) free(obj->short_description); - if (obj->action_description && obj->action_description != obj_proto[robj_num].action_description) - free(obj->action_description); + if (obj->main_description && obj->main_description != obj_proto[robj_num].main_description) + free(obj->main_description); if (obj->ex_description) { struct extra_descr_data *thised, *plist, *next_one; /* O(horrible) */ int ok_key, ok_desc, ok_item; @@ -354,7 +354,7 @@ static void copy_object_strings(struct obj_data *to, struct obj_data *from) to->name = from->name ? strdup(from->name) : NULL; to->description = from->description ? strdup(from->description) : NULL; to->short_description = from->short_description ? strdup(from->short_description) : NULL; - to->action_description = from->action_description ? strdup(from->action_description) : NULL; + to->main_description = from->main_description ? strdup(from->main_description) : NULL; if (from->ex_description) copy_ex_descriptions(&to->ex_description, from->ex_description); diff --git a/src/genolc.c b/src/genolc.c index c61622d..556bf03 100644 --- a/src/genolc.c +++ b/src/genolc.c @@ -784,8 +784,8 @@ static int export_save_objects(zone_rnum zrnum) /* Start running through all objects in this zone. */ for (ovnum = genolc_zone_bottom(zrnum); ovnum <= zone_table[zrnum].top; ovnum++) { if ((ornum = real_object(ovnum)) != NOTHING) { - if ((obj = &obj_proto[ornum])->action_description) { - strncpy(buf, obj->action_description, sizeof(buf) - 1); + if ((obj = &obj_proto[ornum])->main_description) { + strncpy(buf, obj->main_description, sizeof(buf) - 1); strip_cr(buf); } else *buf = '\0'; diff --git a/src/mail.c b/src/mail.c index 50c26d4..f957870 100644 --- a/src/mail.c +++ b/src/mail.c @@ -351,10 +351,10 @@ static void postmaster_receive_mail(struct char_data *ch, struct char_data *mail GET_OBJ_WEIGHT(obj) = 1; GET_OBJ_COST(obj) = 30; GET_OBJ_RENT(obj) = 10; - obj->action_description = read_delete(GET_IDNUM(ch)); + obj->main_description = read_delete(GET_IDNUM(ch)); - if (obj->action_description == NULL) - obj->action_description = + if (obj->main_description == NULL) + obj->main_description = strdup("Mail system error - please report. Error #11.\r\n"); obj_to_char(obj, ch); diff --git a/src/objsave.c b/src/objsave.c index abe53fc..55ade49 100644 --- a/src/objsave.c +++ b/src/objsave.c @@ -54,8 +54,8 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate) temp->item_number = NOWHERE; } - if (obj->action_description) { - strcpy(buf1, obj->action_description); + if (obj->main_description) { + strcpy(buf1, obj->main_description); strip_cr(buf1); } else *buf1 = 0; @@ -107,8 +107,8 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate) if (obj->description && (!temp->description || strcmp(obj->description, temp->description))) fprintf(fp, "Desc: %s\n", obj->description); - if (obj->action_description && (!temp->action_description || - strcmp(obj->action_description, temp->action_description))) + if (obj->main_description && (!temp->main_description || + strcmp(obj->main_description, temp->main_description))) fprintf(fp, "ADes:\n%s~\n", buf1); /* Core fields */ @@ -774,8 +774,8 @@ obj_save_data *objsave_parse_objects(FILE *fl) temp->description = *payload ? strdup(payload) : strdup("An object lies here."); } else if (!strcmp(tag, "ADes")) { - if (temp->action_description) free(temp->action_description); - temp->action_description = *payload ? strdup(payload) : NULL; + if (temp->main_description) free(temp->main_description); + temp->main_description = *payload ? strdup(payload) : NULL; } else if (!strcmp(tag, "End")) { commit_current(); diff --git a/src/oedit.c b/src/oedit.c index 43bb1ef..2a40ada 100644 --- a/src/oedit.c +++ b/src/oedit.c @@ -629,7 +629,7 @@ static void oedit_disp_menu(struct descriptor_data *d) "%s1%s) Keywords : %s%s\r\n" "%s2%s) S-Desc : %s%s\r\n" "%s3%s) L-Desc :-\r\n%s%s\r\n" - "%s4%s) A-Desc :-\r\n%s%s" + "%s4%s) M-Desc :-\r\n%s%s" "%s5%s) Type : %s%s\r\n" "%s6%s) Extra flags : %s%s\r\n", @@ -637,7 +637,7 @@ static void oedit_disp_menu(struct descriptor_data *d) grn, nrm, yel, (obj->name && *obj->name) ? obj->name : "undefined", grn, nrm, yel, (obj->short_description && *obj->short_description) ? obj->short_description : "undefined", grn, nrm, yel, (obj->description && *obj->description) ? obj->description : "undefined", - grn, nrm, yel, (obj->action_description && *obj->action_description) ? obj->action_description : "Not Set.\r\n", + grn, nrm, yel, (obj->main_description && *obj->main_description) ? obj->main_description : "Not Set.\r\n", grn, nrm, cyn, buf1, grn, nrm, cyn, buf2 ); @@ -748,11 +748,11 @@ void oedit_parse(struct descriptor_data *d, char *arg) OLC_MODE(d) = OEDIT_ACTDESC; send_editor_help(d); write_to_output(d, "Enter action description:\r\n\r\n"); - if (OLC_OBJ(d)->action_description) { - write_to_output(d, "%s", OLC_OBJ(d)->action_description); - oldtext = strdup(OLC_OBJ(d)->action_description); + if (OLC_OBJ(d)->main_description) { + write_to_output(d, "%s", OLC_OBJ(d)->main_description); + oldtext = strdup(OLC_OBJ(d)->main_description); } - string_write(d, &OLC_OBJ(d)->action_description, + string_write(d, &OLC_OBJ(d)->main_description, MAX_MESSAGE_LENGTH, 0, oldtext); OLC_DIRTY(d) = 1; break; @@ -889,11 +889,11 @@ void oedit_parse(struct descriptor_data *d, char *arg) /* Multi-line editor is correct here, requires '@' to finish */ send_editor_help(d); write_to_output(d, "Enter action description:\r\n\r\n"); - if (OLC_OBJ(d)->action_description) { - write_to_output(d, "%s", OLC_OBJ(d)->action_description); - oldtext = strdup(OLC_OBJ(d)->action_description); + if (OLC_OBJ(d)->main_description) { + write_to_output(d, "%s", OLC_OBJ(d)->main_description); + oldtext = strdup(OLC_OBJ(d)->main_description); } - string_write(d, &OLC_OBJ(d)->action_description, MAX_MESSAGE_LENGTH, 0, oldtext); + string_write(d, &OLC_OBJ(d)->main_description, MAX_MESSAGE_LENGTH, 0, oldtext); OLC_DIRTY(d) = 1; return; diff --git a/src/spell_parser.c b/src/spell_parser.c index 41b939d..982e20c 100644 --- a/src/spell_parser.c +++ b/src/spell_parser.c @@ -318,8 +318,8 @@ void mag_objectmagic(struct char_data *ch, struct obj_data *obj, char *argument) switch (GET_OBJ_TYPE(obj)) { case ITEM_STAFF: act("You tap $p three times on the ground.", FALSE, ch, obj, 0, TO_CHAR); - if (obj->action_description) - act(obj->action_description, FALSE, ch, obj, 0, TO_ROOM); + if (obj->main_description) + act(obj->main_description, FALSE, ch, obj, 0, TO_ROOM); else act("$n taps $p three times on the ground.", FALSE, ch, obj, 0, TO_ROOM); @@ -356,15 +356,15 @@ void mag_objectmagic(struct char_data *ch, struct obj_data *obj, char *argument) act("$n points $p at $mself.", FALSE, ch, obj, 0, TO_ROOM); } else { act("You point $p at $N.", FALSE, ch, obj, tch, TO_CHAR); - if (obj->action_description) - act(obj->action_description, FALSE, ch, obj, tch, TO_ROOM); + if (obj->main_description) + act(obj->main_description, FALSE, ch, obj, tch, TO_ROOM); else act("$n points $p at $N.", TRUE, ch, obj, tch, TO_ROOM); } } else if (tobj != NULL) { act("You point $p at $P.", FALSE, ch, obj, tobj, TO_CHAR); - if (obj->action_description) - act(obj->action_description, FALSE, ch, obj, tobj, TO_ROOM); + if (obj->main_description) + act(obj->main_description, FALSE, ch, obj, tobj, TO_ROOM); else act("$n points $p at $P.", TRUE, ch, obj, tobj, TO_ROOM); } else if (IS_SET(spell_info[GET_OBJ_VAL(obj, 3)].routines, @@ -402,8 +402,8 @@ void mag_objectmagic(struct char_data *ch, struct obj_data *obj, char *argument) tch = ch; act("You recite $p which dissolves.", TRUE, ch, obj, 0, TO_CHAR); - if (obj->action_description) - act(obj->action_description, FALSE, ch, obj, tch, TO_ROOM); + if (obj->main_description) + act(obj->main_description, FALSE, ch, obj, tch, TO_ROOM); else act("$n recites $p.", FALSE, ch, obj, NULL, TO_ROOM); @@ -423,8 +423,8 @@ void mag_objectmagic(struct char_data *ch, struct obj_data *obj, char *argument) return; act("You quaff $p.", FALSE, ch, obj, NULL, TO_CHAR); - if (obj->action_description) - act(obj->action_description, FALSE, ch, obj, NULL, TO_ROOM); + if (obj->main_description) + act(obj->main_description, FALSE, ch, obj, NULL, TO_ROOM); else act("$n quaffs $p.", TRUE, ch, obj, NULL, TO_ROOM); diff --git a/src/structs.h b/src/structs.h index 8c62739..1f23db3 100644 --- a/src/structs.h +++ b/src/structs.h @@ -724,7 +724,7 @@ struct obj_data char *name; /**< Keyword reference(s) for object. */ char *description; /**< Shown when the object is lying in a room. */ char *short_description; /**< Shown when worn, carried, in a container */ - char *action_description; /**< Displays when (if) the object is used */ + char *main_description; /**< Displays when looking/examining an item */ struct extra_descr_data *ex_description; /**< List of extra descriptions */ struct char_data *carried_by; /**< Points to PC/NPC carrying, or NULL */ struct char_data *worn_by; /**< Points to PC/NPC wearing, or NULL */ diff --git a/src/utils.h b/src/utils.h index 608fd1d..5691256 100644 --- a/src/utils.h +++ b/src/utils.h @@ -775,6 +775,8 @@ do \ #define CAN_WEAR(obj, part) OBJWEAR_FLAGGED((obj), (part)) /** Return short description of obj. */ #define GET_OBJ_SHORT(obj) ((obj)->short_description) +/* Return main description of obj. */ +#define GET_OBJ_MAIN(obj) ((obj)->main_description) /* Compound utilities and other macros. */ /** Used to compute version. To see if the code running is newer than 3.0pl13,