summaryrefslogtreecommitdiff
path: root/src/char/char.c
diff options
context:
space:
mode:
authormomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-29 22:58:14 +0000
committermomacabu <momacabu@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-29 22:58:14 +0000
commit325d58d7e7f0e67e69e891bc26549c9cb2d85a9e (patch)
tree8a8c36ed4c4b58a3125a84c62cf191c52fab8ecd /src/char/char.c
parent98e452dbcb1f120c744b88209eeb41b133c1d57b (diff)
downloadhercules-325d58d7e7f0e67e69e891bc26549c9cb2d85a9e.tar.gz
hercules-325d58d7e7f0e67e69e891bc26549c9cb2d85a9e.tar.bz2
hercules-325d58d7e7f0e67e69e891bc26549c9cb2d85a9e.tar.xz
hercules-325d58d7e7f0e67e69e891bc26549c9cb2d85a9e.zip
- Upon character deletion remove received mails and elemental.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16985 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char/char.c')
-rw-r--r--src/char/char.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 4ef50375f..dc1dd6a72 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -1539,11 +1539,11 @@ int delete_char_sql(int char_id)
{
char name[NAME_LENGTH];
char esc_name[NAME_LENGTH*2+1]; //Name needs be escaped.
- int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id;
+ int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id;
char *data;
size_t len;
- if (SQL_ERROR == Sql_Query(sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother` FROM `%s` WHERE `char_id`='%d'", char_db, char_id))
+ if (SQL_ERROR == Sql_Query(sql_handle, "SELECT `name`,`account_id`,`party_id`,`guild_id`,`base_level`,`homun_id`,`partner_id`,`father`,`mother`,`elemental_id` FROM `%s` WHERE `char_id`='%d'", char_db, char_id))
Sql_ShowDebug(sql_handle);
if (SQL_SUCCESS != Sql_NextRow(sql_handle)) {
@@ -1570,6 +1570,8 @@ int delete_char_sql(int char_id)
father_id = atoi(data);
Sql_GetData(sql_handle, 8, &data, NULL);
mother_id = atoi(data);
+ Sql_GetData(sql_handle, 9, &data, NULL);
+ elemental_id = atoi(data);
Sql_EscapeStringLen(sql_handle, esc_name, name, min(len, NAME_LENGTH));
Sql_FreeResult(sql_handle);
@@ -1622,6 +1624,10 @@ int delete_char_sql(int char_id)
/* remove homunculus */
if (hom_id)
mapif_homunculus_delete(hom_id);
+
+ /* remove elemental */
+ if (elemental_id)
+ mapif_elemental_delete(elemental_id);
/* remove mercenary data */
mercenary_owner_delete(char_id);
@@ -1660,6 +1666,10 @@ int delete_char_sql(int char_id)
/* delete skills */
if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d'", skill_db, char_id))
Sql_ShowDebug(sql_handle);
+
+ /* delete mails (only received) */
+ if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `dest_id`='%d'", mail_db, char_id))
+ Sql_ShowDebug(sql_handle);
#ifdef ENABLE_SC_SAVING
/* status changes */