diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-17 14:37:43 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-17 14:37:43 +0000 |
commit | 46ea6c76831a76749c531d5568a23839cc14e25f (patch) | |
tree | 152114e5cd8206dbc60b1998f26fabf7a80e8588 /src/char_sql/int_party.c | |
parent | ce90e748fccfaf86c857b94a604044b9dd53b3e7 (diff) | |
download | hercules-46ea6c76831a76749c531d5568a23839cc14e25f.tar.gz hercules-46ea6c76831a76749c531d5568a23839cc14e25f.tar.bz2 hercules-46ea6c76831a76749c531d5568a23839cc14e25f.tar.xz hercules-46ea6c76831a76749c531d5568a23839cc14e25f.zip |
- Char-SQL: Removed the ridiculous check for existing party/guild each time a character is saved. The check should be done upon loading (when the guild/party is not found, the char's party/guild id is set to 0 THERE)
- Removed the 'Quick loaded char' messages from the char-sql server
- Some cleaning of the guild sql saving routine.
- Various checks around the char-SQL server and a few memory leak fixes.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5309 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/int_party.c')
-rw-r--r-- | src/char_sql/int_party.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c index e4161373f..fcc11dc57 100644 --- a/src/char_sql/int_party.c +++ b/src/char_sql/int_party.c @@ -170,18 +170,19 @@ struct party *inter_party_fromsql(int party_id) }
sql_res = mysql_store_result(&mysql_handle) ;
- if (sql_res != NULL && mysql_num_rows(sql_res) > 0) {
- sql_row = mysql_fetch_row(sql_res);
- p->party_id = party_id;
- memcpy(p->name, sql_row[1], NAME_LENGTH-1);
- p->exp = atoi(sql_row[2])?1:0;
- p->item = atoi(sql_row[3]);
- leader_id = atoi(sql_row[4]);
- leader_char = atoi(sql_row[5]);
- } else {
+ if (!sql_res)
+ return NULL;
+ sql_row = mysql_fetch_row(sql_res);
+ if (!sql_row) {
mysql_free_result(sql_res);
return NULL;
}
+ p->party_id = party_id;
+ memcpy(p->name, sql_row[1], NAME_LENGTH-1);
+ p->exp = atoi(sql_row[2])?1:0;
+ p->item = atoi(sql_row[3]);
+ leader_id = atoi(sql_row[4]);
+ leader_char = atoi(sql_row[5]);
mysql_free_result(sql_res);
// Load members
@@ -193,7 +194,7 @@ struct party *inter_party_fromsql(int party_id) return NULL;
}
sql_res = mysql_store_result(&mysql_handle);
- if (sql_res != NULL && mysql_num_rows(sql_res) > 0) {
+ if (sql_res) {
int i;
for (i = 0; (sql_row = mysql_fetch_row(sql_res)); i++) {
struct party_member *m = &p->member[i];
@@ -205,8 +206,8 @@ struct party *inter_party_fromsql(int party_id) m->map = mapindex_name2id(sql_row[4]);
m->online = atoi(sql_row[5])?1:0;
}
+ mysql_free_result(sql_res);
}
- mysql_free_result(sql_res);
if (save_log)
ShowInfo("Party loaded (%d - %s).\n",party_id, p->name);
|