Skocz do zawartości
Awaria serwera mailingowego (pracujemy nad przywróceniem działania)

Problem podczas kompilacja game 'has no member named 'bItemGrid' po dodaniu special inventory

Featured Replies

Opublikowano

Jak widac na screenie, wyskakuje taki blad. W char.h dodane:
#ifdef ENABLE_SPLIT_INVENTORY_SYSTEM
#include "../../common/service.h"
    UINT            bItemGrid[INVENTORY_AND_EQUIP_SLOT_MAX];
    LPITEM            pItems[INVENTORY_AND_EQUIP_SLOT_MAX];
#else
    BYTE            bItemGrid[INVENTORY_AND_EQUIP_SLOT_MAX];
    LPITEM            pItems[INVENTORY_AND_EQUIP_SLOT_MAX];
#endif
Jednak mimo to, nic nie dziala. Oryginalnie w char.h jest przypiete commondefines.h, tam tez dodalem define dla systemu dodatkowego ekwipunku. Mimo to ciagle ten sam blad:

wdwfafw.png

Rozwiązane przez Sevence

Przejdź do rozwiązania
Opublikowano

Z przedstawionego błędu wynika, że klasa 'PlayerSlotT' nie ma dostępu do 'bItemGrid'. Możliwe że makro ENABLE_SPLIT_INVENTORY_SYSTEM nie jest dostępne dla pliku char.h.

Czy sprawdzałeś, czy usunięcie ifdef ENABLE_SPLIT_INVENTORY_SYSTEM dla powyższych wpisów rozwiązuje problem?

 

Spróbuj dodać na samej górze pliku char.h następujący include:

 

Szukaj:

#include "../../common/stl.h"


Dodaj:

#include "../../common/service.h"

 

gmake dep && gmake clean && gmake -j20

 

Opublikowano
  • Autor

Usuniecie makro nic nie dalo, wiec podejrzewam, ze dodanie service.h nic nie da. (jest dodany w char.h include commondefines.h,  ktory rowniez posiada rozne makro). Pozwole dodac sobie tutaj kod, bo troche dziwi mnie to, ze w linijce z oryginalnym kodem bledu nie pokazuje, w dolozonym kodzie juz tak. C++ magiczne.. Funkcja w spoilu: (dodane zaczyna sie oczywiscie od enable_split..)
 

Spoiler

