diff options
| author | Machiavelli <none@none> | 2010-08-25 19:12:53 +0200 |
|---|---|---|
| committer | Machiavelli <none@none> | 2010-08-25 19:12:53 +0200 |
| commit | e8a7a53bfa26c3809d3540cfeae81efd04a3ae5d (patch) | |
| tree | 3aac6463042893aed90afd93a8319b294b1920da /src/server/game/Server/Protocol | |
| parent | de858a4c337c9b151dddf0adee8f9329e60f7367 (diff) | |
Fix crash added in 9c655c11b7
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Server/Protocol')
| -rw-r--r-- | src/server/game/Server/Protocol/Handlers/NPCHandler.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp index d87d145b3fc..0619b98684e 100644 --- a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp @@ -517,9 +517,19 @@ void WorldSession::HandleListStabledPetsOpcode(WorldPacket & recv_data) void WorldSession::SendStablePet(uint64 guid) { + m_sendStabledPetCallback.SetParam(guid); + m_sendStabledPetCallback.SetFutureResult( + CharacterDatabase.AsyncPQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot", + _player->GetGUIDLow(), PET_SAVE_FIRST_STABLE_SLOT, PET_SAVE_LAST_STABLE_SLOT) + ); +} + +void WorldSession::SendStablePetCallback(QueryResult_AutoPtr result, uint64 guid) +{ sLog.outDebug("WORLD: Recv MSG_LIST_STABLED_PETS Send."); WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size + data << uint64 (guid); Pet *pet = _player->GetPet(); @@ -541,36 +551,26 @@ void WorldSession::SendStablePet(uint64 guid) data << uint8(1); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show) ++num; } - - m_sendStabledPetCallback.SetFirstParam(&data); - m_sendStabledPetCallback.SetSecondParam(num); - m_sendStabledPetCallback.SetFutureResult( - CharacterDatabase.AsyncPQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot", - _player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT) - ); -} - -void WorldSession::SendStablePetCallback(QueryResult_AutoPtr result, WorldPacket* data, uint8 num) -{ + if (result) { do { Field *fields = result->Fetch(); - *data << uint32(fields[1].GetUInt32()); // petnumber - *data << uint32(fields[2].GetUInt32()); // creature entry - *data << uint32(fields[3].GetUInt32()); // level - *data << fields[4].GetString(); // name - *data << uint8(2); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show) + data << uint32(fields[1].GetUInt32()); // petnumber + data << uint32(fields[2].GetUInt32()); // creature entry + data << uint32(fields[3].GetUInt32()); // level + data << fields[4].GetString(); // name + data << uint8(2); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show) ++num; } while (result->NextRow()); } - data->put<uint8>(4, num); // set real data to placeholder - SendPacket(data); + data.put<uint8>(sizeof(uint64), num); // set real data to placeholder + SendPacket(&data); } |
