diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-16 20:33:01 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-16 20:33:01 +0000 |
commit | bdd45e85b62b80d552190b95e74dafd0e6a19a77 (patch) | |
tree | 5b5ba1876a3c3e0f7bf307019d90ca4ad810f883 /src/map/pc.c | |
parent | 7b694adc3afbc616c41d447be20adb3412a9a42d (diff) | |
download | hercules-bdd45e85b62b80d552190b95e74dafd0e6a19a77.tar.gz hercules-bdd45e85b62b80d552190b95e74dafd0e6a19a77.tar.bz2 hercules-bdd45e85b62b80d552190b95e74dafd0e6a19a77.tar.xz hercules-bdd45e85b62b80d552190b95e74dafd0e6a19a77.zip |
- Added support for offline divorce.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12379 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 782446c42..a06f1c474 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6668,34 +6668,46 @@ int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd) } /*========================================== - * sd‚ª—£¥(‘ŠŽè‚Ísd->status.partner_id‚Ɉ˂é)(‘ŠŽè‚à“¯ŽbÉ—£¥?Œ‹¥Žw—ÖŽ©“®?’D) + * Divorce sd from its partner *------------------------------------------*/ int pc_divorce(struct map_session_data *sd) { struct map_session_data *p_sd; + int i; + if (sd == NULL || !pc_ismarried(sd)) return -1; - if ((p_sd = map_charid2sd(sd->status.partner_id)) != NULL) { - int i; - if (p_sd->status.partner_id != sd->status.char_id || sd->status.partner_id != p_sd->status.char_id) { - ShowWarning("pc_divorce: Illegal partner_id sd=%d p_sd=%d\n", sd->status.partner_id, p_sd->status.partner_id); + if( !sd->status.partner_id ) + return -1; // Char is not married + + if( (p_sd = map_charid2sd(sd->status.partner_id)) == NULL ) + { // Lets char server do the divorce +#ifndef TXT_ONLY + if( chrif_divorce(sd->status.char_id, sd->status.partner_id) ) + return -1; // No char server connected + + return 0; +#else + ShowError("pc_divorce: p_sd nullpo\n"); return -1; +#endif } + + // Both players online, lets do the divorce manually sd->status.partner_id = 0; p_sd->status.partner_id = 0; - for (i = 0; i < MAX_INVENTORY; i++) { + for( i = 0; i < MAX_INVENTORY; i++ ) + { if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F) pc_delitem(sd, i, 1, 0); if (p_sd->status.inventory[i].nameid == WEDDING_RING_M || p_sd->status.inventory[i].nameid == WEDDING_RING_F) pc_delitem(p_sd, i, 1, 0); } + clif_divorced(sd, p_sd->status.name); clif_divorced(p_sd, sd->status.name); - } else { - ShowError("pc_divorce: p_sd nullpo\n"); - return -1; - } + return 0; } |