Jump to content

std:string


Go to solution Solved by Mali,

Recommended Posts

Hi!

i try fix one system. so starting debugging :D

so i have one func in cmd_general. client send one word to server. and i try check is correctly.

	char arg1[4096];
	one_argument(argument, arg1, sizeof(arg1));
	
	if (!*arg1)
		return;

	int size_array = sizeof(argument) / sizeof(char);


	
	std::string nume_item(arg1);

	ch->ChatPacket(CHAT_TYPE_INFO, "argumentum: %s , nume_item : %s", argument, nume_item);

spacer.png

so argument or arg1 is correclty but when i pass it on to a string i got wrong characters.. 

What do I do wrong??

gcc8 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

thanks for help its work :) but u have one more question.

i fount why crash my server but i dont know why..

so :

 

itertype(m_map_pkDropItemGroup) it;
	
	for (std::map<DWORD, CDropItemGroup*>::iterator it = m_map_pkDropItemGroup.begin(); it != m_map_pkDropItemGroup.end(); it++)
	{
		
		if (it != m_map_pkDropItemGroup.end())
		{
			
			typeof(it->second->GetVector()) v = it->second->GetVector();
			

			for (DWORD i = 0; i < v.size(); ++i)
			{
				
				TItemTable* Titem = ITEM_MANAGER::instance().GetTable(v[i].dwVnum);
				bool nume = (name_item.length() ? strstr(Titem->szLocaleName, name_item.c_str()) != NULL : true);
				const CMob* pMob = CMobManager::instance().Get(it->first);
				std::string name_monster(pMob->m_table.szLocaleName);
				//ch->ChatPacket(CHAT_TYPE_INFO, "DWORD %d", it->first);
				

when i try get parameters from pMob.m_table i got all time crash . .when i just try wrote out it->first (dword) i got crash.. but if i list all "v[i].dwVnum" i have items .. but i dont know what is problem on pMob and it-first value. .. 😕 

have any ideas? 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.