Avoid access to bag item prototype for getting bag size, use related item update field instead as more fast source.

This commit is contained in:
VladimirMangos 2008-11-01 21:08:39 +03:00
parent 3162a8dc61
commit 6f6ec21b72
5 changed files with 112 additions and 202 deletions

View file

@ -319,8 +319,7 @@ bool ChatHandler::HandleGetItemState(const char* args)
else
{
Bag *bag = (Bag*)item;
const ItemPrototype *proto = bag->GetProto();
for (uint8 j = 0; j < proto->ContainerSlots; ++j)
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
{
Item* item = bag->GetItemByPos(j);
if (item && item->GetState() == state)
@ -416,8 +415,7 @@ bool ChatHandler::HandleGetItemState(const char* args)
if(item->IsBag())
{
Bag *bag = (Bag*)item;
const ItemPrototype *proto = bag->GetProto();
for (uint8 j = 0; j < proto->ContainerSlots; ++j)
for (uint8 j = 0; j < bag->GetBagSize(); ++j)
{
Item* item = bag->GetItemByPos(j);
if (!item) continue;