summaryrefslogtreecommitdiff
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
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
-rw-r--r--Changelog-SVN.txt1
-rw-r--r--sql-files/item_db.sql6
-rw-r--r--src/char_sql/int_guild.c10
3 files changed, 9 insertions, 8 deletions
diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt
index bcfa73826..dc452f6c1 100644
--- a/Changelog-SVN.txt
+++ b/Changelog-SVN.txt
@@ -1,6 +1,7 @@
Date Added
02/28
+ * Fixed SQL Castle saving bugs [Lupus]
* Corrected Tiger Fist, Chain Crush, and Palm Push Strike damage, thanks to
Eskadron [celest]
* Updated Endure to be usable in GvG, but only gives the mdef bonus [celest]
diff --git a/sql-files/item_db.sql b/sql-files/item_db.sql
index e4f1447aa..d5c62f47a 100644
--- a/sql-files/item_db.sql
+++ b/sql-files/item_db.sql
@@ -9,11 +9,11 @@ CREATE TABLE `item_db` (
`attack` mediumint(9) unsigned default NULL,
`defence` mediumint(9) unsigned default NULL,
`range` tinyint(2) unsigned default NULL,
- `slots` tinyint(1) unsigned default NULL,
+ `slots` tinyint(2) unsigned default NULL,
`equip_jobs` mediumint(8) unsigned default NULL,
- `equip_genders` tinyint(1) unsigned default NULL,
+ `equip_genders` tinyint(2) unsigned default NULL,
`equip_locations` smallint(4) unsigned default NULL,
- `weapon_level` tinyint(1) unsigned default NULL,
+ `weapon_level` tinyint(2) unsigned default NULL,
`equip_level` tinyint(3) unsigned default NULL,
`view` tinyint(3) unsigned default NULL,
`script_use` text,
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;