Tab ve boşluk karakterlerinin karışık kullanılmasından kaynaklı sorununuz. Daima tab kullanın.
1735247877383.webp
 
1735590352980.webp

beyler en az 10 15kez kurdum sıfırdan ama envanterde bu sekılde sıralamada hata alıyor yardımcı olucak varmı
 
@Whistle @razuning
4 envanteri görmeme fixini ben bu şekilde yaptım tüm kod bloğuyla birlikte incelersiniz.
C++:
Genişlet Daralt Kopyala
bool CExchange::CheckSpace()
{
#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    static CGrid s_grid1(5, INVENTORY_MAX_NUM / 5 / INVENTORY_PAGE_COUNT); // inven page 1
    static CGrid s_grid2(5, INVENTORY_MAX_NUM / 5 / INVENTORY_PAGE_COUNT); // inven page 2
    static CGrid s_grid3(5, INVENTORY_MAX_NUM / 5 / INVENTORY_PAGE_COUNT); // inven page 3
    static CGrid s_grid4(5, INVENTORY_MAX_NUM / 5 / INVENTORY_PAGE_COUNT); // inven page 4
#else
    static CGrid s_grid1(5, INVENTORY_MAX_NUM/5 / 2); // inven page 1
    static CGrid s_grid2(5, INVENTORY_MAX_NUM/5 / 2); // inven page 2
#endif

    s_grid1.Clear();
    s_grid2.Clear();
#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    s_grid3.Clear();
    s_grid4.Clear();
#endif
    LPCHARACTER    victim = GetCompany()->GetOwner();
    LPITEM item;

    int i;
#ifdef ENABLE_EXTEND_INVEN_SYSTEM
    for (i = 0; i < INVENTORY_PAGE_SLOT_COUNT; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        s_grid1.Put(i, 1, item->GetSize());
    }
    for (i = INVENTORY_PAGE_SLOT_COUNT; i < INVENTORY_PAGE_SLOT_COUNT * 2; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        s_grid2.Put(i - INVENTORY_PAGE_SLOT_COUNT, 1, item->GetSize());
    }
    for (i = INVENTORY_PAGE_SLOT_COUNT * 2; i < INVENTORY_PAGE_SLOT_COUNT * 3; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        s_grid3.Put(i - INVENTORY_PAGE_SLOT_COUNT * 2, 1, item->GetSize());
    }
    for (i = INVENTORY_PAGE_SLOT_COUNT * 3; i < INVENTORY_PAGE_SLOT_COUNT * 4; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        s_grid4.Put(i - INVENTORY_PAGE_SLOT_COUNT * 3, 1, item->GetSize());
    }
#else
    for (i = 0; i < INVENTORY_MAX_NUM / 2; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        s_grid1.Put(i, 1, item->GetSize());
    }
    for (i = INVENTORY_MAX_NUM / 2; i < INVENTORY_MAX_NUM; ++i)
    {
        if (!(item = victim->GetInventoryItem(i)))
            continue;

        s_grid2.Put(i - INVENTORY_MAX_NUM / 2, 1, item->GetSize());
    }
#endif
    // ¾Æ... ¹º°¡ °³º´½Å °°Áö¸¸... ¿ëÈ¥¼® Àκ¥À» ³ë¸Ö Àκ¥ º¸°í µû¶ó ¸¸µç ³» À߸øÀÌ´Ù ¤Ğ¤Ğ
    static std::vector <WORD> s_vDSGrid(DRAGON_SOUL_INVENTORY_MAX_NUM);
   
    // ÀÏ´Ü ¿ëÈ¥¼®À» ±³È¯ÇÏÁö ¾ÊÀ» °¡´É¼ºÀÌ Å©¹Ç·Î, ¿ëÈ¥¼® Àκ¥ º¹»ç´Â ¿ëÈ¥¼®ÀÌ ÀÖÀ» ¶§ Çϵµ·Ï ÇÑ´Ù.
    bool bDSInitialized = false;
   
    for (i = 0; i < EXCHANGE_ITEM_MAX_NUM; ++i)
    {
        if (!(item = m_apItems[i]))
            continue;

        if (item->IsDragonSoul())
        {
            if (!victim->DragonSoul_IsQualified())
            {
                return false;
            }

            if (!bDSInitialized)
            {
                bDSInitialized = true;
                victim->CopyDragonSoulItemGrid(s_vDSGrid);
            }

            bool bExistEmptySpace = false;
            WORD wBasePos = DSManager::instance().GetBasePosition(item);
            if (wBasePos >= DRAGON_SOUL_INVENTORY_MAX_NUM)
                return false;
           
            for (int i = 0; i < DRAGON_SOUL_BOX_SIZE; i++)
            {
                WORD wPos = wBasePos + i;
#ifdef ENABLE_MARTY_FIX_159
                if (0 == s_vDSGrid[wPos]) // @fixme159 (wBasePos to wPos)
#else
                if (0 == s_vDSGrid[wBasePos])
#endif
                {
                    bool bEmpty = true;
                    for (int j = 1; j < item->GetSize(); j++)
                    {
                        if (s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM])
                        {
                            bEmpty = false;
                            break;
                        }
                    }
                    if (bEmpty)
                    {
                        for (int j = 0; j < item->GetSize(); j++)
                        {
                            s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM] =  wPos + 1;
                        }
                        bExistEmptySpace = true;
                        break;
                    }
                }
                if (bExistEmptySpace)
                    break;
            }
            if (!bExistEmptySpace)
                return false;
        }
        else
        {
            int iPos = s_grid1.FindBlank(1, item->GetSize());
#ifdef ENABLE_EXTEND_INVEN_SYSTEM
            if (iPos >= 0)
            {
                s_grid1.Put(iPos, 1, item->GetSize());
            }
            else
            {
                iPos = s_grid2.FindBlank(1, item->GetSize());
                if (iPos >= 0)
                {
                    s_grid2.Put(iPos, 1, item->GetSize());
                }
                else
                {
                    iPos = s_grid3.FindBlank(1, item->GetSize());
                    if (iPos >= 0)
                    {
                        s_grid3.Put(iPos, 1, item->GetSize());
                    }
                    else
                    {
                        iPos = s_grid4.FindBlank(1, item->GetSize());
                        if (iPos >= 0)
                        {
                            s_grid4.Put(iPos, 1, item->GetSize());
                        }
                        else
                        {
                            return false;
                        }
                    }
                }
            }
#else
            if (iPos >= 0)
            {
                s_grid1.Put(iPos, 1, item->GetSize());
            }
            else
            {
                iPos = s_grid2.FindBlank(1, item->GetSize());

                if (iPos >= 0)
                {
                    s_grid2.Put(iPos, 1, item->GetSize());
                }
                else
                {
                    return false;
                }
            }
#endif
        }
    }

    return true;
}
 
Geri
Üst