Error: Expression Must have a pointer type

title

character.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
bool Character::addItem(Item *item)
{
	if(item->m_iType == BATTLE_ITEM)
	{
		BATTLE_ITEM->addItem(item); //error occurs here
	}
	else
		if(item->m_iType == TREASURE_ITEM)
		{
			TREASURE_ITEM->addItem(item);
		}

}


item.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#pragma once

#define BATTLE_ITEM   1
#define TREASURE_ITEM 2

struct Item
{
    char    m_sItemName[65];
    char    m_sDesc[128];
    int     m_iType;
    double  m_dValue;
    double  m_dWeight;
    Item    *m_pLeft;
    Item    *m_pRight;
};

character.h

1
2
3
4
5
6
7
8
9
10
11
class Character
{
    private:
        char        m_sName[65];
        int         m_iClass;
        int         m_iAlignment;
        int         m_iHitPoints;
        int         m_iCharTraits[6]; // Strength, Dexterity, Constitution, 
                                // Intelligence, Wisdom, Charisma
        Possessions *m_pBattleItems;
        Possessions *m_pTreasureItems;


Last edited on
BATTLE_ITEM isn't a struct Item, it's an int.
how would I fix it?
fixed.. THANKS
Registered users can post here. Sign in or register to post.