diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-07-06 23:39:24 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-07-06 23:39:24 +0000 |
commit | 6dcb99e42257de276814d3fe42a19c8f85e776d2 (patch) | |
tree | f1c78b005030bdb010ef54e49b96d44127e98b9a /src/char_sql/char.c | |
parent | 5b1d1678fd03d6c780e933f6e464e3b02a860c0d (diff) | |
download | hercules-6dcb99e42257de276814d3fe42a19c8f85e776d2.tar.gz hercules-6dcb99e42257de276814d3fe42a19c8f85e776d2.tar.bz2 hercules-6dcb99e42257de276814d3fe42a19c8f85e776d2.tar.xz hercules-6dcb99e42257de276814d3fe42a19c8f85e776d2.zip |
- Modified the party_data structure on the map server to remove some redundant data. Added a party_data structure on the char-server to hold a more complete set of information about parties. Added to the party_member structure the class of each member so that the map server can do the appropiate checks even if the character is on another mapserver/offline. Due to the format changes in the party structure, txt servers will have to wipe their party file... (sql save format has not been changed)
- Added function char_family to check if there's a family state given the three character ids, instead of doing individual checks all the time.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7553 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/char.c')
-rw-r--r-- | src/char_sql/char.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c index a158bec01..58fa10784 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -4408,3 +4408,48 @@ int char_married(int pl1,int pl2) { else
return 0;
}
+
+int char_family(int pl1,int pl2,int pl3) {
+ int charid, partnerid, childid;
+ sprintf (tmp_sql, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, pl1, pl2, pl3);
+ 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 0;
+ }
+ sql_res = mysql_store_result (&mysql_handle);
+ if (!sql_res) return 0;
+
+ while((sql_row = mysql_fetch_row(sql_res)))
+ {
+ charid = atoi(sql_row[0]);
+ partnerid = atoi(sql_row[1]);
+ childid = atoi(sql_row[2]);
+ if (charid == pl1) {
+ if ((pl2 == partnerid && pl3 == childid) ||
+ (pl3 == partnerid && pl2 == childid)
+ ) {
+ mysql_free_result (sql_res);
+ return 1;
+ }
+ }
+ if(charid == pl2) {
+ if ((pl1 == partnerid && pl3 == childid) ||
+ (pl3 == partnerid && pl1 == childid)
+ ) {
+ mysql_free_result (sql_res);
+ return 1;
+ }
+ }
+ if(charid == pl3) {
+ if ((pl1 == partnerid && pl2 == childid) ||
+ (pl2 == partnerid && pl1 == childid)
+ ) {
+ mysql_free_result (sql_res);
+ return 1;
+ }
+ }
+ }
+ mysql_free_result (sql_res);
+ return 0;
+}
|