summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c16
-rw-r--r--src/map/intif.c20
-rw-r--r--src/map/mail.c2
3 files changed, 19 insertions, 19 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 3bdaa3396..068ace525 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -11301,14 +11301,14 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd)
* Reply to an Attachment operation
* 0 : Successfully attached item to mail
* 1 : Fail to set the attachment
- * 2 : Weight problems (when getting the attachment)
*------------------------------------------*/
-static void clif_Mail_attachment(int fd, uint8 flag)
+static void clif_Mail_attachment(int fd, int index, uint8 flag)
{
- WFIFOHEAD(fd,packet_len(0x245));
- WFIFOW(fd,0) = 0x245;
- WFIFOB(fd,2) = flag;
- WFIFOSET(fd,packet_len(0x245));
+ WFIFOHEAD(fd,packet_len(0x255));
+ WFIFOW(fd,0) = 0x255;
+ WFIFOW(fd,2) = index;
+ WFIFOB(fd,4) = flag;
+ WFIFOSET(fd,packet_len(0x255));
}
/*------------------------------------------
@@ -11519,7 +11519,7 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd)
weight = data->weight * sd->mail.inbox.msg[i].item.amount;
if (weight > sd->max_weight - sd->weight)
{
- clif_Mail_attachment(fd, 2);
+ // clif_Mail_attachment(fd, 2);
return;
}
}
@@ -11582,7 +11582,7 @@ void clif_parse_Mail_setattach(int fd, struct map_session_data *sd)
flag = mail_setitem(sd, idx, amount);
if (idx > 0)
- clif_Mail_attachment(fd,flag);
+ clif_Mail_attachment(fd,idx,flag);
}
/*------------------------------------------
diff --git a/src/map/intif.c b/src/map/intif.c
index 629f1f5d1..d54441f4e 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -1700,17 +1700,9 @@ static void intif_parse_Mail_send(int fd)
fail = true;
else
{
- if( sd == NULL )
- fail = true;
+ fail = !mail_checkattach(sd);
- if( !mail_checkattach(sd) )
- {
- mail_removeitem(sd, 0);
- mail_removezeny(sd, 0);
- fail = true;
- }
-
- // confirmation message
+ // Confirmation to CharServer
WFIFOHEAD(inter_fd,7);
WFIFOW(inter_fd,0) = 0x304e;
WFIFOL(inter_fd,2) = mail_id;
@@ -1718,6 +1710,14 @@ static void intif_parse_Mail_send(int fd)
WFIFOSET(inter_fd,7);
}
+ nullpo_retv(sd);
+
+ if( fail )
+ { // Return items and zeny to owner
+ mail_removeitem(sd, 0);
+ mail_removezeny(sd, 0);
+ }
+
clif_Mail_send(sd->fd, fail);
}
diff --git a/src/map/mail.c b/src/map/mail.c
index e1c006a0a..e7cd6b2d6 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -78,7 +78,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount)
sd->mail.index = idx;
sd->mail.nameid = sd->status.inventory[idx].nameid;
sd->mail.amount = amount;
- clif_delitem(sd, idx, amount);
+
return 0;
}
}