- Changed npc_click declaration to receive an npc structure rather than a generic block-list one.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7925 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-07-27 16:28:00 +00:00
parent a74b39c5c6
commit 8da82e0a0a
4 changed files with 11 additions and 19 deletions

View File

@ -9353,7 +9353,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
clif_parse_ActionRequest_sub(sd, 0x07, bl->id, gettick());
break;
case BL_NPC:
npc_click(sd,bl);
npc_click(sd,(TBL_NPC*)bl);
break;
}
return;

View File

@ -969,7 +969,7 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y)
if( npc_event(sd,name,0)>0 ) {
pc_stop_walking(sd,1); //Make it stop walking!
npc_click(sd,&(map[m].npc[i]->bl));
npc_click(sd,map[m].npc[i]);
}
//aFree(name);
break;
@ -1082,10 +1082,8 @@ int npc_globalmessage(const char *name,char *mes)
* NPC処理
*------------------------------------------
*/
int npc_click(struct map_session_data *sd,struct block_list *bl)
int npc_click(struct map_session_data *sd,struct npc_data *nd)
{
struct npc_data *nd = NULL;
nullpo_retr(1, sd);
if (sd->npc_id != 0) {
@ -1094,18 +1092,12 @@ int npc_click(struct map_session_data *sd,struct block_list *bl)
return 1;
}
if(!bl) return 1;
switch(bl->type){
case BL_NPC:
if ((nd = npc_checknear(sd,bl)) == NULL)
if(!nd) return 1;
if ((nd = npc_checknear(sd,&nd->bl)) == NULL)
return 1;
//Hidden/Disabled npc.
if (nd->class_ < 0 || nd->sc.option&OPTION_INVISIBLE)
return 1;
break;
default:
return 1;
}
switch(nd->bl.subtype) {
case SHOP:

View File

@ -41,7 +41,7 @@ int npc_timer_event(const unsigned char *eventname); // Added by RoVeRT
int npc_command(struct map_session_data *sd,const unsigned char *npcname,char *command);
int npc_touch_areanpc(struct map_session_data *,int,int,int);
int npc_touch_areanpc2(struct block_list *bl); // [Skotlex]
int npc_click(struct map_session_data *sd,struct block_list *bl);
int npc_click(struct map_session_data *sd,struct npc_data *nd);
int npc_scriptcont(struct map_session_data *,int);
TBL_NPC *npc_checknear(struct map_session_data *sd,struct block_list *bl);
int npc_checknear2(struct map_session_data *sd,struct block_list *bl);

View File

@ -1097,7 +1097,7 @@ int unit_attack(struct block_list *src,int target_id,int type)
}
if(src->type == BL_PC && target->type==BL_NPC) { // monster npcs [Valaris]
npc_click((TBL_PC*)src,target); // submitted by leinsirk10 [Celest]
npc_click((TBL_PC*)src,(TBL_NPC*)target); // submitted by leinsirk10 [Celest]
return 0;
}