Interacting with signs. I need advice.

Started by
10 comments, last by Servant of the Lord 11 years, 4 months ago
I fixed it. That was the most painful bug I have ever experienced.

If you follow a career in computer programming you will experience thousands of new and creative ways to break things. To me, that is part of the fun.

I got a huge rush after I solved it. Feels great. Now I am just worried about how disorganized my code is getting. I am inexperienced when it comes to organizing things.

Advertisement

Quick tip: An array of arrays is not the same thing as a 2D array. One major difference is that each "row" of the vector-of-vectors aren't forced to be the same size.

For 2D arrays, I recommend a single vector, resized to (width * height).

You can then index into the vector using this:

myVector[(y * width) + x]

Although it looks more pleasing to do myVector[x,y], having a vector-of-a-vector complicates things by forcing you to manually keep the vector's rows the same length anytime you resize it.

To clear the vector:

myMap.assign((width * height), defaultTileValue);

This overwrites all the existing values with 'defaultTileValue'.

This topic is closed to new replies.

Advertisement