Fixed a client issue that was causing duplicate new lines

This commit is contained in:
Vatiken 2012-06-27 02:14:22 +00:00
parent 1d4fb13044
commit debf92811f
2 changed files with 14 additions and 2 deletions

View file

@ -156,6 +156,7 @@ char *fread_action(FILE *fl, int nr)
{
char buf[MAX_STRING_LENGTH];
char *buf1;
int i;
buf1 = fgets(buf, MAX_STRING_LENGTH, fl);
if (feof(fl)) {
@ -169,7 +170,15 @@ char *fread_action(FILE *fl, int nr)
return (NULL);
parse_at(buf);
buf[strlen(buf) - 1] = '\0';
/* Some clients interpret '\r' the same as { '\r' '\n' }, so the original way of just
replacing '\n' with '\0' would appear as 2 new lines following the action */
for (i = 0; buf[i] != '\0'; i++)
if (buf[i] == '\r' || buf[i] == '\n') {
buf[i] = '\0';
break;
}
return (strdup(buf));
}

View file

@ -263,7 +263,10 @@ void perform_obj_aff_list(struct char_data * ch, char *arg)
if ((apply == APPLY_CLASS && obj_proto[num].obj_flags.type_flag == ITEM_WEAPON) ||
(apply == APPLY_LEVEL && obj_proto[num].obj_flags.type_flag == ITEM_ARMOR) ) {
ov = obj_index[num].vnum;
if (apply == APPLY_CLASS)
v1 = ((obj_proto[num].obj_flags.value[2]+1)*(obj_proto[num].obj_flags.value[1])/2);
else
v1 = (obj_proto[num].obj_flags.value[0]);
if ((r_num = real_object(ov)) != NOTHING)
add_to_obj_list(lst, MAX_OBJ_LIST, ov, v1);