Jump to content

[HELP]New function: Counting items


Recommended Posts

Hello everybody,

 

i have a problem with new funtion in error log i have this:

char_item.cpp: In member function 'bool CHARACTER::helpCountBeltSpecifyItem(DWORD, int) const':
char_item.cpp:6422: error: invalid conversion from 'const CHARACTER* const' to 'CHARACTER*'
char_item.cpp:6422: error:   initializing argument 1 of 'static bool CBeltInventoryHelper::IsItemInSlotBeltInventory(CHARACTER*, DWORD, int)'

this is the function from char_item.cpp

int CHARACTER::CountBeltSpecifyItem(DWORD vnum) const
{
    int	count = 0;
    LPITEM item;
    LPITEM beltItem = GetWear(WEAR_BELT);  
    
    if (beltItem != NULL) // if belt is equip
    {
        for (int i = BELT_INVENTORY_SLOT_START; i < BELT_INVENTORY_SLOT_END; ++i)
        {
            if (!helpCountBeltSpecifyItem(vnum, i))
            {
                continue;
            }
            else
            {
                count += item->GetCount();
            }
        }
    }
    
    return count;
}

bool CHARACTER::helpCountBeltSpecifyItem(DWORD vnum, int i) const
{
line 6422   ->if (CBeltInventoryHelper::IsItemInSlotBeltInventory(this, vnum, i))
        return true;
    else
        return false;
}

belt_inventory_helper.cpp

    static bool IsItemInSlotBeltInventory(LPCHARACTER pc, DWORD vnum, int target_cell)
    {
        if(pc == NULL)
            return false;
        if(vnum == NULL)
        {
            pc->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ERROR! [belt_inventory_helper] No vnum specified!"));
            return false;
        }
        if(target_cell == NULL)
        {
            pc->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ERROR! [belt_inventory_helper] No target cell specified!"));
            return false;
        }
        
        LPITEM beltInventoryItem = pc->GetInventoryItem(target_cell); //pc->GetInventoryItem(i)
        if(beltInventoryItem->GetVnum())
            return true;
        return false;
    }

Thanks for any help

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.