Преглед изворни кода

Delete homunc's skills from sql when the homunc is destroyed

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8307 54d463be-8e91-2dee-dedb-b68131a5f0ec
toms пре 19 година
родитељ
комит
2f858a5ea7
2 измењених фајлова са 18 додато и 9 уклоњено
  1. 1 0
      Changelog-Trunk.txt
  2. 17 9
      src/char_sql/int_homun.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/08/15
+	* Delete homunc's skills from sql when the homunc is destroyed [Toms]
 	* Homunc Timers should be disabled when the homunc is vaporized or dead an re-enabled on call/resu [Toms]
 	* Updated vc-project files to compile with the new int_homun files.
 	  [Skotlex]

+ 17 - 9
src/char_sql/int_homun.c

@@ -32,10 +32,10 @@ void inter_homunculus_sql_final(void){
 	return;
 }
 
-int mapif_saved_homunculus(int fd, int account_id, short flag)
+int mapif_saved_homunculus(int fd, int account_id, unsigned char flag)
 {
 	WFIFOW(fd,0) = 0x3892;
-	WFIFOL(fd,2)=account_id;
+	WFIFOL(fd,2) = account_id;
 	WFIFOB(fd,6) = flag;
 	WFIFOSET(fd, 7);
 	return 0;
@@ -227,13 +227,21 @@ int mapif_load_homunculus(int fd){
 int mapif_delete_homunculus(int fd)
 {
 	sprintf(tmp_sql, "DELETE FROM `homunculus` WHERE `homun_id` = '%lu'", RFIFOL(fd,2));
-   if(mysql_query(&mysql_handle, tmp_sql)){
-     ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
-     ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
-   return mapif_homunculus_deleted(fd, 0);
-   }
-
-	 return mapif_homunculus_deleted(fd, 1);
+	if(mysql_query(&mysql_handle, tmp_sql))
+	{
+		ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+		ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+		return mapif_homunculus_deleted(fd, 0);
+	}
+	
+	sprintf(tmp_sql, "DELETE FROM `skill_homunculus` WHERE `homun_id` = '%lu'", RFIFOL(fd,2));
+	if(mysql_query(&mysql_handle, tmp_sql))
+	{
+		ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+		ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+		return mapif_homunculus_deleted(fd, 0);
+	}
+	return mapif_homunculus_deleted(fd, 1);
 }
 
 int mapif_rename_homun_ack(int fd, int account_id, int char_id, int flag, char *name){