Hello,
I'm having this problem in my code that I just can't figure out the reason to, I'm trying to set an integer value to an integer variable that's a member of a class that is part of an array member of another class.
It should be an int = int, same type of variable, and should work.
However, it produces this error, which I think means that the value on the left of the '=' is not recognized of the correct type, though, I can't be sure, as MSDN is really foggy about this, and I haven't quite found anything similiar happening to anyone on a Google search for it.
This is the way it's built:
Project.h:
template <class T>
inline std::string to_string (const T& t);
class Project{
public:
friend class Map;
list<Map> maps;
list<Map>::iterator it;
Project();
};
public ref class MProject{
public:
Project * _p;
MProject();
};
Map.h:
class Map{
public:
friend class Tile;
//An array of the tiles the map consists.
Tile *tile;
//Provides easy access to the matrix format of the map.
//x and y are to be entered by tiles and not by pixels.
Tile getTile(int x, int y);
Map::Map(int width, int height);
Map::Map(list<Map>::iterator it);
};
public ref class MMap{
public:
Map * _m;
MMap(int width, int height);
}
The following are the functions that seem to be the main attraction for errors, however, in actuality, they haven't seemed to produce any yet.
Map.cpp:
//Returns the tile at the given x and y positions.
Tile Map::getTile(int x, int y){
return this->tile[(16*y*this->xTile*16)+(x*16)];
}
//Initializes the dynamic array to the size given by the constructor.
Map::Map(int width, int height): tile(new Tile[width*height])
{
this->xTile = width;
this->yTile = height;
Tile.h:
class Tile{
public:
int x, y;
//0 = Solid, 1 = not solid - pass under, 2 = not solid - pass over.
int solid;
//Position of the tile on the chipset.
int CPosX;
int CPosY;
bool passDir[4];
Tile();
};
ref class MTile{
public:
Tile * _t;
MTile();
}
This is the line I'm getting the error at:
project._p->it->getTile(x, y).CPosX = panel2->Location.X;
So, as you can see, CPosX and X in this line are both integers, so why am I getting this error? Or am I misinterperting the reason for the error?
I would really like for some assistance on this issue.
Thanks for any and all helpers.