summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/mob.c4
-rw-r--r--src/map/pc.c16
-rw-r--r--src/map/script.c4
3 files changed, 13 insertions, 11 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 964506f53..c2f9680ca 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2079,7 +2079,9 @@ static void mob_item_drop(struct mob_data *md, unsigned int tick, struct delay_i
ditem->first_sd->state.autoloot >= 10000) //Fetch 100% drops
) { //Autoloot.
if (party_share_loot(
- party_search(ditem->first_sd->status.party_id),
+ ditem->first_sd->status.party_id?
+ party_search(ditem->first_sd->status.party_id):
+ NULL,
ditem->first_sd,&ditem->item_data)
) {
aFree(ditem);
diff --git a/src/map/pc.c b/src/map/pc.c
index 7d4a75e0c..0be77386f 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2591,16 +2591,12 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
}
}
first_sd = NULL; //First_sd will store who picked up the item.
- if (p && p->item&2) { //item distribution to party members.
- if ((flag = party_share_loot(p,sd,&fitem->item_data))) {
- clif_additem(sd,0,0,flag);
- return 1;
- }
- first_sd = sd;
- } else
- if(log_config.pick) //Logs items, taken by (P)layers [Lupus]
- log_pick(first_sd, "P", 0, fitem->item_data.nameid, fitem->item_data.amount, (struct item*)&fitem->item_data);
-
+ //This function takes care of giving the item to whoever should have it
+ //considering party-share options.
+ if ((flag = party_share_loot(p,sd,&fitem->item_data))) {
+ clif_additem(sd,0,0,flag);
+ return 1;
+ }
//Display pickup animation.
if(sd->attacktimer != -1)
diff --git a/src/map/script.c b/src/map/script.c
index e439f44c2..bf0d5e780 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4365,6 +4365,10 @@ int buildin_strcharinfo(struct script_state *st)
int num;
sd=script_rid2sd(st);
+ if (!sd) { //Avoid crashing....
+ push_str(st->stack,C_CONSTSTR,(unsigned char *) "");
+ return 0;
+ }
num=conv_num(st,& (st->stack->stack_data[st->start+2]));
if(sd){
switch(num){