bool CHARACTER::IsEmptyItemGrid(TItemPos Cell, BYTE bSize, int iExceptionCell) const
{
    if (!m_PlayerSlots)
        return false;

    switch (Cell.window_type)
    {
    case INVENTORY:
        {
            WORD bCell = Cell.cell;

            ++iExceptionCell;

            if (Cell.IsBeltInventoryPosition())
            {
                LPITEM beltItem = GetWear(WEAR_BELT);

                if (NULL == beltItem)
                    return false;

                if (false == CBeltInventoryHelper::IsAvailableCell(bCell - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0)))
                    return false;

                if (m_PlayerSlots->bItemGrid[bCell])
                {
                    if (m_PlayerSlots->bItemGrid[bCell] == iExceptionCell)
                        return true;

                    return false;
                }

                if (bSize == 1)
                    return true;
            }
#ifdef ENABLE_SPLIT_INVENTORY_SYSTEM
            else if (Cell.IsSkillBookInventoryPosition())
            {
                if (bCell < SKILL_BOOK_INVENTORY_SLOT_START)
                    return false;
                
                if (bCell > SKILL_BOOK_INVENTORY_SLOT_END)
                    return false;
                
                if (m_PlayerSlots.bItemGrid[bCell] == (UINT)iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;
                    UINT bPage = bCell / (SKILL_BOOK_INVENTORY_MAX_NUM / 3);

                    do
                    {
                        UINT p = bCell + (5 * j);

                        if (p >= SKILL_BOOK_INVENTORY_MAX_NUM)
                            return false;

                        if (p / (SKILL_BOOK_INVENTORY_MAX_NUM / 3) != bPage)
                            return false;

                        if (m_PlayerSlots.bItemGrid[p])
                            if (m_PlayerSlots.bItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
            }
            else if (Cell.IsUpgradeItemsInventoryPosition())
            {
                if (bCell < UPGRADE_ITEMS_INVENTORY_SLOT_START)
                    return false;
                
                if (bCell > UPGRADE_ITEMS_INVENTORY_SLOT_END)
                    return false;
                
                if (m_PlayerSlots.bItemGrid[bCell] == (UINT)iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;
                    UINT bPage = bCell / (UPGRADE_ITEMS_INVENTORY_MAX_NUM / 3);

                    do
                    {
                        UINT p = bCell + (5 * j);

                        if (p >= UPGRADE_ITEMS_INVENTORY_MAX_NUM)
                            return false;

                        if (p / (UPGRADE_ITEMS_INVENTORY_MAX_NUM / 3) != bPage)
                            return false;

                        if (m_PlayerSlots.bItemGrid[p])
                            if (m_PlayerSlots.bItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
            }
            else if (Cell.IsStoneInventoryPosition())
            {
                if (bCell < STONE_INVENTORY_SLOT_START)
                    return false;
                
                if (bCell > STONE_INVENTORY_SLOT_END)
                    return false;
                
                if (m_PlayerSlots.bItemGrid[bCell] == (UINT)iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;
                    UINT bPage = bCell / (STONE_INVENTORY_MAX_NUM / 3);

                    do
                    {
                        UINT p = bCell + (5 * j);

                        if (p >= STONE_INVENTORY_MAX_NUM)
                            return false;

                        if (p / (STONE_INVENTORY_MAX_NUM / 3) != bPage)
                            return false;

                        if (m_PlayerSlots.bItemGrid[p])
                            if (m_PlayerSlots.bItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
            }
            else if (Cell.IsBoxInventoryPosition())
            {
                if (bCell < BOX_INVENTORY_SLOT_START)
                    return false;
                
                if (bCell > BOX_INVENTORY_SLOT_END)
                    return false;
                
                if (m_PlayerSlots.bItemGrid[bCell] == (UINT)iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;
                    UINT bPage = bCell / (BOX_INVENTORY_MAX_NUM / 3);

                    do
                    {
                        UINT p = bCell + (5 * j);

                        if (p >= BOX_INVENTORY_MAX_NUM)
                            return false;

                        if (p / (BOX_INVENTORY_MAX_NUM / 3) != bPage)
                            return false;

                        if (m_PlayerSlots.bItemGrid[p])
                            if (m_PlayerSlots.bItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
            }
            else if (Cell.IsEfsunInventoryPosition())
            {
                if (bCell < EFSUN_INVENTORY_SLOT_START)
                    return false;
                
                if (bCell > EFSUN_INVENTORY_SLOT_END)
                    return false;
                
                if (m_PlayerSlots.bItemGrid[bCell] == (UINT)iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;
                    UINT bPage = bCell / (EFSUN_INVENTORY_MAX_NUM / 3);

                    do
                    {
                        UINT p = bCell + (5 * j);

                        if (p >= EFSUN_INVENTORY_MAX_NUM)
                            return false;

                        if (p / (EFSUN_INVENTORY_MAX_NUM / 3) != bPage)
                            return false;

                        if (m_PlayerSlots.bItemGrid[p])
                            if (m_PlayerSlots.bItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
            }
            else if (Cell.IsCicekInventoryPosition())
            {
                if (bCell < CICEK_INVENTORY_SLOT_START)
                    return false;
                
                if (bCell > CICEK_INVENTORY_SLOT_END)
                    return false;
                
                if (m_PlayerSlots.bItemGrid[bCell] == (UINT)iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;
                    UINT bPage = bCell / (CICEK_INVENTORY_MAX_NUM / 3);

                    do
                    {
                        UINT p = bCell + (5 * j);

                        if (p >= CICEK_INVENTORY_MAX_NUM)
                            return false;

                        if (p / (CICEK_INVENTORY_MAX_NUM / 3) != bPage)
                            return false;

                        if (m_PlayerSlots.bItemGrid[p])
                            if (m_PlayerSlots.bItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
            }
#endif
            else if (bCell >= INVENTORY_MAX_NUM)
                return false;

            if (m_PlayerSlots->bItemGrid[bCell])
            {
                if (m_PlayerSlots->bItemGrid[bCell] == iExceptionCell)
                {
                    if (bSize == 1)
                        return true;

                    int j = 1;
                    BYTE bPage = bCell / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT);

                    do
                    {
                        BYTE p = bCell + (5 * j);

                        if (p >= INVENTORY_MAX_NUM)
                            return false;

                        if (p / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT) != bPage)
                            return false;

                        if (m_PlayerSlots->bItemGrid[p])
                            if (m_PlayerSlots->bItemGrid[p] != iExceptionCell)
                                return false;
                    }
                    while (++j < bSize);

                    return true;
                }
                else
                    return false;
            }

            if (1 == bSize)
                return true;
            else
            {
                int j = 1;
                BYTE bPage = bCell / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT);

                do
                {
                    BYTE p = bCell + (5 * j);

                    if (p >= INVENTORY_MAX_NUM)
                        return false;

                    if (p / (INVENTORY_MAX_NUM / INVENTORY_PAGE_COUNT) != bPage)
                        return false;

                    if (m_PlayerSlots->bItemGrid[p])
                        if (m_PlayerSlots->bItemGrid[p] != iExceptionCell)
                            return false;
                }
                while (++j < bSize);

                return true;
            }
        }
        break;

 

Opublikowano
  • Rozwiązanie
error: 'const class std::unique_ptr<PlayerSlotT>' has no member named 'bItemGrid'

 

Struktura PlayerSlotT jest typu std::unique_ptr, który jest inteligentnym wskaźnikiem.

Inteligentne wskaźniki nie przechowują bezpośrednio danych, więc nie możesz użyć operatora . do bezpośredniego dostępu do pola bItemGrid, aby uzyskać dostęp do tego pola, musisz użyć operatora ->.

 

Tak więc aby uzyskać dostęp, użyj operatora strzałki do uzyskania obiektu zarządzanego przez unique_ptr: 

if (m_PlayerSlots->bItemGrid[bCell] == (UINT)iExceptionCell)

 

  • Sevence zmienił(a) tytuł na Problem podczas kompilacja game 'has no member named 'bItemGrid' po dodaniu special inventory
  • Sevence zablokował(a) ten temat
Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.