summaryrefslogtreecommitdiff
path: root/src/char
diff options
context:
space:
mode:
authorEmistry Haoyan <equinox1991@gmail.com>2019-07-12 01:25:19 +0800
committerEmistry Haoyan <equinox1991@gmail.com>2019-07-12 01:25:19 +0800
commit2793fa142be02e91f43a831366db232f80940d21 (patch)
tree9da32c357330c2e7bbb976257e8eea4bb620596d /src/char
parenta5eb6ec995612c878a3b6cb522520ffae8b13a3b (diff)
downloadhercules-2793fa142be02e91f43a831366db232f80940d21.tar.gz
hercules-2793fa142be02e91f43a831366db232f80940d21.tar.bz2
hercules-2793fa142be02e91f43a831366db232f80940d21.tar.xz
hercules-2793fa142be02e91f43a831366db232f80940d21.zip
Fix family check and EXP bug
- failsafe function to not execute the query - avoid EXP sharing bug
Diffstat (limited to 'src/char')
-rw-r--r--src/char/char.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/char/char.c b/src/char/char.c
index cad28b373..c5afc0f63 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -2273,6 +2273,8 @@ static int char_char_married(int pl1, int pl2)
static int char_char_child(int parent_id, int child_id)
{
+ if (parent_id == 0 || child_id == 0) // Failsafe, avoild querys and fix EXP bug dividing with lower level chars
+ return 0;
if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", char_db, parent_id) )
Sql_ShowDebug(inter->sql_handle);
else if( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) )
@@ -2292,6 +2294,8 @@ static int char_char_child(int parent_id, int child_id)
static int char_char_family(int cid1, int cid2, int cid3)
{
+ if (cid1 == 0 || cid2 == 0 || cid3 == 0) //Failsafe, and avoid querys where there is no sense to keep executing if any of the inputs are 0
+ return 0;
if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", char_db, cid1, cid2, cid3) )
Sql_ShowDebug(inter->sql_handle);
else while( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) )