summaryrefslogtreecommitdiff
path: root/src/char_sql/int_storage.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-17 14:37:43 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-17 14:37:43 +0000
commit46ea6c76831a76749c531d5568a23839cc14e25f (patch)
tree152114e5cd8206dbc60b1998f26fabf7a80e8588 /src/char_sql/int_storage.c
parentce90e748fccfaf86c857b94a604044b9dd53b3e7 (diff)
downloadhercules-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_storage.c')
-rw-r--r--src/char_sql/int_storage.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/char_sql/int_storage.c b/src/char_sql/int_storage.c
index 780617055..2fcbc6074 100644
--- a/src/char_sql/int_storage.c
+++ b/src/char_sql/int_storage.c
@@ -80,7 +80,7 @@ int storage_fromsql(int account_id, struct storage *p){
sql_res = mysql_store_result(&mysql_handle) ;
if (sql_res) {
- while((sql_row = mysql_fetch_row(sql_res))) { //start to fetch
+ while((sql_row = mysql_fetch_row(sql_res)) && i<MAX_STORAGE) { //start to fetch
p->storage_[i].id= atoi(sql_row[0]);
p->storage_[i].nameid= atoi(sql_row[1]);
p->storage_[i].amount= atoi(sql_row[2]);
@@ -90,8 +90,9 @@ int storage_fromsql(int account_id, struct storage *p){
p->storage_[i].attribute= atoi(sql_row[6]);
for (j=0; j<MAX_SLOTS; j++)
p->storage_[i].card[j]= atoi(sql_row[7+j]);
- p->storage_amount = ++i;
+ i++;
}
+ p->storage_amount = i;
mysql_free_result(sql_res);
}
@@ -154,7 +155,7 @@ int guild_storage_fromsql(int guild_id, struct guild_storage *p){
sql_res = mysql_store_result(&mysql_handle) ;
if (sql_res) {
- while((sql_row = mysql_fetch_row(sql_res))) { //start to fetch
+ while((sql_row = mysql_fetch_row(sql_res)) && i < MAX_GUILD_STORAGE) { //start to fetch
p->storage_[i].id= atoi(sql_row[0]);
p->storage_[i].nameid= atoi(sql_row[1]);
p->storage_[i].amount= atoi(sql_row[2]);
@@ -164,10 +165,9 @@ int guild_storage_fromsql(int guild_id, struct guild_storage *p){
p->storage_[i].attribute= atoi(sql_row[6]);
for (j=0; j<MAX_SLOTS; j++)
p->storage_[i].card[j] = atoi(sql_row[7+j]);
- p->storage_amount = ++i;
- if (i >= MAX_GUILD_STORAGE)
- break;
+ i++;
}
+ p->storage_amount = i;
mysql_free_result(sql_res);
}
ShowInfo ("guild storage load complete from DB - id: %d (total: %d)\n", guild_id, p->storage_amount);