[6882] Make corpse erase async.

This commit is contained in:
hunuza 2008-12-07 13:19:16 +01:00
parent 4df03b8561
commit e81af0b739
2 changed files with 42 additions and 39 deletions

View file

@ -29,15 +29,11 @@
#include "ObjectDefines.h"
#include "Corpse.h"
/// Handle periodic erase of corpses and bones
static void CorpsesErase(bool bones,uint32 delay)
static void CorpsesEraseCallBack(QueryResult *result, bool bones)
{
///- Get the list of eligible corpses/bones to be removed
//No SQL injection (uint32 and enum)
QueryResult *result = CharacterDatabase.PQuery("SELECT guid,position_x,position_y,map,player FROM corpse WHERE UNIX_TIMESTAMP()-time > '%u' AND corpse_type %s '0'", delay, (bones ? "=" : "<>") );
if(!result)
return;
if(result)
{
do
{
Field *fields = result->Fetch();
@ -72,6 +68,13 @@ static void CorpsesErase(bool bones,uint32 delay)
delete result;
}
/// Handle periodic erase of corpses and bones
static void CorpsesErase(bool bones,uint32 delay)
{
///- Get the list of eligible corpses/bones to be removed
//No SQL injection (uint32 and enum)
CharacterDatabase.AsyncPQuery(&CorpsesEraseCallBack, bones, "SELECT guid,position_x,position_y,map,player FROM corpse WHERE UNIX_TIMESTAMP()-time > '%u' AND corpse_type %s '0'", delay, (bones ? "=" : "<>"));
}
/// not thread guarded variant for call from other thread

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "6881"
#define REVISION_NR "6882"
#endif // __REVISION_NR_H__