summaryrefslogtreecommitdiff
path: root/src/char_sql/char.c
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-17 08:31:32 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-17 08:31:32 +0000
commit6b1b1974a10bb5ad8f69d9f84d7babcc370f9264 (patch)
treebad024738cb1a318420df132ac8b4fa9dc212a5f /src/char_sql/char.c
parentcf21db7985cfaf093cca2a1d4bc3e43e7f145ff3 (diff)
downloadhercules-6b1b1974a10bb5ad8f69d9f84d7babcc370f9264.tar.gz
hercules-6b1b1974a10bb5ad8f69d9f84d7babcc370f9264.tar.bz2
hercules-6b1b1974a10bb5ad8f69d9f84d7babcc370f9264.tar.xz
hercules-6b1b1974a10bb5ad8f69d9f84d7babcc370f9264.zip
* Changes to Dissonance -- don't increment the timer again if the target has died
* Changed some nullpo checks back to normal null checks * Changed some nullpo checks to print some debug information * Added some sd checks before calling pc_blockskill * Added fix for SQL char's friend list updating * Fixed a crash if the player invited to join a guild is not online * Find the guild invitation sender first before clearing it git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1124 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/char.c')
-rw-r--r--src/char_sql/char.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 2f1979eb6..133d78296 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -622,24 +622,41 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
// Friends list
// account_id, friend_id0, name0, ...
+ #if 0
+ tmp_p += sprintf(tmp_p, "REPLACE INTO `%s` (`id`, `account_id`",friend_db);
- tmp_p += sprintf(tmp_p, "REPLACE INTO `%s` (`id`, `account_id`",friend_db);
+ diff = 0;
- diff = 0;
+ for (i=0;i<20;i++)
+ tmp_p += sprintf(tmp_p, ", `friend_id%d`, `name%d`", i, i);
- for (i=0;i<20;i++)
- tmp_p += sprintf(tmp_p, ", `friend_id%d`, `name%d`", i, i);
+ tmp_p += sprintf(tmp_p, ") VALUES (NULL, '%d'", char_id);
- tmp_p += sprintf(tmp_p, ") VALUES (NULL, '%d'", char_id);
+ for (i=0;i<20;i++) {
+ tmp_p += sprintf(tmp_p, ", '%d', '%s'", p->friend_id[i], p->friend_name[i]);
+ if ((p->friend_id[i] != cp->friend_id[i]) ||
+ strcmp(p->friend_name[i], cp->friend_name[i]))
+ diff = 1;
+ }
- for (i=0;i<20;i++) {
- tmp_p += sprintf(tmp_p, ", '%d', '%s'", p->friend_id[i], p->friend_name[i]);
- if ((p->friend_id[i] != cp->friend_id[i]) ||
- strcmp(p->friend_name[i], cp->friend_name[i]))
- diff = 1;
- }
+ tmp_p += sprintf(tmp_p, ")");
+ #else // [Dino9021]
+ tmp_p += sprintf(tmp_p, "UPDATE `%s` SET ",friend_db);
- tmp_p += sprintf(tmp_p, ")");
+ diff = 0;
+
+ for (i=0;i<20;i++) {
+ if (i>0)
+ tmp_p += sprintf(tmp_p, ", ");
+
+ tmp_p += sprintf(tmp_p, "`friend_id%d`='%d', `name%d`='%s'", i, p->friend_id[i], i, p->friend_name[i]);
+
+ if ((p->friend_id[i] != cp->friend_id[i]) || strcmp(p->friend_name[i], cp->friend_name[i]))
+ diff = 1;
+ }
+
+ tmp_p += sprintf(tmp_p, " where account_id='%d';", char_id);
+ #endif
if (diff)
mysql_query(&mysql_handle, tmp_sql);