I have been trying to get my game to work recently. As of now Im just trying to get it to print the map. I made it so everytime you click a button to move, it reprints the whole map 45 x 80 characters, and then place the character. Apparently this is way too slow to do, as everytime I move, my character blinks and then moves. So if I keep pressing the button, he slowly moves and keeps moving after im done pressing the keys. This is the code:
I'm having trouble reading your code, but I think the problem isn't your container, but your use of std::cout to do output. I'd recommend that instead of writing each character individually with std::cout, create a CHAR_INFO buffer and write the whole thing out with WriteConsoleOutput() in a single go.
Sorry, for some reason it messed up my code posts. Anyways, I tried using WriteConsoleOutput(), but cant figure out how to completely use it. Here is what I have so far:
In order to use WriteConsoleOutput() you need to create a CHAR_INFO array the size of the block you want to write. Multiply the number of columns of the area by the number of rows of the area. For a number of columns C, the first C CHAR_INFO entries represent the first row. For the first element set the Char member to whatever character you want to display in the upper-left of the block. Then set the Attributes member to represent the character's foreground and background color. Repeat until the entire array is filled. Does that help?
You could have a look at Ben Ryves' Windows Console tutorials. He provides a pretty good explanation along with sample code and covers what you're trying to do.
Alright, I got it all fixed. It runs smoothly now. However, now I have another problem. I have a loop that keeps running that asks you for a keypress, and then it sends to movechar function, and back to printmap which prints the map. For some reason though, After exactly 140 moves of any type, the game pauses and I get a windows error. Then I tried debugging it, and it says:
"An action violation (Segmentation Fault) has been raised."
But there doesnt seem to be anything special happening until then, and it all runs fine. It even prints the it out the final time, then fails. What could be the problem? If you need to, I can post the codes it runs through.