diff options
| author | leak <leakzx@googlemail.com> | 2011-04-28 22:54:30 +0200 |
|---|---|---|
| committer | leak <leakzx@googlemail.com> | 2011-04-28 22:54:30 +0200 |
| commit | e2e9431ca3b4725f29e13350eb9ca0b46cc0aff1 (patch) | |
| tree | 6b4ad21b0223031c16ac846a832d2ffd4d3c56d2 /src/server/game/Chat | |
| parent | 3ab83417f5d6e18cf055195aa35beefdc4f98b9b (diff) | |
Core/ObjectMgr: Refactor sGOStorage
Diffstat (limited to 'src/server/game/Chat')
| -rwxr-xr-x | src/server/game/Chat/Commands/Level3.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index abc8cfe7185..72db4e2c527 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -612,7 +612,7 @@ bool ChatHandler::HandleListObjectCommand(const char *args) return false; } - GameObjectInfo const * gInfo = ObjectMgr::GetGameObjectInfo(go_id); + GameObjectTemplate const * gInfo = sObjectMgr->GetGameObjectTemplate(go_id); if (!gInfo) { PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id); @@ -1307,21 +1307,17 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args) uint32 count = 0; uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS); - for (uint32 id = 0; id< sGOStorage.MaxEntry; id++) + GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates(); + for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr) { - GameObjectInfo const* gInfo = sGOStorage.LookupEntry<GameObjectInfo>(id); - if (!gInfo) - continue; - - int loc_idx = GetSessionDbLocaleIndex(); - if (loc_idx >= 0) + uint8 localeIndex = GetSessionDbLocaleIndex(); + if (localeIndex >= 0) { - uint8 uloc_idx = uint8(loc_idx); - if (GameObjectLocale const *gl = sObjectMgr->GetGameObjectLocale(id)) + if (GameObjectLocale const *gl = sObjectMgr->GetGameObjectLocale(itr->second.entry)) { - if (gl->Name.size() > uloc_idx && !gl->Name[uloc_idx].empty()) + if (gl->Name.size() > localeIndex && !gl->Name[localeIndex].empty()) { - std::string name = gl->Name[uloc_idx]; + std::string name = gl->Name[localeIndex]; if (Utf8FitTo(name, wnamepart)) { @@ -1332,9 +1328,9 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args) } if (m_session) - PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str()); + PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str()); else - PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str()); + PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str()); if (!found) found = true; @@ -1345,7 +1341,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args) } } - std::string name = gInfo->name; + std::string name = itr->second.name; if (name.empty()) continue; @@ -1358,9 +1354,9 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args) } if (m_session) - PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, id, id, name.c_str()); + PSendSysMessage(LANG_GO_ENTRY_LIST_CHAT, itr->second.entry, itr->second.entry, name.c_str()); else - PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, id, name.c_str()); + PSendSysMessage(LANG_GO_ENTRY_LIST_CONSOLE, itr->second.entry, name.c_str()); if (!found) found = true; |
