[May 27 2008] - Rumble

Fixed list_obj_to_char from only checking invisibility on first object of the same vnum. (thanks Laoris)
  Added object stacking when looking at a character's inventory. (thanks Jamdog)
[May 22 2008] - Rumble
  Added zone name to where command. (thanks Jamdog)
[May 21 2008] - Rumble
  Rewrite of void script_vlog to prevent possible crash bug on some OS's. (thanks Jamdog)
This commit is contained in:
Rumble 2008-05-27 19:39:32 +00:00
parent 37c7e2fb0c
commit c486097e81
3 changed files with 79 additions and 61 deletions

View file

@ -3,6 +3,13 @@ help, find any bugs, or have ideas for improvement please stop by TBA at
telnet://tbamud.com:9091 or email rumble@tbamud.com --Rumble telnet://tbamud.com:9091 or email rumble@tbamud.com --Rumble
tbaMUD 3.56 tbaMUD 3.56
[May 27 2008] - Rumble
Fixed list_obj_to_char from only checking invisibility on first object of the same vnum. (thanks Laoris)
Added object stacking when looking at a character's inventory. (thanks Jamdog)
[May 22 2008] - Rumble
Added zone name to where command. (thanks Jamdog)
[May 21 2008] - Rumble
Rewrite of void script_vlog to prevent possible crash bug on some OS's. (thanks Jamdog)
[May 17 2008] - Rumble [May 17 2008] - Rumble
Fixed a possible crash bug in qedit. (thanks Jamdog) Fixed a possible crash bug in qedit. (thanks Jamdog)
Bug fix: Page command was paging when the character was not found and sending a NOPERSON message when he was found. Bug fix: Page command was paging when the character was not found and sending a NOPERSON message when he was found.

View file

