mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
VerifyZoneInstance converted to QueryDatabase
This commit is contained in:
parent
7dce9d6c8e
commit
96c4b283fa
@ -2114,9 +2114,7 @@ bool Database::VerifyInstanceAlive(uint16 instance_id, uint32 char_id)
|
|||||||
{
|
{
|
||||||
//we are not saved to this instance so set our instance to 0
|
//we are not saved to this instance so set our instance to 0
|
||||||
if(!GlobalInstance(instance_id) && !CharacterInInstanceGroup(instance_id, char_id))
|
if(!GlobalInstance(instance_id) && !CharacterInInstanceGroup(instance_id, char_id))
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if(CheckInstanceExpired(instance_id))
|
if(CheckInstanceExpired(instance_id))
|
||||||
{
|
{
|
||||||
@ -2129,31 +2127,18 @@ bool Database::VerifyInstanceAlive(uint16 instance_id, uint32 char_id)
|
|||||||
|
|
||||||
bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
|
bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
|
||||||
{
|
{
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
char *query = nullptr;
|
||||||
char *query = 0;
|
|
||||||
MYSQL_RES *result;
|
|
||||||
|
|
||||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT id FROM instance_list where id=%u AND zone=%u",
|
auto results = QueryDatabase(query, MakeAnyLenString(&query, "SELECT id FROM instance_list where id=%u AND zone=%u",instance_id, zone_id));
|
||||||
instance_id, zone_id), errbuf, &result))
|
safe_delete_array(query);
|
||||||
{
|
|
||||||
safe_delete_array(query);
|
if (!results.Success())
|
||||||
if (mysql_num_rows(result) != 0)
|
|
||||||
{
|
|
||||||
mysql_free_result(result);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mysql_free_result(result);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
safe_delete_array(query);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
return false;
|
if (results.RowCount() == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Database::CharacterInInstanceGroup(uint16 instance_id, uint32 char_id)
|
bool Database::CharacterInInstanceGroup(uint16 instance_id, uint32 char_id)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user