Jump to content

Recommended Posts

Hey guys, im currently trying to code some parts of monster card (just the loading part of .txt and some functions, later i will pay a developer to do the rest)

but i'm getting a unhandled exception error i attached the proces to visual studio after the login it crashs and the error is "unhandled exception ..."

 

here is the function

 

bool CPythonPlayer::LoadMonsterCard(const char* c_szFileName)
{
	const VOID* pvData;
	CMappedFile kFile;
	if (!CEterPackManager::Instance().Get(kFile, c_szFileName, &pvData))
		return false;

	CMemoryTextFileLoader kTextFileLoader;
	kTextFileLoader.Bind(kFile.Size(), pvData);

	CTokenVector kTokenVector;
	for (DWORD i = 0; i < kTextFileLoader.GetLineCount(); ++i)
	{
		if (!kTextFileLoader.SplitLineByTab(i, &kTokenVector))
			continue;

		int pkMap2, pkMap3 = 0;

		int pkGroup = std::stoi(kTokenVector[MONSTER_CARD_GROUP]);
		int pkIndex = std::stoi(kTokenVector[MONSTER_CARD_INDEX]);
		int pkVnum = std::stoi(kTokenVector[MONSTER_CARD_VNUM]);
		int pkType = std::stoi(kTokenVector[MONSTER_CARD_TYPE]);
		int pkMap1 = std::stoi(kTokenVector[MONSTER_CARD_MAP1]);
		pkMap2 = std::stoi(kTokenVector[MONSTER_CARD_MAP2]);
		pkMap3 = std::stoi(kTokenVector[MONSTER_CARD_MAP3]);

		TMonsterCardTable * pTable = new TMonsterCardTable;
		pTable->pkGroup = pkGroup;
		pTable->pkIndex = pkIndex;
		pTable->pkVnum = pkVnum;
		pTable->pkType = pkType;
		pTable->pkMap1 = pkMap1;
		pTable->pkMap2 = pkMap2;
		pTable->pkMap3 = pkMap3;
		m_MonsterCardDataMap.insert(TMonsterCardTableDataMap::value_type(pkIndex, pTable));
		if (pTable->pkType == 0) m_iMonsterCardDataSoloMax++;
		if (pTable->pkType == 1) m_iMonsterCardDataPartyMax++;
	}

	if (m_MonsterCardDataMap.size() > 0)
		SetLoadMonsterCard(true);
	else
		SetLoadMonsterCard(false);
}

 

the result of attaching the process is this line: int pkGroup = std::stoi(kTokenVector[MONSTER_CARD_GROUP]);

 

Can someone help me? unfortunatly i do not understand anything about coding i just copy & paste & use my brain :(

@WeedHex @VegaS™ @Nirray

 

 

€dit: problem solved with the solution of vegas, thank you!! 

Edited by Kafa
  • Forum Moderator

Search for:

		if (!kTextFileLoader.SplitLineByTab(i, &kTokenVector))
			continue;

Add after:

		if (kTokenVector.size() != MONSTER_CARD_MAX_NUM)
		{
			Tracef("CPythonPlayer::LoadMonsterCard(%s) - Strange Token Count [Line:%d / TokenCount:%d]\n", c_szFileName, i, kTokenVector.size());
			continue;
		}
		
		for (auto & token : kTokenVector)
			token.erase(std::remove_if(token.begin(), token.end(), isspace), token.end());

 

Search for:

		int pkGroup = std::stoi(kTokenVector[MONSTER_CARD_GROUP]);
		int pkIndex = std::stoi(kTokenVector[MONSTER_CARD_INDEX]);
		int pkVnum = std::stoi(kTokenVector[MONSTER_CARD_VNUM]);
		int pkType = std::stoi(kTokenVector[MONSTER_CARD_TYPE]);
		int pkMap1 = std::stoi(kTokenVector[MONSTER_CARD_MAP1]);
		pkMap2 = std::stoi(kTokenVector[MONSTER_CARD_MAP2]);
		pkMap3 = std::stoi(kTokenVector[MONSTER_CARD_MAP3]);

Replace with:

This is the hidden content, please

And change # to ## from .txt file or delete them.

Edited by VegaS™
  • Metin2 Dev 2
  • Good 1
  • Love 3

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.