Hi. I'm trying to add short-descriptions in my mud (ie, so I'll see
'the black-haired man has arrived' instead of 'Joe has arrived'; and
yes, I =do= want to do this) and I'm having trouble. I create two
characters and try to have one enter the other's room but I get a
segmentation fault. gdb seems to point to the few lines after the
switch in comm.c in act() but I have no clue. Any ideas? Thanks!
Stock Circle 2.20.
This is what I've done:
comm.c
in void act(), this makes it so $d pops in the short_descr:
case 'd': /* Sdesc mod - begin add */
i = PERD(ch, to);
break; /* Sdesc mod - end add */
utils.h:
#define GET_SDESC(ch) ((ch)->player.short_descr) /* Sdesc mod - add */
...
#define PERD(ch, vict) (CAN_SEE(vict, ch) ? GET_SDESC(ch) : "someone")
interpreter.c, in nanny():
/* after CON_QCLASS stuff */
SEND_TO_Q("\n\rEnter your sdesc: ", d); /* Sdesc mod begin */
STATE(d) = CON_SDESC;
break;
case CON_SDESC:
if (strlen(arg) > 45) {
SEND_TO_Q("\n\rToo long. Must be 45 chars or less.\n\rSdesc: ",
d);
return;
}
d->character->player.short_descr = (char *)strdup(arg); /* Sdesc mod
end */
db.c
store_to_char():
/* ch->player.short_descr = 0; Sdesc mod - delete */
...
if (*st->short_descr) { /* Sdesc mod - begin add */
CREATE(ch->player.short_descr, char,
strlen(st->short_descr) + 1);
strcpy(ch->player.short_descr, st->short_descr);
} else
ch->player.short_descr = 0; /* Sdesc mod - end add */
char_to_store():
if (ch->player.short_descr) /* Sdesc mod - begin add */
strcpy(st->short_descr, ch->player.short_descr);
else
*st->short_descr = '\0'; /* Sdesc mod - end add */
finally, structs.h:
#define CON_SDESC 18 /* Sdesc mod add */
char_file_u:
char short_descr[45]; /* Sdesc mod - add */
descriptor_data:
char *short_descr; /* Sdesc mod - add */
--
dcase@bcn.net - http://www.bcn.net/~dcase/ - Greenfield, MA
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST