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 committed by tomrus88
parent 99ff9ab5d9
commit aaddf4b51b
5 changed files with 112 additions and 202 deletions

View file

@ -324,8 +324,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)
@ -421,8 +420,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;