From 7e0f93b9fc2b11674d6488b5fd10e638552209ce Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 5 Apr 2006 15:05:37 +0000 Subject: - Cleaned up the pet_ai_hard_lootsearch function to avoid doing map_id2sd calls. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5910 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pet.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/map') diff --git a/src/map/pet.c b/src/map/pet.c index db3ee4928..d9dddbf2f 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -1091,20 +1091,19 @@ int pet_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap) { struct pet_data* pd; struct flooritem_data *fitem = (struct flooritem_data *)bl; - struct map_session_data *sd = NULL; + int sd_id =0; int *itc; pd=va_arg(ap,struct pet_data *); itc=va_arg(ap,int *); - // ルート権無し - if(fitem && fitem->first_get_id) - sd = map_id2sd(fitem->first_get_id); + sd_id = fitem->first_get_id; // Removed [Valaris] //if((pd->lootitem_weight + (itemdb_search(fitem->item_data.))->weight * fitem->item_data.amount) > battle_config.pet_weight) // return 0; - if(pd->loot == NULL || pd->loot->item == NULL || (pd->loot->count >= pd->loot->max) || (sd && sd->pd != pd)) + if(pd->loot == NULL || pd->loot->item == NULL || (pd->loot->count >= pd->loot->max) || + (sd_id && pd->msd && pd->msd->bl.id != sd_id)) return 0; if(bl->m == pd->bl.m && check_distance_bl(&pd->bl, bl, pd->db->range2) && unit_can_reach(&pd->bl,bl->x,bl->y) && rand()%1000<1000/(++(*itc))) -- cgit v1.2.3-70-g09d2