I don't know how to fix this error that popped up when I tried to assign value of variable to another variable. Program crashes when I try to assign value of variable B to variable A, this thing should not happen, and I think I already tried everything. This is what I have:
class GameMap
{
public:
GameMap();
~GameMap();
int SetMapSizeX(int SizeX);
int SetMapSizeY(int SizeY);
int GetMapSizeX();
int GetMapSizeY();
int GetMapSize();
int MapSizeX;
int MapSizeY;
int MapTotalSize;
};
GameMap::GameMap()
{
MapSizeX = 0;
MapSizeY = 0;
MapTotalSize = 0;
}
GameMap::~GameMap()
{
}
int GameMap::SetMapSizeX(int SizeX)
{
return MapSizeX = SizeX;
}
int GameMap::SetMapSizeY(int SizeY)
{
return MapSizeY = SizeY;
}
int GameMap::GetMapSizeX()
{
return MapSizeX;
}
int GameMap::GetMapSizeY()
{
return MapSizeY;
}
int GameMap::GetMapSize()
{
GetMapSizeX();
GetMapSizeY();
return MapTotalSize = MapSizeX + MapSizeY;
}
Code maybe looks bad but it, had to separate everything so I can findout what exactly caused this error.
So, the crash is on this line:
return MapSizeX = SizeX;
I am not sure what am I doing wrong here.