OK, it is very difficult to explain that I tried to write 100 line explanations here, I saw that after I failed I tried to make an image to explain it better, which also failed
It seems impossible because this complexity is very high. In most crude, I have to specify the ID for each part of the string. Currently I can specify the ID for a string example:
that: hey: hey: what's happening: not too much, you? That: I'm fine, I'm a & lt; Scale Armor & gt; Want to buy it? That: Next time maybe I can return what < function is by using cstring szText = GetTextAtLine (3); Because is running is located on the third line of chat, each row has an ID, the ID is the row number. Each line contains an indicator for a class named CItemElem CItemElem holds all the information about an item. I know the indicator by using the following function CItemElem * pItem = GetItemAtLineId (5) , it will return the stored pointer on a map and lieutenant; Unsigned int, CItemElem * & gt; MItemChat where is an unsigned int / line> line agent, every time someone did something in the conversation, if an item is input in chat then a new element is inserted with the line id in STL map CItemElem * CEditString :: GetItemAtLineId (unsigned long ULINE) {for map & lt; unsigned int, cItemElem *> :: iterator m_mItemChat.begin () =;; = M_mItemChat.end (); ++ this) {if (uLine == it-> before) return (it-> second;); } Return tap; } As you can see, I can find a CItemElem line indicator by ID, but now my problem is because I string more items than Need to find maximum 3 items can be input in one sentence at the time: that: hey people I'm selling & lt; Scale Boots & gt; & Lt; Wood sword & gt; & Lt; Water helmet & gt; Cool items! Currently, I can only return 1 item to a chat sentence at a time because I can find items by line ID. I have been toasting past your brain, please enlighten me how to be able to return more than one item on the same sentence Eid.
Thanks a lot!
After the
As the comment suggests, CItemElem * In the form of value in the map or, another class writes that it wraps for more readability, it also considers the future requirement of adding any other type than CItemElem is. Also if the string position is the key to locate the item, then the map can be used in place of a vector , set each string position, To be dispersed in that particular item, so that it can be easily achieved when you have a string position in which the mouse is over. AddItemElem (Seitmemel * PEMMMI, INSTSPOSi); Sitemel * GetItemElemAt (int nStrPos_i); Zero Remove AllItemElems (); Private: Maps & lt; Unsigned Int, Sitemel * & gt; M_Elems; }; then use CLineElem * instead of CItemElem * of m_mItemChat div>
Comments
Post a Comment