summaryrefslogtreecommitdiff
path: root/src/map/chrif.c
diff options
context:
space:
mode:
authorMadCamel <madcamel@gmail.com>2009-03-16 19:40:12 +0000
committerJared Adams <jaxad0127@gmail.com>2009-03-16 13:50:30 -0600
commitd450f9fd7b5d4fd71d4f7e244ef9d0786d0f745a (patch)
tree207f03c028ea16500032bde862d9ade38d317d06 /src/map/chrif.c
parent1f073198ce4a175191da2815c00cca11e81735d8 (diff)
downloadtmwa-d450f9fd7b5d4fd71d4f7e244ef9d0786d0f745a.tar.gz
tmwa-d450f9fd7b5d4fd71d4f7e244ef9d0786d0f745a.tar.bz2
tmwa-d450f9fd7b5d4fd71d4f7e244ef9d0786d0f745a.tar.xz
tmwa-d450f9fd7b5d4fd71d4f7e244ef9d0786d0f745a.zip
Now possible to divorce when partner is offline
Diffstat (limited to 'src/map/chrif.c')
-rw-r--r--src/map/chrif.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 4f8edf6..ef681b7 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -676,7 +676,9 @@ int chrif_accountreg2(int fd)
}
/*==========================================
- * 離婚情報同期要求
+ * Divorce request from char server
+ * triggered on account deletion or as an
+ * ack from a map-server divorce request
*------------------------------------------
*/
int chrif_divorce(int char_id, int partner_id)
@@ -686,12 +688,32 @@ int chrif_divorce(int char_id, int partner_id)
if (!char_id || !partner_id)
return 0;
- nullpo_retr(0, sd = map_nick2sd(map_charid2nick(partner_id)));
- if (sd->status.partner_id == char_id) {
- int i;
+
+ sd = map_nick2sd(map_charid2nick(char_id));
+ if (sd && sd->status.partner_id == partner_id) {
sd->status.partner_id = 0;
+ map_scriptcont(sd, sd->npc_id);
}
+ nullpo_retr(0, sd = map_nick2sd(map_charid2nick(partner_id)));
+ if (sd->status.partner_id == char_id)
+ sd->status.partner_id = 0;
+
+ return 0;
+}
+
+/*==========================================
+ * Tell character server someone is divorced
+ * Needed to divorce when partner is not connected to map server
+ *-------------------------------------
+ */
+int chrif_send_divorce(int char_id) {
+ if (char_fd < 0)
+ return -1;
+
+ WFIFOW(char_fd, 0) = 0x2b16;
+ WFIFOL(char_fd, 2) = char_id;
+ WFIFOSET(char_fd,6);
return 0;
}