Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8207161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:54:50+00:00 2026-06-07T08:54:50+00:00

Ok this is extremely hard to explain. I tried to write a 100 line

  • 0

Ok this is extremely hard to explain. I tried to write a 100 line explanation in here, after I saw I failed I tried to create an image to better explain it which also failed http://img208.imageshack.us/img208/7383/48821020.png

It seems impossible because the complexity it extremely high. In the most raw is, I need to assign Id’s for each part of a string. Currently I can assign Id’s for a string example:

He: hey
She: Hi
He: What's up
She: Not much, you?
He: I'm fine, i'm selling a <Scale Armor> wanna buy it?
She: Next time maybe.

I can return What's up by using the function CString szText = GetTextAtLine(3); because What's up is located on the third line of the chat. Each line has an Id, the Id is the line number. Each line also has a pointer to a class named CItemElem. CItemElem holds all the information about an item.

I Locate the pointer by using the following function CItemElem *pItem = GetItemAtLineId(5), it would return the a pointer stored at map<unsigned int,CItemElem*>mItemChat where unsigned int is the line indetifier. Everytime someone talks something in chat if an item has been input at the chat a new element is inserted into the STL map with it’s line id.

CItemElem* CEditString::GetItemAtLineId( unsigned long uLine )
{

    for( map<unsigned int,CItemElem*>::iterator it = m_mItemChat.begin(); it != m_mItemChat.end(); ++it )
    {
        if( uLine == it->first )
            return( it->second );
    }

    return NULL;
}

So as you can see I can locate a CItemElem pointer by the line Id, but now my problem is I need to locate multiple items at the string because a max of 3 items can be input in a sentence at time:

He: Hey guys i'm selling <Scale Boots> <Wooden Sword> <Water Helmet> cool items!

Currently I can return only 1 item at a chat sentence at a time because I can locate the item by the line Id. I’ve been toasting my brain the past hours, please enlighten me how to be able to return more than one item at the same sentence Id.

Thanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:54:51+00:00Added an answer on June 7, 2026 at 8:54 am

    As the comments suggest, use a vector of CItemElem* as the value in the map or, write another class that wraps it for more readability also considering the future need of adding any other type than CItemElem. Also if string position is a required key in finding the item, then a map can be used instead of avector. Set each string position that spans the item to the pointer to that particular item so it can be easily retrieved when you have the string position in which the mouse is over.

    class CLineElem
    {
    
    public:
    void AddItemElem( CItemElem* pElem_i, int nStrPos_i );
    CItemElem* GetItemElemAt( int nStrPos_i );
    void RemoveAllItemElems();
    
    private:
        map<unsigned int, CItemElem*> m_Elems;
    };
    

    Then use CLineElem* in the map m_mItemChat instead of CItemElem*

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is kind of hard to explain. Basically it's kind of like a simple
I am completely new to Web Development, still a student. Kindly bare this extremely
This is extremely strange, and I'm hoping someone will have some insights to make
I know this is extremely silly. I have a view controller that scans a
This is my first question, but I've already found this site extremely helpful, so
Before I start know this: I am extremely new to Java and programming. How
This may be an extremely easy question but I can't get my head around
I'm extremely new to JS and have this code that I'm trying to tweak.
My problem is extremely similar to the one described in this SO question ,
Forgive me if there is an extremely simple answer to this question. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.