summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/npc.c24
-rw-r--r--src/map/npc.h2
-rw-r--r--src/map/unit.c2
4 files changed, 11 insertions, 19 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 671609279..95b50fcb2 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -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;
diff --git a/src/map/npc.c b/src/map/npc.c
index ac5c88654..626344881 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -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)
- return 1;
- //Hidden/Disabled npc.
- if (nd->class_ < 0 || nd->sc.option&OPTION_INVISIBLE)
- return 1;
- break;
- default:
- return 1;
- }
+ 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;
switch(nd->bl.subtype) {
case SHOP:
diff --git a/src/map/npc.h b/src/map/npc.h
index e0d960211..8e8949cc5 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -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);
diff --git a/src/map/unit.c b/src/map/unit.c
index 19e01f2ea..ddd9fac3c 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -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;
}