From 1a18fb9893df4d3cb40910d41acf875c7c6ea773 Mon Sep 17 00:00:00 2001 From: ai4rei Date: Sun, 20 Mar 2011 20:19:23 +0000 Subject: * Random accumulated tweaks and fixes. - Added a error message to npc_enable, to spot disablenpc/enablenpc/hideoffnpc/hideonnpc on non-existing NPCs (related r14750). - Replaced inlined npc_name2id code with calls to npc_name2id. - Open Buying Store skill is now exempted from noskill mapflag like Vending as well (bugreport:4815, follow up to r14713). - Fixed signed constant being returned as unsigned value in get_percentage (bugreport:4765, since r12679). - Replaced strlen checks, which checked whether or not a string is empty, with first-byte checks. - Fixed enabling 'fakename' not clearing party and guild name and cleaned up atcommand 'fakename' code. - Cleaned up party/guild name code in clif_charnameack (follow up to r14737). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14751 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 40e6d9b71..29404a373 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7624,7 +7624,9 @@ int clif_refresh(struct map_session_data *sd) return 0; } -// updates the object's (bl) name on client +/// Updates the object's (bl) name on client (ZC_ACK_REQNAME/ZC_ACK_REQNAMEALL) +/// 0095 .L .24B +/// 0195 .L .24B .24B .24B .24B int clif_charnameack (int fd, struct block_list *bl) { unsigned char buf[103]; @@ -7647,24 +7649,31 @@ int clif_charnameack (int fd, struct block_list *bl) if (ssd->fd == fd && ssd->disguise) WBUFL(buf,2) = -bl->id; - if (strlen(ssd->fakename)>1) { + if( ssd->fakename[0] ) + { + WBUFW(buf, 0) = cmd = 0x195; memcpy(WBUFP(buf,6), ssd->fakename, NAME_LENGTH); + WBUFB(buf,30) = WBUFB(buf,54) = WBUFB(buf,78) = 0; break; } memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH); - - if (!battle_config.display_party_name) { - if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL) - p = party_search(ssd->status.party_id); - }else{ - if (ssd->status.party_id > 0) - p = party_search(ssd->status.party_id); - } - if( ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL ) + if( ssd->status.party_id ) + { + p = party_search(ssd->status.party_id); + } + if( ssd->status.guild_id ) { - ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id); - if( i < g->max_member ) ps = g->member[i].position; + if( ( g = guild_search(ssd->status.guild_id) ) != NULL ) + { + ARR_FIND(0, g->max_member, i, g->member[i].account_id == ssd->status.account_id && g->member[i].char_id == ssd->status.char_id); + if( i < g->max_member ) ps = g->member[i].position; + } + } + + if( !battle_config.display_party_name && g == NULL ) + {// do not display party unless the player is also in a guild + p = NULL; } if (p == NULL && g == NULL) @@ -7766,7 +7775,7 @@ int clif_charnameupdate (struct map_session_data *ssd) nullpo_ret(ssd); - if (strlen(ssd->fakename)>1) + if( ssd->fakename[0] ) return 0; //No need to update as the party/guild was not displayed anyway. WBUFW(buf,0) = cmd; -- cgit v1.2.3-60-g2f50