Interesting issue with my code… running in debug mode (Eclipse/CDT)… all of my tiles seem to have their wall bool set to true? Anyone know wtf is going on?
Code, fully MVC and almost proper OO (I think), here:
main.cpp http://pastebin.com/f14kmfap
gridworld.h http://pastebin.com/vCmzxzrj
gridworld.cpp http://pastebin.com/jKKRFE9V
I suspect it has to do with this snippet here:
Tile::Tile(bool w) {
wall = w;
event = false;
eventText = "";
}
And how I use it to generate the map:
map[1][2] = new Tile(false);
First, the
Tile map[8][8];, will have the tiles default constructed. with the boolwallset to true.In the Map constructor you are using
Map::map[r][c] = new Tile()the right hand side is aTile*, the left hand side is aTile.The proper syntax for assigning to map would be
map[r][c] = Tile();, ormap[6][4]=Tile(false);