*Try to fix the bug that pet cause client crash.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-04-02 19:05:17 -06:00
parent bd6974abcd
commit 8e0a0877e1
+6 -5
View File
@@ -184,9 +184,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
SetUInt32Value(UNIT_NPC_FLAGS, 0); SetUInt32Value(UNIT_NPC_FLAGS, 0);
SetName(fields[9].GetString()); SetName(fields[9].GetString());
map->Add((Creature*)this);
owner->SetGuardian(this, true);
switch(getPetType()) switch(getPetType())
{ {
case SUMMON_PET: case SUMMON_PET:
@@ -212,7 +209,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
sLog.outError("Pet have incorrect type (%u) for pet loading.", getPetType()); sLog.outError("Pet have incorrect type (%u) for pet loading.", getPetType());
} }
InitStatsForLevel(petlevel);
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32()); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32());
SetCreatorGUID(owner->GetGUID()); SetCreatorGUID(owner->GetGUID());
@@ -222,6 +218,11 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
uint32 savedhealth = fields[11].GetUInt32(); uint32 savedhealth = fields[11].GetUInt32();
uint32 savedmana = fields[12].GetUInt32(); uint32 savedmana = fields[12].GetUInt32();
map->Add((Creature*)this);
owner->SetGuardian(this, true);
InitStatsForLevel(petlevel);
// set current pet as current // set current pet as current
if(fields[8].GetUInt32() != 0) if(fields[8].GetUInt32() != 0)
{ {
@@ -281,7 +282,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
} }
// since last save (in seconds) // since last save (in seconds)
uint32 timediff = (time(NULL) - fields[16].GetUInt32()); //uint32 timediff = (time(NULL) - fields[16].GetUInt32());
m_resetTalentsCost = fields[17].GetUInt32(); m_resetTalentsCost = fields[17].GetUInt32();
m_resetTalentsTime = fields[18].GetUInt64(); m_resetTalentsTime = fields[18].GetUInt64();