• Advertisement
Sign in to follow this  

Problem writing to location

This topic is 4410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

"Unhandled exception at 0x0041e019 in map.exe: 0xC0000005: Access violation writing location 0xcdcdcdd9." I'm getting the above error in my program when I try and set values of variables in a class through a second class. The code is:
void MAP::AddRooms()
{
	int length = (maxy * maxx) + 2;
	for (int i = 1;i < length;i++)
	{
		int type = GetMapArrayElement(i);		
		roomlist[i-1]->SetY(i);
		roomlist[i-1]->SetType(type);
		roomlist[i-1]->SetExplored(false);
		roomlist[i-1]->SetPlayerin(false);
		roomlist[i-1]->SetMap(GetMap());
		roomlist[i-1]->SetX(i);			
	}
}
for calling the functions to set the variables from within the second class
void ROOM::SetX(int xnumber)
{
	x = xnumber;
}
void ROOM::SetY(int ynumber)
{
	y = ynumber;
}
void ROOM::SetMap(int mnumber)
{
	map = mnumber;
}
void ROOM::SetExplored(bool value)
{
	explored = value;
}
void ROOM::SetType(int typeno)
{
	type = typeno;
}
void ROOM::SetPlayerin(bool value)
{
	playerin = value;
}
For setting the variables within their class. Debugging it, it crashes on trying to set any of those variables through the second class but if I try and do it normally it works fine.

Share this post


Link to post
Share on other sites
Advertisement

This topic is 4410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Advertisement