From 6e6ee08f7a162e128eae4e28ff983954990a2fdf Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 20 Sep 2006 16:03:58 +0000 Subject: - A mob's HP is set temporarily to 0 before invoking it's on-death script, prevents said scripts being able to "rekill" the mob indefinitely (if stuff like killmonster is used within) - Some small cleanups in chat.c git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8829 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/chat.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'src/map/chat.c') diff --git a/src/map/chat.c b/src/map/chat.c index a1bb7a293..40050073d 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -120,8 +120,10 @@ int chat_leavechat(struct map_session_data *sd) nullpo_retr(1, sd); cd=(struct chat_data*)map_id2bl(sd->chatID); - if(cd==NULL) + if(cd==NULL) { + sd->chatID = 0; return 1; + } for(i = 0,leavechar=-1;i < cd->users;i++){ if(cd->usersd[i] == sd){ @@ -129,8 +131,11 @@ int chat_leavechat(struct map_session_data *sd) break; } } - if(leavechar<0) // そのchatに所属していないらしい (バグ時のみ) + if(leavechar<0) + { //Not found in the chatroom? + sd->chatID = 0; return -1; + } if(leavechar==0 && cd->users>1 && (*cd->owner)->type==BL_PC){ // 所有者だった&他に人が居る&PCのチャット @@ -148,18 +153,19 @@ int chat_leavechat(struct map_session_data *sd) //Delete empty chatroom clif_clearchat(cd,0); map_delobject(cd->bl.id); - } else { - for(i=leavechar;i < cd->users;i++) - cd->usersd[i] = cd->usersd[i+1]; - if(leavechar==0 && (*cd->owner)->type==BL_PC){ - //Adjust Chat location after owner has been changed. - map_delblock( &cd->bl ); - cd->bl.x=cd->usersd[0]->bl.x; - cd->bl.y=cd->usersd[0]->bl.y; - map_addblock( &cd->bl ); - } - clif_dispchat(cd,0); + return 1; + } + for(i=leavechar;i < cd->users;i++) + cd->usersd[i] = cd->usersd[i+1]; + + if(leavechar==0 && (*cd->owner)->type==BL_PC){ + //Adjust Chat location after owner has been changed. + map_delblock( &cd->bl ); + cd->bl.x=cd->usersd[0]->bl.x; + cd->bl.y=cd->usersd[0]->bl.y; + map_addblock( &cd->bl ); } + clif_dispchat(cd,0); return 0; } @@ -194,7 +200,7 @@ int chat_changechatowner(struct map_session_data *sd,char *nextownername) clif_clearchat(cd,0); // userlistの順番変更 (0が所有者なので) - if( (tmp_sd = cd->usersd[0]) == NULL ) + if( (tmp_sd = cd->usersd[0]) == NULL ) //FIXME: How is this even possible!? Invoking character should be owner, hence, it SHOULD be on sc->usersd[0]! return 1; //ありえるのかな? cd->usersd[0] = cd->usersd[nextowner]; cd->usersd[nextowner] = tmp_sd; -- cgit v1.2.3-60-g2f50