diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-24 15:54:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-24 15:55:01 +0300 |
commit | 276a84c7de26e9bdc3e89dfc5bd4bdc5c61ed77d (patch) | |
tree | e119fd0f5f53a583f0ad7455ad3959a43d188ab4 /src/map | |
parent | 7a867315dac6aaf78a4d61ea67174820a4d30c59 (diff) | |
download | hercules-276a84c7de26e9bdc3e89dfc5bd4bdc5c61ed77d.tar.gz hercules-276a84c7de26e9bdc3e89dfc5bd4bdc5c61ed77d.tar.bz2 hercules-276a84c7de26e9bdc3e89dfc5bd4bdc5c61ed77d.tar.xz hercules-276a84c7de26e9bdc3e89dfc5bd4bdc5c61ed77d.zip |
Add bl parameter to map_searchrandfreecell and map_addflooritem.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/map.c | 8 | ||||
-rw-r--r-- | src/map/map.h | 4 | ||||
-rw-r--r-- | src/map/mob.c | 4 | ||||
-rw-r--r-- | src/map/pc.c | 4 | ||||
-rw-r--r-- | src/map/pet.c | 12 | ||||
-rw-r--r-- | src/map/script.c | 16 | ||||
-rw-r--r-- | src/map/skill.c | 20 |
8 files changed, 35 insertions, 35 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 4e4cd8aa7..7277f8f08 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -5420,7 +5420,7 @@ void atcommand_getring(struct map_session_data* sd) { if((flag = pc->additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) { clif->additem(sd,0,0,flag); - map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } diff --git a/src/map/map.c b/src/map/map.c index ddb5ace42..249108878 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1397,7 +1397,7 @@ void map_clearflooritem(struct block_list *bl) { * to place an BL_ITEM object. Scan area is 9x9, returns 1 on success. * x and y are modified with the target cell when successful. *------------------------------------------*/ -int map_searchrandfreecell(int16 m,int16 *x,int16 *y,int stack) { +int map_searchrandfreecell(int16 m, const struct block_list *bl, int16 *x, int16 *y, int stack) { int free_cell,i,j; int free_cells[9][2]; @@ -1407,7 +1407,7 @@ int map_searchrandfreecell(int16 m,int16 *x,int16 *y,int stack) { for(j=-1;j<=1;j++){ if(j+*x<0 || j+*x>=map->list[m].xs) continue; - if (map->getcell(m, NULL, j + *x, i + *y, CELL_CHKNOPASS) && !map->getcell(m, NULL, j + *x, i + *y, CELL_CHKICEWALL)) + if (map->getcell(m, bl, j + *x, i + *y, CELL_CHKNOPASS) && !map->getcell(m, bl, j + *x, i + *y, CELL_CHKICEWALL)) continue; //Avoid item stacking to prevent against exploits. [Skotlex] if(stack && map->count_oncell(m,j+*x,i+*y, BL_ITEM, 0) > stack) @@ -1591,14 +1591,14 @@ bool map_closest_freecell(int16 m, const struct block_list *bl, int16 *x, int16 * @first_charid, @second_charid, @third_charid, looting priority * @flag: &1 MVP item. &2 do stacking check. *------------------------------------------*/ -int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags) +int map_addflooritem(const struct block_list *bl, struct item *item_data, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags) { int r; struct flooritem_data *fitem=NULL; nullpo_ret(item_data); - if (!map->searchrandfreecell(m, &x, &y, (flags&2)?1:0)) + if (!map->searchrandfreecell(m, bl, &x, &y, (flags&2)?1:0)) return 0; r=rnd(); diff --git a/src/map/map.h b/src/map/map.h index dc970a5a3..39af13de8 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -955,7 +955,7 @@ END_ZEROED_BLOCK; int (*clearflooritem_timer) (int tid, int64 tick, int id, intptr_t data); int (*removemobs_timer) (int tid, int64 tick, int id, intptr_t data); void (*clearflooritem) (struct block_list* bl); - int (*addflooritem) (struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags); + int (*addflooritem) (const struct block_list *bl, struct item *item_data, int amount, int16 m, int16 x, int16 y, int first_charid, int second_charid, int third_charid, int flags); // player to map session void (*addnickdb) (int charid, const char* nick); void (*delnickdb) (int charid, const char* nick); @@ -1042,7 +1042,7 @@ END_ZEROED_BLOCK; void (*do_shutdown) (void); int (*freeblock_timer) (int tid, int64 tick, int id, intptr_t data); - int (*searchrandfreecell) (int16 m, int16 *x, int16 *y, int stack); + int (*searchrandfreecell) (int16 m, const struct block_list *bl, int16 *x, int16 *y, int stack); int (*count_sub) (struct block_list *bl, va_list ap); DBData (*create_charid2nick) (DBKey key, va_list args); int (*removemobs_sub) (struct block_list *bl, va_list ap); diff --git a/src/map/mob.c b/src/map/mob.c index 2bc0ba112..b1f6e8c61 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1819,7 +1819,7 @@ int mob_delay_item_drop(int tid, int64 tick, int id, intptr_t data) { ditem = list->item; while (ditem) { struct item_drop *ditem_prev; - map->addflooritem(&ditem->item_data,ditem->item_data.amount, + map->addflooritem(NULL, &ditem->item_data,ditem->item_data.amount, list->m,list->x,list->y, list->first_charid,list->second_charid,list->third_charid,0); ditem_prev = ditem; @@ -2543,7 +2543,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) { if((temp = pc->additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) { clif->additem(mvp_sd,0,0,temp); - map->addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1); + map->addflooritem(&md->bl, &item, 1, mvp_sd->bl.m, mvp_sd->bl.x, mvp_sd->bl.y, mvp_sd->status.char_id, (second_sd?second_sd->status.char_id : 0), (third_sd ? third_sd->status.char_id : 0), 1); } //Logs items, MVP prizes [Lupus] diff --git a/src/map/pc.c b/src/map/pc.c index ca60261d1..cc4b598bd 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4609,7 +4609,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) return 0; } - if (!map->addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2)) + if (!map->addflooritem(&sd->bl, &sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2)) return 0; pc->delitem(sd, n, amount, 1, DELITEM_NORMAL, LOG_TYPE_PICKDROP_PLAYER); @@ -7689,7 +7689,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { item_tmp.card[1]=0; item_tmp.card[2]=GetWord(sd->status.char_id,0); // CharId item_tmp.card[3]=GetWord(sd->status.char_id,1); - map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } // activate Steel body if a super novice dies at 99+% exp [celest] diff --git a/src/map/pet.c b/src/map/pet.c index d2bb96ef5..6a7924a16 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -303,7 +303,7 @@ int pet_return_egg(struct map_session_data *sd, struct pet_data *pd) tmp_item.card[3] = pd->pet.rename_flag; if((flag = pc->additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) { clif->additem(sd,0,0,flag); - map->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &tmp_item, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } pd->pet.incubate = 1; unit->free(&pd->bl,CLR_OUTSIGHT); @@ -582,7 +582,7 @@ bool pet_get_egg(int account_id, short pet_class, int pet_id ) { tmp_item.card[3] = 0; //New pets are not named. if((ret = pc->additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER))) { clif->additem(sd,0,0,ret); - map->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &tmp_item, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } return true; @@ -713,7 +713,7 @@ int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd) { tmp_item.identify = 1; if((flag = pc->additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) { clif->additem(sd,0,0,flag); - map->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &tmp_item, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } if( battle_config.pet_equip_required ) { // Skotlex: halt support timers if needed @@ -982,9 +982,9 @@ int pet_delay_item_drop(int tid, int64 tick, int id, intptr_t data) { ditem = list->item; while (ditem) { struct item_drop *ditem_prev; - map->addflooritem(&ditem->item_data,ditem->item_data.amount, - list->m,list->x,list->y, - list->first_charid,list->second_charid,list->third_charid,0); + map->addflooritem(NULL, &ditem->item_data, ditem->item_data.amount, + list->m, list->x, list->y, + list->first_charid, list->second_charid, list->third_charid, 0); ditem_prev = ditem; ditem = ditem->next; ers_free(pet->item_drop_ers, ditem_prev); diff --git a/src/map/script.c b/src/map/script.c index 74ddf2104..4e5ed7fdd 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7127,7 +7127,7 @@ BUILDIN(getitem) { if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); if( pc->candrop(sd,&it) ) - map->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &it, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } } @@ -7235,7 +7235,7 @@ BUILDIN(getitem2) if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); if( pc->candrop(sd,&item_tmp) ) - map->addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &item_tmp, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } } @@ -7429,7 +7429,7 @@ BUILDIN(makeitem) item_tmp.nameid = nameid; item_tmp.identify=1; - map->addflooritem(&item_tmp,amount,m,x,y,0,0,0,0); + map->addflooritem(NULL, &item_tmp, amount, m, x, y, 0, 0, 0, 0); return true; } @@ -12310,7 +12310,7 @@ BUILDIN(successremovecards) if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))) { // get back the cart in inventory clif->additem(sd,0,0,flag); - map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } } @@ -12335,7 +12335,7 @@ BUILDIN(successremovecards) if ((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))) { //chk if can be spawn in inventory otherwise put on floor clif->additem(sd,0,0,flag); - map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } clif->misceffect(&sd->bl,3); @@ -12384,7 +12384,7 @@ BUILDIN(failedremovecards) if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))) { clif->additem(sd,0,0,flag); - map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } } @@ -12415,7 +12415,7 @@ BUILDIN(failedremovecards) if((flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))) { clif->additem(sd,0,0,flag); - map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } clif->misceffect(&sd->bl,2); @@ -18633,7 +18633,7 @@ BUILDIN(getrandgroupitem) { if ((flag = pc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT))) { clif->additem(sd, 0, 0, flag); if( pc->candrop(sd,&it) ) - map->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &it, get_count, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } } diff --git a/src/map/skill.c b/src/map/skill.c index 63116db98..5b41c55c0 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -4539,7 +4539,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 item_tmp.nameid = sg->item_id?sg->item_id:ITEMID_TRAP; item_tmp.identify = 1; if( item_tmp.nameid ) - map->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0); + map->addflooritem(bl, &item_tmp, 1, bl->m, bl->x, bl->y, 0, 0, 0, 0); } skill->delunit(su); } @@ -6744,7 +6744,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin eflag = pc->additem(sd,&item_tmp,1,LOG_TYPE_PRODUCE); if(eflag) { clif->additem(sd,0,0,eflag); - map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } break; @@ -7466,7 +7466,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin item_tmp.identify = 1; if (item_tmp.nameid && (success=pc->additem(sd,&item_tmp,skill->dbs->db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) != 0) { clif->additem(sd,0,0,success); - map->addflooritem(&item_tmp,skill->dbs->db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &item_tmp, skill->dbs->db[su->group->skill_id].amount[i], sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } } @@ -7478,7 +7478,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin item_tmp.identify = 1; if (item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) != 0) { clif->additem(sd,0,0,flag); - map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &item_tmp, 1, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } } @@ -16433,7 +16433,7 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = group->item_id?group->item_id:ITEMID_TRAP; item_tmp.identify = 1; - map->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0); + map->addflooritem(bl, &item_tmp, 1, bl->m, bl->x, bl->y, 0, 0, 0, 0); } skill->delunit(su); } @@ -17375,7 +17375,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, tmp_item.amount = qty * skill->dbs->changematerial_db[i].qty[j]; if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { clif->additem(sd,0,0,flag); - map->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } k++; } @@ -17389,7 +17389,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, } else if (tmp_item.amount) { //Success if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { clif->additem(sd,0,0,flag); - map->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } if( skill_id == GN_MIX_COOKING || skill_id == GN_MAKEBOMB || skill_id == GN_S_PHARMACY ) clif->msgtable_skill(sd, skill_id, MSG_SKILL_SUCCESS); @@ -17449,7 +17449,7 @@ int skill_produce_mix(struct map_session_data *sd, uint16 skill_id, int nameid, tmp_item.identify = 1; if( pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE) ) { clif->additem(sd,0,0,flag); - map->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } clif->msgtable_skill(sd, skill_id, MSG_SKILL_FAILURE); } @@ -17506,7 +17506,7 @@ int skill_arrow_create (struct map_session_data *sd, int nameid) continue; if((flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) { clif->additem(sd,0,0,flag); - map->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } @@ -17739,7 +17739,7 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv, int flag = pc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_CONSUME); if (flag) { clif->additem(sd,0,0,flag); - map->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); + map->addflooritem(&sd->bl, &tmp_item, tmp_item.amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 0); } } |