Core/ObjectMgr: Refactor sPageTextStore

This commit is contained in:
leak
2011-04-28 22:13:09 +02:00
parent 85a1e9e7ab
commit 19cab2c508
5 changed files with 73 additions and 64 deletions
@@ -19,28 +19,6 @@
#ifndef __NPCHANDLER_H
#define __NPCHANDLER_H
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform
#if defined(__GNUC__)
#pragma pack(1)
#else
#pragma pack(push,1)
#endif
struct PageText
{
uint32 Page_ID;
char * Text;
uint32 Next_Page;
};
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
#if defined(__GNUC__)
#pragma pack()
#else
#pragma pack(pop)
#endif
struct QEmote
{
uint32 _Emote;
@@ -411,12 +411,12 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data)
while (pageID)
{
PageText const *pPage = sPageTextStore.LookupEntry<PageText>(pageID);
PageText const* pageText = sObjectMgr->GetPageText(pageID);
// guess size
WorldPacket data(SMSG_PAGE_TEXT_QUERY_RESPONSE, 50);
data << pageID;
if (!pPage)
if (!pageText)
{
data << "Item page missing.";
data << uint32(0);
@@ -424,7 +424,7 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data)
}
else
{
std::string Text = pPage->Text;
std::string Text = pageText->Text;
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
@@ -432,8 +432,8 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data)
sObjectMgr->GetLocaleString(pl->Text, loc_idx, Text);
data << Text;
data << uint32(pPage->Next_Page);
pageID = pPage->Next_Page;
data << uint32(pageText->NextPage);
pageID = pageText->NextPage;
}
SendPacket(&data);