diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 3 | ||||
-rw-r--r-- | src/map/map.c | 2 | ||||
-rw-r--r-- | src/map/map.h | 7 | ||||
-rw-r--r-- | src/map/mercenary.c | 2 | ||||
-rw-r--r-- | src/map/mob.c | 6 | ||||
-rw-r--r-- | src/map/npc.c | 38 | ||||
-rw-r--r-- | src/map/pet.c | 1 | ||||
-rw-r--r-- | src/map/script.c | 12 | ||||
-rw-r--r-- | src/map/status.c | 4 | ||||
-rw-r--r-- | src/map/unit.c | 1 |
10 files changed, 36 insertions, 40 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 9f168522c..1c0a0b6ac 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1074,7 +1074,6 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un *------------------------------------------*/ static int clif_set_unit_spawned(struct block_list* bl, unsigned char* buf) { - struct status_change* sc = status_get_sc(bl); struct view_data* vd = status_get_viewdata(bl); if( pcdb_checkid(vd->class_) ) @@ -3583,7 +3582,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) uint8 buf[128]; struct unit_data *ud; struct view_data *vd; - int len, fd = sd->fd; + int len; vd = status_get_viewdata(bl); if (!vd || vd->class_ == INVISIBLE_CLASS) diff --git a/src/map/map.c b/src/map/map.c index e41cdad2c..5cff144b9 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1955,7 +1955,7 @@ void map_removenpc(void) clif_clearunit_area(&map[m].npc[i]->bl,2); map_delblock(&map[m].npc[i]->bl); idb_remove(id_db,map[m].npc[i]->bl.id); - if(map[m].npc[i]->bl.subtype==SCRIPT) { + if(map[m].npc[i]->subtype==SCRIPT) { aFree(map[m].npc[i]->u.scr.script); aFree(map[m].npc[i]->u.scr.label_list); } diff --git a/src/map/map.h b/src/map/map.h index 4258b3cb8..6f3b27c2b 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -189,7 +189,7 @@ enum bl_type { #define BL_CHAR (BL_PC|BL_MOB|BL_HOM) #define BL_ALL 0xfff -enum bl_subtype { WARP, SHOP, SCRIPT, MONS }; +enum npc_subtype { WARP, SHOP, SCRIPT }; enum { RC_FORMLESS=0, @@ -233,7 +233,6 @@ struct block_list { int id; short m,x,y; enum bl_type type; - enum bl_subtype subtype; }; struct walkpath_data { @@ -824,6 +823,7 @@ struct npc_data { struct unit_data ud; //Because they need to be able to move.... struct view_data *vd; struct status_change sc; //They can't have status changes, but.. they want the visual opt values. + struct npc_data *master_nd; short n; short class_; short speed; @@ -833,8 +833,7 @@ struct npc_data { unsigned int next_walktime; void* chatdb; // pointer to a npc_parse struct (see npc_chat.c) - struct npc_data *master_nd; - + enum npc_subtype subtype; union { struct { struct script_code *script; diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 2834f768e..0a9c4aab5 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -608,7 +608,6 @@ int merc_hom_alloc(struct map_session_data *sd, struct s_homunculus *hom) return 1; } sd->hd = hd = aCalloc(1,sizeof(struct homun_data)); - hd->bl.subtype = MONS; hd->bl.type = BL_HOM; hd->bl.id = npc_get_new_npc_id(); @@ -643,7 +642,6 @@ void merc_hom_init_timers(struct homun_data * hd) { if (hd->hungry_timer == -1) hd->hungry_timer = add_timer(gettick()+hd->homunculusDB->hungryDelay,merc_hom_hungry,hd->master->bl.id,0); - hd->ud.canact_tick = 0; //Reset can-act delay hd->regen.state.block = 0; //Restore HP/SP block. } diff --git a/src/map/mob.c b/src/map/mob.c index 236934c4a..00ef6f794 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -207,7 +207,6 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data) struct mob_data *md = aCalloc(1, sizeof(struct mob_data)); md->bl.id= npc_get_new_npc_id(); md->bl.type = BL_MOB; - md->bl.subtype = MONS; md->bl.m = data->m; md->bl.x = data->x; md->bl.y = data->y; @@ -889,10 +888,11 @@ static int mob_warpchase_sub(struct block_list *bl,va_list ap) target_nd= va_arg(ap, struct npc_data**); min_distance= va_arg(ap, int*); - if(bl->subtype != WARP) - return 0; //Not a warp nd = (TBL_NPC*) bl; + if(nd->subtype != WARP) + return 0; //Not a warp + if(nd->u.warp.mapindex != map[target->m].index) return 0; //Does not lead to the same map. diff --git a/src/map/npc.c b/src/map/npc.c index 89ab9e4cb..14cf398c4 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -725,7 +725,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y) continue; } - switch(map[m].npc[i]->bl.subtype) { + switch(map[m].npc[i]->subtype) { case WARP: xs=map[m].npc[i]->u.warp.xs; ys=map[m].npc[i]->u.warp.ys; @@ -746,7 +746,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int m, int x, int y) ShowError("npc_touch_areanpc : some bug \n"); return 1; } - switch(map[m].npc[i]->bl.subtype) { + switch(map[m].npc[i]->subtype) { case WARP: // hidden chars cannot use warps -- is it the same for scripts too? if (sd->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) || @@ -785,7 +785,7 @@ int npc_touch_areanpc2(struct block_list* bl) if (map[m].npc[i]->sc.option&OPTION_INVISIBLE) continue; - if (map[m].npc[i]->bl.subtype!=WARP) + if (map[m].npc[i]->subtype!=WARP) continue; xs=map[m].npc[i]->u.warp.xs; @@ -840,7 +840,7 @@ int npc_check_areanpc(int flag, int m, int x, int y, int range) if (map[m].npc[i]->sc.option&OPTION_INVISIBLE) continue; - switch(map[m].npc[i]->bl.subtype) + switch(map[m].npc[i]->subtype) { case WARP: if (!(flag&1)) @@ -949,7 +949,7 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd) if (nd->class_ < 0 || nd->sc.option&(OPTION_INVISIBLE|OPTION_HIDE)) return 1; - switch(nd->bl.subtype) { + switch(nd->subtype) { case SHOP: clif_npcbuysell(sd,nd->bl.id); break; @@ -1000,7 +1000,7 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type) if ((nd = npc_checknear(sd,map_id2bl(id))) == NULL) return 1; - if (nd->bl.subtype!=SHOP) { + if (nd->subtype!=SHOP) { ShowError("no such shop npc : %d\n",id); if (sd->npc_id == id) sd->npc_id=0; @@ -1052,7 +1052,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list) if (nd->master_nd) //Script-based shops. return npc_buylist_sub(sd,n,item_list,nd->master_nd); - if (nd->bl.subtype!=SHOP) + if (nd->subtype!=SHOP) return 3; for(i=0,w=0,z=0;i<n;i++) { @@ -1228,7 +1228,7 @@ int npc_remove_map(struct npc_data* nd) return 1; //Not assigned to a map. m = nd->bl.m; clif_clearunit_area(&nd->bl,2); - if (nd->bl.subtype == WARP) + if (nd->subtype == WARP) {// Remove corresponding NPC CELLs int j, xs, ys, x, y; x = nd->bl.x; @@ -1269,7 +1269,7 @@ static int npc_unload_dup_sub(DBKey key, void* data, va_list ap) struct npc_data *nd = (struct npc_data *)data; int src_id; - if(nd->bl.type!=BL_NPC || nd->bl.subtype != SCRIPT) + if(nd->bl.type!=BL_NPC || nd->subtype != SCRIPT) return 0; src_id=va_arg(ap,int); @@ -1299,10 +1299,10 @@ int npc_unload(struct npc_data* nd) npc_chat_finalize(nd); // deallocate npc PCRE data structures #endif - if( nd->bl.subtype == SHOP ) + if( nd->subtype == SHOP ) aFree(nd->u.shop.shop_item); else - if( nd->bl.subtype == SCRIPT ) + if( nd->subtype == SCRIPT ) { ev_db->foreach(ev_db,npc_unload_ev,nd->exname); //Clean up all events related. if (nd->u.scr.timerid != -1) { @@ -1508,7 +1508,7 @@ struct npc_data* npc_add_warp(short from_mapid, short from_x, short from_y, shor nd->u.warp.xs = xs; nd->u.warp.ys = xs; nd->bl.type = BL_NPC; - nd->bl.subtype = WARP; + nd->subtype = WARP; npc_setcells(nd); map_addblock(&nd->bl); status_set_viewdata(&nd->bl, nd->class_); @@ -1568,7 +1568,7 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const nd->u.warp.ys = ys; npc_warp++; nd->bl.type = BL_NPC; - nd->bl.subtype = WARP; + nd->subtype = WARP; npc_setcells(nd); map_addblock(&nd->bl); status_set_viewdata(&nd->bl, nd->class_); @@ -1653,7 +1653,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const ++npc_shop; nd->bl.type = BL_NPC; - nd->bl.subtype = SHOP; + nd->subtype = SHOP; if( m >= 0 ) {// normal shop npc nd->n = map_addnpc(m,nd); @@ -1888,7 +1888,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons ++npc_script; nd->bl.type = BL_NPC; - nd->bl.subtype = SCRIPT; + nd->subtype = SCRIPT; if( m >= 0 ) { @@ -1969,7 +1969,7 @@ void npc_setcells(struct npc_data* nd) int m = nd->bl.m, x = nd->bl.x, y = nd->bl.y, xs, ys; int i,j; - if (nd->bl.subtype == WARP) { + if (nd->subtype == WARP) { xs = nd->u.warp.xs; ys = nd->u.warp.ys; } else { @@ -2003,7 +2003,7 @@ void npc_unsetcells(struct npc_data* nd) int m = nd->bl.m, x = nd->bl.x, y = nd->bl.y, xs, ys; int i,j, x0, x1, y0, y1; - if (nd->bl.subtype == WARP) { + if (nd->subtype == WARP) { xs = nd->u.warp.xs; ys = nd->u.warp.ys; } else { @@ -2862,7 +2862,7 @@ int do_final_npc(void) static void npc_debug_warps_sub(struct npc_data* nd) { int m; - if (nd->bl.type != BL_NPC || nd->bl.subtype != WARP || nd->bl.m < 0) + if (nd->bl.type != BL_NPC || nd->subtype != WARP || nd->bl.m < 0) return; m = map_mapindex2mapid(nd->u.warp.mapindex); @@ -2952,7 +2952,7 @@ int do_init_npc(void) npc_script++; fake_nd->bl.type = BL_NPC; - fake_nd->bl.subtype = SCRIPT; + fake_nd->subtype = SCRIPT; strdb_put(npcname_db, fake_nd->exname, fake_nd); fake_nd->u.scr.timerid = -1; diff --git a/src/map/pet.c b/src/map/pet.c index 592eee4c0..fc4dd3875 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -395,7 +395,6 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *pet) pd->bl.y = pd->ud.to_y; pd->bl.id = npc_get_new_npc_id(); pd->db = mob_db(pet->class_); - pd->bl.subtype = MONS; pd->bl.type = BL_PET; pd->msd = sd; status_set_viewdata(&pd->bl, pet->class_); diff --git a/src/map/script.c b/src/map/script.c index 7d0a4b780..ff10c853a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11691,7 +11691,7 @@ BUILDIN_FUNC(callshop) if( script_hasdata(st,3) ) flag = script_getnum(st,3); nd = npc_name2id(shopname); - if (!nd || nd->bl.type!=BL_NPC || nd->bl.subtype!=SHOP) { + if (!nd || nd->bl.type!=BL_NPC || nd->subtype!=SHOP) { ShowError("buildin_callshop: Shop [%s] not found (or NPC is not shop type)\n", shopname); script_pushint(st,0); return 1; @@ -11720,7 +11720,7 @@ BUILDIN_FUNC(npcshopitem) int n, i; int amount; - if( !nd || nd->bl.subtype != SHOP ) + if( !nd || nd->subtype != SHOP ) { //Not found. script_pushint(st,0); return 0; @@ -11749,7 +11749,7 @@ BUILDIN_FUNC(npcshopadditem) int n, i; int amount; - if( !nd || nd->bl.subtype != SHOP ) + if( !nd || nd->subtype != SHOP ) { //Not found. script_pushint(st,0); return 0; @@ -11778,7 +11778,7 @@ BUILDIN_FUNC(npcshopdelitem) int amount; int size; - if( !nd || nd->bl.subtype != SHOP ) + if( !nd || nd->subtype != SHOP ) { //Not found. script_pushint(st,0); return 0; @@ -11815,7 +11815,7 @@ BUILDIN_FUNC(npcshopattach) if( script_hasdata(st,3) ) flag = script_getnum(st,3); - if( !nd || nd->bl.subtype != SHOP ) + if( !nd || nd->subtype != SHOP ) { //Not found. script_pushint(st,0); return 0; @@ -12708,7 +12708,7 @@ BUILDIN_FUNC(getvariableofnpc) } nd = npc_name2id(script_getstr(st,3)); - if( nd == NULL || nd->bl.subtype != SCRIPT || nd->u.scr.script == NULL ) + if( nd == NULL || nd->subtype != SCRIPT || nd->u.scr.script == NULL ) {// NPC not found or has no script ShowError("script:getvariableofnpc: can't find npc %s\n", script_getstr(st,3)); script_pushnil(st); diff --git a/src/map/status.c b/src/map/status.c index 8a04109b3..b7221ea6e 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4180,7 +4180,7 @@ int status_get_guild_id(struct block_list *bl) return ((TBL_HOM*)bl)->master->status.guild_id; break; case BL_NPC: - if (bl->subtype == SCRIPT) + if (((TBL_NPC*)bl)->subtype == SCRIPT) return ((TBL_NPC*)bl)->u.scr.guild_id; break; case BL_SKILL: @@ -4214,7 +4214,7 @@ int status_get_emblem_id(struct block_list *bl) return ((TBL_HOM*)bl)->master->guild_emblem_id; break; case BL_NPC: - if (bl->subtype == SCRIPT && ((TBL_NPC*)bl)->u.scr.guild_id > 0) { + if (((TBL_NPC*)bl)->subtype == SCRIPT && ((TBL_NPC*)bl)->u.scr.guild_id > 0) { struct guild *g = guild_search(((TBL_NPC*)bl)->u.scr.guild_id); if (g) return g->emblem_id; diff --git a/src/map/unit.c b/src/map/unit.c index 21cdb61fe..0dd464a67 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1724,6 +1724,7 @@ int unit_remove_map(struct block_list *bl, int clrtype) } } else if (bl->type == BL_HOM) { struct homun_data *hd = (struct homun_data *) bl; + ud->canact_tick = ud->canmove_tick; //It appears HOM do reset the can-act tick. if(!hd->homunculus.intimacy && !(hd->master && hd->master->state.waitingdisconnect) ) { //If logging out, this is deleted on unit_free |