[10905] Fixed vendor templates work.

* Avoid unexpected errors at template loading for shared templates for many npc.
* Really use vendor template in work.
This commit is contained in:
VladimirMangos 2010-12-21 19:35:07 +03:00
parent 72255d1bb1
commit 4a7638c80e
3 changed files with 3 additions and 3 deletions

View file

@ -2183,7 +2183,7 @@ VendorItemData const* Creature::GetVendorItems() const
VendorItemData const* Creature::GetVendorTemplateItems() const VendorItemData const* Creature::GetVendorTemplateItems() const
{ {
uint32 vendorId = GetCreatureInfo()->vendorId; uint32 vendorId = GetCreatureInfo()->vendorId;
return vendorId ? sObjectMgr.GetNpcVendorItemList(vendorId) : NULL; return vendorId ? sObjectMgr.GetNpcVendorTemplateItemList(vendorId) : NULL;
} }
uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)

View file

@ -9066,7 +9066,7 @@ void ObjectMgr::LoadVendorTemplates()
{ {
if (cInfo->vendorId) if (cInfo->vendorId)
{ {
if (vendor_ids.count(cInfo->vendorId) > 0) if (m_mCacheVendorTemplateItemMap.find(cInfo->vendorId) != m_mCacheVendorTemplateItemMap.end())
vendor_ids.erase(cInfo->vendorId); vendor_ids.erase(cInfo->vendorId);
else else
sLog.outErrorDb("Creature (Entry: %u) has vendor_id = %u for nonexistent vendor template", cInfo->Entry, cInfo->vendorId); sLog.outErrorDb("Creature (Entry: %u) has vendor_id = %u for nonexistent vendor template", cInfo->Entry, cInfo->vendorId);

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 "10904" #define REVISION_NR "10905"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__