summaryrefslogtreecommitdiff
path: root/src/char_sql/int_guild.c
diff options
context:
space:
mode:
authorLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-28 07:27:18 +0000
committerLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-28 07:27:18 +0000
commita42a5f03ddb865767dbf08c745a247b5c79315aa (patch)
tree9073dcbbf511bfe7cbf364ce848dc58a1b774705 /src/char_sql/int_guild.c
parent94270f243e9c0bcec112b2abb7cd7799f5f01ea4 (diff)
downloadhercules-a42a5f03ddb865767dbf08c745a247b5c79315aa.tar.gz
hercules-a42a5f03ddb865767dbf08c745a247b5c79315aa.tar.bz2
hercules-a42a5f03ddb865767dbf08c745a247b5c79315aa.tar.xz
hercules-a42a5f03ddb865767dbf08c745a247b5c79315aa.zip
fixed SQL Castle Saving BUGS
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1193 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/int_guild.c')
-rw-r--r--src/char_sql/int_guild.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c
index 201d40d43..320d19f1f 100644
--- a/src/char_sql/int_guild.c
+++ b/src/char_sql/int_guild.c
@@ -327,7 +327,7 @@ struct guild * inter_guild_fromsql(int guild_id)
char *pstr;
struct guild *g;
- if (guild_id==0) return 0;
+ if (guild_id<=0) return 0;
g = (struct guild*)numdb_search(guild_db_,guild_id);
if (g != NULL)
@@ -522,7 +522,7 @@ static int _set_guild_castle(void *key, void *data, va_list ap) {
// Save guild_castle to sql
int inter_guildcastle_tosql(struct guild_castle *gc){
- if(gc->castle_id == 0 || gc->guild_id == 0){
+ if(gc->castle_id < 0 || gc->guild_id <= 0){ //fixed bug! gc->castle_id can be == 0 (for the 1st castle it's == 0) [Lupus]
return 0;
}
printf("[Guild Castle]: Save..");
@@ -535,11 +535,11 @@ int inter_guildcastle_tosql(struct guild_castle *gc){
}
sql_res = mysql_store_result(&mysql_handle);
- if(sql_res){
- if(mysql_num_rows(sql_res) != 0){
+ if(sql_res!=NULL){ //fixed [Lupus]
+ if(mysql_num_rows(sql_res) > 0){
//okay .. guild is existable
mysql_free_result(sql_res);
- sprintf(tmp_sql, "UPDATE `%s` SET `guild_id` = '%d', `economy` = '%d', `defense` = '%d', `triggerE` = '%d', `triggerD` = '%d', `nextTime` = '%d', `payTime` = '%d', `createTime` = '%d', `visibleC` = '%d', `visibleG0` = '%d', `visibleG1` = '%d', `visibleG2` = '%d', `visibleG3` = '%d', `visibleG4` = '%d', `visibleG5` = '%d', `visibleG6` = '%d', `visibleG7` = '%d', `gHP0` = '%d', `gHP1` = '%d', `gHP2` = '%d', `gHP3` = '%d', `gHP4` = '%d', `gHP5` = '%d', `gHP6` = '%d', `gHP7` = '%d' WHERE `castle_id` = '%d'", guild_castle_db, gc->guild_id, gc->economy, gc->defense, gc->triggerE, gc->triggerD, gc->nextTime, gc->payTime, gc->createTime, gc->visibleC, gc->visibleG0, gc->visibleG1, gc->visibleG2, gc->visibleG3, gc->visibleG4, gc->visibleG5, gc->visibleG6, gc->visibleG7, gc->Ghp0, gc->Ghp1, gc->Ghp2, gc->Ghp3, gc->Ghp4, gc->Ghp5, gc->Ghp6, gc->Ghp7, gc->castle_id);
+ sprintf(tmp_sql, "UPDATE `%s` SET `guild_id` = '%d', `economy` = '%d', `defense` = '%d', `triggerE` = '%d', `triggerD` = '%d', `nextTime` = '%d', `payTime` = '%d', `createTime` = '%d', `visibleC` = '%d', `visibleG0` = '%d', `visibleG1` = '%d', `visibleG2` = '%d', `visibleG3` = '%d', `visibleG4` = '%d', `visibleG5` = '%d', `visibleG6` = '%d', `visibleG7` = '%d', `gHP0` = '%d', `gHP1` = '%d', `gHP2` = '%d', `gHP3` = '%d', `gHP4` = '%d', `gHP5` = '%d', `gHP6` = '%d', `gHP7` = '%d' WHERE `castle_id` = '%d'", guild_castle_db, gc->guild_id, gc->economy, gc->defense, gc->triggerE, gc->triggerD, gc->nextTime, gc->payTime, gc->createTime, gc->visibleC, gc->visibleG0, gc->visibleG1, gc->visibleG2, gc->visibleG3, gc->visibleG4, gc->visibleG5,gc->visibleG6, gc->visibleG7, gc->Ghp0, gc->Ghp1, gc->Ghp2, gc->Ghp3, gc->Ghp4, gc->Ghp5, gc->Ghp6, gc->Ghp7, gc->castle_id);
if(mysql_query(&mysql_handle, tmp_sql)){
printf(" fail, DB ERROR: %s\n", mysql_error(&mysql_handle));
return 0;