@ -170,37 +170,53 @@ static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch)
send_to_char(ch, " ..It emits a faint humming sound!"); send_to_char(ch, " ..It emits a faint humming sound!");
} }
static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show) static void list_obj_to_char(struct obj_data *list, struct char_data *ch, int mode, int show)
{ {
struct obj_data *i, *j; struct obj_data *i, *j, *display;
bool found; bool found;
int num; int num;
found = FALSE; found = FALSE;
for (i = list; i; i = i->next_content) { /* Loop through the list of objects */
num = 0; for (i = list; i; i = i->next_content) {
for (j = list; j != i; j = j->next_content) num = 0;
if (!strcmp(j->short_description, i->short_description) && (!strcmp(j->name, i->name)))
break; /* Check the list to see if we've already counted this object */
if (j != i) for (j = list; j != i; j = j->next_content)
continue; if ((j->short_description == i->short_description && j->name == i->name) ||
for (j = i; j; j = j->next_content) (!strcmp(j->short_description, i->short_description) && !strcmp(j->name, i->name)))
if (!strcmp(j->short_description, i->short_description) && (!strcmp(j->name, i->name))) break; /* found a matching object */
num++; if (j != i)
if (CAN_SEE_OBJ(ch, i) && (*i->description != '.' || (IS_NPC(ch) || PRF_FLAGGED(ch, PRF_HOLYLIGHT)))) { continue; /* we counted object i earlier in the list */
/* Count matching objects, including this one */
for (display = j = i; j; j = j->next_content)
/* This if-clause should be exactly the same as the one in the loop above */
if ((j->short_description == i->short_description && j->name == i->name) ||
(!strcmp(j->short_description, i->short_description) && !strcmp(j->name, i->name)))
if (CAN_SEE_OBJ(ch, j)) {
++num;
/* If the original item can't be seen, switch it for this one */
if (display == i && !CAN_SEE_OBJ(ch, display))
display = j;
}
/* When looking in room, hide objects starting with '.', except for holylight */
if (num > 0 && (mode != SHOW_OBJ_LONG || *display->description != '.' ||
(!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_HOLYLIGHT)))) {
if (mode == SHOW_OBJ_LONG) if (mode == SHOW_OBJ_LONG)
send_to_char(ch, "%s", CCGRN(ch, C_NRM)); send_to_char(ch, "%s", CCGRN(ch, C_NRM));
if (num != 1) if (num != 1)
send_to_char(ch, "(%2i) ", num); send_to_char(ch, "(%2i) ", num);
show_obj_to_char(i, ch, mode); show_obj_to_char(display, ch, mode);
send_to_char(ch, "%s", CCNRM(ch, C_NRM)); send_to_char(ch, "%s", CCNRM(ch, C_NRM));
found = TRUE; found = TRUE;
} }
} }
if (!found && show) if (!found && show)
send_to_char(ch, " Nothing.\r\n"); send_to_char(ch, " Nothing.\r\n");
} }
static void diag_char_to_char(struct char_data *i, struct char_data *ch) static void diag_char_to_char(struct char_data *i, struct char_data *ch)
{ {
@ -261,18 +277,9 @@ static void look_at_char(struct char_data *i, struct char_data *ch)
show_obj_to_char(GET_EQ(i, j), ch, SHOW_OBJ_SHORT); show_obj_to_char(GET_EQ(i, j), ch, SHOW_OBJ_SHORT);
} }
} }
if (ch != i && (IS_THIEF(ch) || GET_LEVEL(ch) >= LVL_IMMORT)) { if (ch != i && (IS_THIEF(ch) || GET_LEVEL(ch) >= LVL_IMMORT)) {
found = FALSE; act("\r\nYou attempt to peek at $s inventory:", FALSE, i, 0, ch, TO_VICT);
act("\r\nYou attempt to peek at $s inventory:", FALSE, i, 0, ch, TO_VICT); list_obj_to_char(i->carrying, ch, SHOW_OBJ_SHORT, TRUE);
for (tmp_obj = i->carrying; tmp_obj; tmp_obj = tmp_obj->next_content) {
if (CAN_SEE_OBJ(ch, tmp_obj) && (rand_number(0, 20) < GET_LEVEL(ch))) {
show_obj_to_char(tmp_obj, ch, SHOW_OBJ_SHORT);
found = TRUE;
}
}
if (!found)
send_to_char(ch, "You can't see anything.\r\n");
} }
} }
@ -1521,9 +1528,11 @@ static void perform_mortal_where(struct char_data *ch, char *arg)
{ {
struct char_data *i; struct char_data *i;
struct descriptor_data *d; struct descriptor_data *d;
int j;
if (!*arg) { if (!*arg) {
send_to_char(ch, "Players in your Zone\r\n--------------------\r\n"); j = world[(IN_ROOM(ch))].zone;
send_to_char(ch, "Players in %s@n.\r\n--------------------\r\n", zone_table[j].name);
for (d = descriptor_list; d; d = d->next) { for (d = descriptor_list; d; d = d->next) {
if (STATE(d) != CON_PLAYING || d->character == ch) if (STATE(d) != CON_PLAYING || d->character == ch)
continue; continue;
@ -1587,17 +1596,21 @@ static void perform_immort_where(struct char_data *ch, char *arg)
int num = 0, found = 0; int num = 0, found = 0;
if (!*arg) { if (!*arg) {
send_to_char(ch, "Players\r\n-------\r\n"); send_to_char(ch, "Players Room Location Zone\r\n");
send_to_char(ch, "-------- ------- ------------------------------ -------------------\r\n");
for (d = descriptor_list; d; d = d->next) for (d = descriptor_list; d; d = d->next)
if (IS_PLAYING(d)) { if (IS_PLAYING(d)) {
i = (d->original ? d->original : d->character); i = (d->original ? d->original : d->character);
if (i && CAN_SEE(ch, i) && (IN_ROOM(i) != NOWHERE)) { if (i && CAN_SEE(ch, i) && (IN_ROOM(i) != NOWHERE)) {
if (d->original) if (d->original)
send_to_char(ch, "%-20s%s - [%5d] %s%s (in %s%s)\r\n", send_to_char(ch, "%-8s%s - [%5d] %s%s (in %s%s)\r\n",
GET_NAME(i), QNRM, GET_ROOM_VNUM(IN_ROOM(d->character)), GET_NAME(i), QNRM, GET_ROOM_VNUM(IN_ROOM(d->character)),
world[IN_ROOM(d->character)].name, QNRM, GET_NAME(d->character), QNRM); world[IN_ROOM(d->character)].name, QNRM, GET_NAME(d->character), QNRM);
else else
send_to_char(ch, "%-20s%s - [%5d] %s%s\r\n", GET_NAME(i), QNRM, GET_ROOM_VNUM(IN_ROOM(i)), world[IN_ROOM(i)].name, QNRM); send_to_char(ch, "%-8s%s %s[%s%5d%s]%s %-*s%s %s%s\r\n", GET_NAME(i), QNRM,
QCYN, QYEL, GET_ROOM_VNUM(IN_ROOM(i)), QCYN, QNRM,
30+count_color_chars(world[IN_ROOM(i)].name), world[IN_ROOM(i)].name, QNRM,
zone_table[(world[IN_ROOM(i)].zone)].name, QNRM);
} }
} }
} else { } else {

View file

@ -1290,26 +1290,24 @@ void script_vlog(const char *format, va_list args)
char output[MAX_STRING_LENGTH]; char output[MAX_STRING_LENGTH];
struct descriptor_data *i; struct descriptor_data *i;
snprintf(output, sizeof(output), "SCRIPT ERR: %s", format); /* parse the args, making the error message */
vsnprintf(output, sizeof(output) - 2, format, args);
basic_mud_vlog(output, args); /* Save to the syslog file */
basic_mud_log("SCRIPT ERROR: %s", output);
/* the rest is mostly a rip from basic_mud_log() */ /* And send to imms */
strcpy(output, "[ "); /* strcpy: OK */ for (i = descriptor_list; i; i = i->next) {
vsnprintf(output + 2, sizeof(output) - 6, format, args); if (STATE(i) != CON_PLAYING || IS_NPC(i->character)) /* switch */
strcat(output, " ]\r\n"); /* strcat: OK */ continue;
if (GET_LEVEL(i->character) < LVL_BUILDER)
continue;
if (PLR_FLAGGED(i->character, PLR_WRITING))
continue;
if (NRM > (PRF_FLAGGED(i->character, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(i->character, PRF_LOG2) ? 2 : 0))
continue;
for (i = descriptor_list; i; i = i->next) { send_to_char(i->character, "%s[ %s ]%s\r\n", CCGRN(i->character, C_NRM), output, CCNRM(i->character, C_NRM));
if (STATE(i) != CON_PLAYING || IS_NPC(i->character)) /* switch */
continue;
if (GET_LEVEL(i->character) < LVL_BUILDER)
continue;
if (PLR_FLAGGED(i->character, PLR_WRITING))
continue;
if (NRM > (PRF_FLAGGED(i->character, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(i->character, PRF_LOG2) ? 2 : 0))
continue;
send_to_char(i->character, "%s%s%s", CCGRN(i->character, C_NRM), output, CCNRM(i->character, C_NRM));
} }
} }