diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/mob.c | 3 | ||||
-rw-r--r-- | src/map/npc.c | 36 |
2 files changed, 23 insertions, 16 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index ac7bbb380..4cf13e4cc 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -915,7 +915,8 @@ int mob_spawn (struct mob_data *md) md->sc.option = md->db->option; map_addblock(&md->bl); - clif_spawn(&md->bl); + if( map[md->bl.m].users ) + clif_spawn(&md->bl); skill_unit_move(&md->bl,tick,1); mobskill_use(md, tick, MSC_SPAWN); return 0; diff --git a/src/map/npc.c b/src/map/npc.c index a53d45dc8..af0699294 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -168,17 +168,14 @@ int npc_enable(const char* name, int flag) return 0; } - if (flag&1) - { + if (flag&1) { nd->sc.option&=~OPTION_INVISIBLE; clif_spawn(&nd->bl); - } - else if (flag&2) + } else if (flag&2) nd->sc.option&=~OPTION_HIDE; else if (flag&4) nd->sc.option|= OPTION_HIDE; - else //Can't change the view_data to invisible class because the view_data for all npcs is shared! [Skotlex] - { + else { //Can't change the view_data to invisible class because the view_data for all npcs is shared! [Skotlex] nd->sc.option|= OPTION_INVISIBLE; clif_clearunit_area(&nd->bl,CLR_OUTSIGHT); // Hack to trick maya purple card [Xazax] } @@ -1964,7 +1961,8 @@ struct npc_data* npc_add_warp(short from_mapid, short from_x, short from_y, shor status_set_viewdata(&nd->bl, nd->class_); status_change_init(&nd->bl); unit_dataset(&nd->bl); - clif_spawn(&nd->bl); + if( map[nd->bl.m].users ) + clif_spawn(&nd->bl); strdb_put(npcname_db, nd->exname, nd); return nd; @@ -2024,7 +2022,8 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const status_set_viewdata(&nd->bl, nd->class_); status_change_init(&nd->bl); unit_dataset(&nd->bl); - clif_spawn(&nd->bl); + if( map[nd->bl.m].users ) + clif_spawn(&nd->bl); strdb_put(npcname_db, nd->exname, nd); return strchr(start,'\n');// continue @@ -2131,7 +2130,8 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const status_change_init(&nd->bl); unit_dataset(&nd->bl); nd->ud.dir = dir; - clif_spawn(&nd->bl); + if( map[nd->bl.m].users ) + clif_spawn(&nd->bl); } else {// 'floating' shop? map_addiddb(&nd->bl); @@ -2343,7 +2343,8 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons if( class_ >= 0 ) { status_set_viewdata(&nd->bl, nd->class_); - clif_spawn(&nd->bl); + if( map[nd->bl.m].users ) + clif_spawn(&nd->bl); } } else @@ -2489,7 +2490,8 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch if( class_ >= 0 ) { status_set_viewdata(&nd->bl, nd->class_); - clif_spawn(&nd->bl); + if( map[nd->bl.m].users ) + clif_spawn(&nd->bl); } } else @@ -2567,7 +2569,8 @@ int npc_duplicate4instance(struct npc_data *snd, int m) status_set_viewdata(&wnd->bl, wnd->class_); status_change_init(&wnd->bl); unit_dataset(&wnd->bl); - clif_spawn(&wnd->bl); + if( map[wnd->bl.m].users ) + clif_spawn(&wnd->bl); strdb_put(npcname_db, wnd->exname, wnd); } else @@ -2684,7 +2687,8 @@ void npc_setdisplayname(struct npc_data* nd, const char* newname) nullpo_retv(nd); safestrncpy(nd->name, newname, sizeof(nd->name)); - clif_charnameack(0, &nd->bl); + if( map[nd->bl.m].users ) + clif_charnameack(0, &nd->bl); } /// Changes the display class of the npc. @@ -2698,10 +2702,12 @@ void npc_setclass(struct npc_data* nd, short class_) if( nd->class_ == class_ ) return; - clif_clearunit_area(&nd->bl, CLR_OUTSIGHT);// fade out + if( map[nd->bl.m].users ) + clif_clearunit_area(&nd->bl, CLR_OUTSIGHT);// fade out nd->class_ = class_; status_set_viewdata(&nd->bl, class_); - clif_spawn(&nd->bl);// fade in + if( map[nd->bl.m].users ) + clif_spawn(&nd->bl);// fade in } /// Parses a function. |