viewing paste Chat_fix Brathena | Diff

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
Index: chat.c
===================================================================
--- chat.c  (revision 2809)
+++ chat.c  (working copy)
@@ -64,7 +64,8 @@
        aFree(cd);
        return NULL;
    }
-
+       
+       
    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));
 }
Viewed 699 times, submitted by Guest.