Jump to content

dwPos is used without being initialized


Recommended Posts

i've just implemented a sash system, i do think is lentt's system.

i compiled the game/db/binary and i got no errors.

when i enter the username and the password the client closes and leaves no syserr info

i compiled a debug version of the binary and i get this error

the functions


#ifdef ENABLE_SASH_SYSTEM
void CItemData::SetItemScale(const std::string strJob, const std::string strSex, const std::string strScaleX, const std::string strScaleY, const std::string strScaleZ, const std::string strPositionX, const std::string strPositionY, const std::string strPositionZ)
{
	DWORD dwPos;
	if (strJob == "JOB_WARRIOR")
		dwPos = NRaceData::JOB_WARRIOR;
	else if (strJob == "JOB_ASSASSIN")
		dwPos = NRaceData::JOB_ASSASSIN;
	else if (strJob == "JOB_SURA")
		dwPos = NRaceData::JOB_SURA;
	else if (strJob == "JOB_SHAMAN")
		dwPos = NRaceData::JOB_SHAMAN;
	
	dwPos += 1;
	if (strSex == "F")
		dwPos += 5;
	
	m_ScaleTable.tInfo[dwPos].fScaleX = float(atof(strScaleX.c_str()) / 100.0f);
	m_ScaleTable.tInfo[dwPos].fScaleY = float(atof(strScaleY.c_str()) / 100.0f);
	m_ScaleTable.tInfo[dwPos].fScaleZ = float(atof(strScaleZ.c_str()) / 100.0f);
	m_ScaleTable.tInfo[dwPos].fPositionX = float(atof(strPositionX.c_str()) * 100.0f);
	m_ScaleTable.tInfo[dwPos].fPositionY = float(atof(strPositionY.c_str()) * 100.0f);
	m_ScaleTable.tInfo[dwPos].fPositionZ = float(atof(strPositionZ.c_str()) * 100.0f);
}

bool CItemData::GetItemScale(DWORD dwPos, float & fScaleX, float & fScaleY, float & fScaleZ, float & fPositionX, float & fPositionY, float & fPositionZ)
{
	DWORD dwPos;
	fScaleX = m_ScaleTable.tInfo[dwPos].fScaleX;
	fScaleY = m_ScaleTable.tInfo[dwPos].fScaleY;
	fScaleZ = m_ScaleTable.tInfo[dwPos].fScaleZ;
	fPositionX = m_ScaleTable.tInfo[dwPos].fPositionX;
	fPositionY = m_ScaleTable.tInfo[dwPos].fPositionY;
	fPositionZ = m_ScaleTable.tInfo[dwPos].fPositionZ;
	return true;
}
#endif

 

as far as i know, the variable dwPos is initialized, so i shouldn't get that error

if someone knows the problmem i would be happy to hear it, thanks

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

Top Posters In This Topic

3 hours ago, Fleon said:

It isnt actually, to initialize something you should do 


int myvariable = 0;

so in this case you can try to initialize dwPos to 0 or whatever you need in this case, but with such low debugging info`s i cant really dig into what`s wrong

i've just tried to initialize it with 0 and now i get no erros, but the client stops working and closes

any other sollution?

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


×
×
  • 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.