I have a 2d int array which represents tiles on level like this:
0000000000000000000000 0000000000000000000000 0000000000000000000000 1111111111111111111111
I have a tileset vector, where each element has it's own tileX and tileY value(position of a tile in a tileset image), collision data etc. So, when I draw a level each time I draw a tile, I ask about them like this:
draw(tileset[currentTile]->tx, tileset[currentTile]->tY, tileWidth, tileHeight);
But, as you can see, there will be lots of the same elements when I iterate through for loop, so do I need to keep lastCollisionData variable in level class to reduce time used to access each tile separately?