[7347] Prevent sql errors at GM-mode corpse save. Apply same chnages and for other pahsemask save part for consistense and safe.

This commit is contained in:
VladimirMangos 2009-02-27 06:47:33 +03:00
parent 01d7801ca0
commit 19c513fc61
4 changed files with 18 additions and 9 deletions

View file

@ -104,12 +104,21 @@ void Corpse::SaveToDB()
std::ostringstream ss; std::ostringstream ss;
ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance,phaseMask) VALUES (" ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,data,time,corpse_type,instance,phaseMask) VALUES ("
<< GetGUIDLow() << ", " << GUID_LOPART(GetOwnerGUID()) << ", " << GetPositionX() << ", " << GetPositionY() << ", " << GetPositionZ() << ", " << GetGUIDLow() << ", "
<< GetOrientation() << ", " << GetZoneId() << ", " << GetMapId() << ", '"; << GUID_LOPART(GetOwnerGUID()) << ", "
<< GetPositionX() << ", "
<< GetPositionY() << ", "
<< GetPositionZ() << ", "
<< GetOrientation() << ", "
<< GetZoneId() << ", "
<< GetMapId() << ", '";
for(uint16 i = 0; i < m_valuesCount; i++ ) for(uint16 i = 0; i < m_valuesCount; i++ )
ss << GetUInt32Value(i) << " "; ss << GetUInt32Value(i) << " ";
ss << "'," << uint64(m_time) <<", " << uint32(GetType()) ss << "',"
<< ", " << int(GetInstanceId()) << ", " << int(GetPhaseMask()) << ")"; << uint64(m_time) <<", "
<< uint32(GetType()) << ", "
<< int(GetInstanceId()) << ", "
<< uint16(GetPhaseMask()) << ")"; // prevent out of range error
CharacterDatabase.Execute( ss.str().c_str() ); CharacterDatabase.Execute( ss.str().c_str() );
CharacterDatabase.CommitTransaction(); CharacterDatabase.CommitTransaction();
} }

View file

@ -1124,8 +1124,8 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
<< m_DBTableGuid << "," << m_DBTableGuid << ","
<< GetEntry() << "," << GetEntry() << ","
<< mapid <<"," << mapid <<","
<< (uint32)spawnMask << "," << uint32(spawnMask) << "," // cast to prevent save as symbol
<< (uint32)GetPhaseMask() << "," << uint16(GetPhaseMask()) << "," // prevent out of range error
<< displayId <<"," << displayId <<","
<< GetEquipmentId() <<"," << GetEquipmentId() <<","
<< GetPositionX() << "," << GetPositionX() << ","

View file

@ -552,8 +552,8 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
<< m_DBTableGuid << ", " << m_DBTableGuid << ", "
<< GetEntry() << ", " << GetEntry() << ", "
<< mapid << ", " << mapid << ", "
<< (uint32)spawnMask << ", " << uint32(spawnMask) << "," // cast to prevent save as symbol
<< (uint32)GetPhaseMask() << "," << uint16(GetPhaseMask()) << "," // prevent out of range error
<< GetFloatValue(GAMEOBJECT_POS_X) << ", " << GetFloatValue(GAMEOBJECT_POS_X) << ", "
<< GetFloatValue(GAMEOBJECT_POS_Y) << ", " << GetFloatValue(GAMEOBJECT_POS_Y) << ", "
<< GetFloatValue(GAMEOBJECT_POS_Z) << ", " << GetFloatValue(GAMEOBJECT_POS_Z) << ", "

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7346" #define REVISION_NR "7347"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__