Index: chat.c =================================================================== --- chat.c (revision 2809) +++ chat.c (working copy) @@ -64,7 +64,8 @@ aFree(cd); return NULL; } - + cd->usersd[0]=NULL; + cd->users = 0; map->addiddb(&cd->bl); if(bl->type != BL_NPC) @@ -126,7 +127,7 @@ nullpo_ret(sd); cd = (struct chat_data *)map->id2bl(chatid); - if(cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m || sd->state.vending || sd->state.buyingstore || sd->chatID || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit) { + if(cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m || sd->state.vending || sd->state.buyingstore || sd->chatID || cd->users >= cd->limit) { clif_joinchatfail(sd,0); return false; } @@ -382,7 +383,7 @@ } cd = chat_createchat(&nd->bl, title, "", limit, pub, trigger, ev, zeny, minLvl, maxLvl); - + if(cd) { nd->chat_id = cd->bl.id; clif_dispchat(cd,0); Index: clif.c =================================================================== --- clif.c (revision 2809) +++ clif.c (working copy) @@ -3713,7 +3713,7 @@ WBUFL(buf, 4) = cd->owner->id; WBUFL(buf, 8) = cd->bl.id; WBUFW(buf,12) = cd->limit; - WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users; + WBUFW(buf,14) = cd->users; WBUFB(buf,16) = type; memcpy((char *)WBUFP(buf,17), cd->title, strlen(cd->title)); // not zero-terminated @@ -3813,7 +3813,7 @@ void clif_joinchatok(struct map_session_data *sd,struct chat_data *cd) { int fd; - int i,t; + int i; nullpo_retv(sd); nullpo_retv(cd); @@ -3821,10 +3821,10 @@ fd = sd->fd; if(!session_isActive(fd)) return; - t = (int)(cd->owner->type == BL_NPC); - WFIFOHEAD(fd, 8 + (28*(cd->users+t))); + + WFIFOHEAD(fd, 8 + (28*(cd->users))); WFIFOW(fd, 0) = 0xdb; - WFIFOW(fd, 2) = 8 + (28*(cd->users+t)); + WFIFOW(fd, 2) = 8 + (28*(cd->users)); WFIFOL(fd, 4) = cd->bl.id; if(cd->owner->type == BL_NPC) { @@ -3833,12 +3833,12 @@ memcpy(WFIFOP(fd, 12), ((struct npc_data *)cd->owner)->name, NAME_LENGTH); for(i = 0; i < cd->users; i++) { WFIFOL(fd, 8+(i+1)*28) = 1; - memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, NAME_LENGTH); + memcpy(WFIFOP(fd, 8+i*28+4), cd->usersd[i]->status.name, NAME_LENGTH); } } else for(i = 0; i < cd->users; i++) { WFIFOL(fd, 8+i*28) = (i != 0 || cd->owner->type == BL_NPC); - memcpy(WFIFOP(fd, 8+(i+t)*28+4), cd->usersd[i]->status.name, NAME_LENGTH); + memcpy(WFIFOP(fd, 8+i*28+4), cd->usersd[i]->status.name, NAME_LENGTH); } WFIFOSET(fd, WFIFOW(fd, 2)); }