[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
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
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.

View file

@ -172,28 +172,44 @@ static void show_obj_modifiers(struct obj_data *obj, struct char_data *ch)
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;
int num;
found = FALSE;
/* Loop through the list of objects */
for (i = list; i; i = i->next_content) {
num = 0;
/* Check the list to see if we've already counted this object */
for (j = list; j != i; j = j->next_content)
if (!strcmp(j->short_description, i->short_description) && (!strcmp(j->name, i->name)))
break;
if ((j->short_description == i->short_description && j->name == i->name) ||
(!strcmp(j->short_description, i->short_description) && !strcmp(j->name, i->name)))
break; /* found a matching object */
if (j != i)
continue;
for (j = i; j; j = j->next_content)
if (!strcmp(j->short_description, i->short_description) && (!strcmp(j->name, i->name)))
num++;
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)
send_to_char(ch, "%s", CCGRN(ch, C_NRM));
if (num != 1)
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));
found = TRUE;
}
@ -262,17 +278,8 @@ static void look_at_char(struct char_data *i, struct char_data *ch)
}
}
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);
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");
list_obj_to_char(i->carrying, ch, SHOW_OBJ_SHORT, TRUE);
}
}
@ -1521,9 +1528,11 @@ static void perform_mortal_where(struct char_data *ch, char *arg)
{
struct char_data *i;
struct descriptor_data *d;
int j;
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) {
if (STATE(d) != CON_PLAYING || d->character == ch)
continue;
@ -1587,17 +1596,21 @@ static void perform_immort_where(struct char_data *ch, char *arg)
int num = 0, found = 0;
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)
if (IS_PLAYING(d)) {
i = (d->original ? d->original : d->character);
if (i && CAN_SEE(ch, i) && (IN_ROOM(i) != NOWHERE)) {
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)),
world[IN_ROOM(d->character)].name, QNRM, GET_NAME(d->character), QNRM);
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 {

View file

@ -1290,15 +1290,13 @@ void script_vlog(const char *format, va_list args)
char output[MAX_STRING_LENGTH];
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);
/* the rest is mostly a rip from basic_mud_log() */
strcpy(output, "[ "); /* strcpy: OK */
vsnprintf(output + 2, sizeof(output) - 6, format, args);
strcat(output, " ]\r\n"); /* strcat: OK */
/* Save to the syslog file */
basic_mud_log("SCRIPT ERROR: %s", output);
/* And send to imms */
for (i = descriptor_list; i; i = i->next) {
if (STATE(i) != CON_PLAYING || IS_NPC(i->character)) /* switch */
continue;
@ -1309,7 +1307,7 @@ void script_vlog(const char *format, va_list args)
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));
send_to_char(i->character, "%s[ %s ]%s\r\n", CCGRN(i->character, C_NRM), output, CCNRM(i->character, C_NRM));
}
}