Fixed EXP bug and added failsafe to family check functions (#3350)

Fixes #3349
This commit is contained in:
Gustavo Brigo
2018-07-25 16:58:58 -03:00
committed by Lemongrass3110
parent fa4021d217
commit 952ac43e59

View File

@@ -1888,6 +1888,8 @@ int char_married(int pl1, int pl2)
int 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(sql_handle, "SELECT `child` FROM `%s` WHERE `char_id` = '%d'", schema_config.char_db, parent_id) )
Sql_ShowDebug(sql_handle);
else if( SQL_SUCCESS == Sql_NextRow(sql_handle) )
@@ -1907,6 +1909,8 @@ int char_child(int parent_id, int child_id)
int 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(sql_handle, "SELECT `char_id`,`partner_id`,`child` FROM `%s` WHERE `char_id` IN ('%d','%d','%d')", schema_config.char_db, cid1, cid2, cid3) )
Sql_ShowDebug(sql_handle);
else while( SQL_SUCCESS == Sql_NextRow(sql_handle) )