I work with mmorpg and I’m creating a system named chatlink. On this system when a player press ctrl over the item, the item is linked on the chat so when it’s sent all players who received the chat message will be able to click over that part of the sentence and a window with the item specs will come up.
Consider the folowing:
Player : Hey I’m selling <ItemA> and <Scale Boots>.
I must store on a class the following, (< position start ), (> position end ), item name color, item, (the item is stored via a void* pointer). I have the following class:
class chatitem
{
public:
chatitem();
~chatitem();
u_long m_uStartPos;
u_long m_uEndPos;
DWORD m_dwColor;
void* m_pItemElem;
};
I want to store it on a map:
map<unsigned int, chatitem*>m_chatItem which unsigned is the id of the chat line where it was input. The problem is each sentence can store up to 3 items. I’ve considered the following:
class CChatItem
{
public:
CChatItem();
~CChatItem();
u_long m_uStartPos[3];
u_long m_uEndPos[3];
DWORD m_dwColor[3];
void* m_pItemElem[3];
};
or duplicating like:
u_long m_uStartPos, u_long m_uStartPos2, u_long m_uStartPos3;
But I don’t want to use both of them, so any tips?
Looks like the bill be fitted to me.