summaryrefslogtreecommitdiff
path: root/src/map/pet.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-05 15:05:37 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-05 15:05:37 +0000
commit7e0f93b9fc2b11674d6488b5fd10e638552209ce (patch)
tree14f038455d2f058ac65879faf57e7084c88121d9 /src/map/pet.c
parentb0e39dbb7950dffb3ec487ab48f6f154fc7c82bd (diff)
downloadhercules-7e0f93b9fc2b11674d6488b5fd10e638552209ce.tar.gz
hercules-7e0f93b9fc2b11674d6488b5fd10e638552209ce.tar.bz2
hercules-7e0f93b9fc2b11674d6488b5fd10e638552209ce.tar.xz
hercules-7e0f93b9fc2b11674d6488b5fd10e638552209ce.zip
- 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
Diffstat (limited to 'src/map/pet.c')
-rw-r--r--src/map/pet.c9
1 files changed, 4 insertions, 5 deletions
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)))