Thanks, it was #include<iterator>, i now get a warning saying:
The line in which this warning occurs in is:Code:warning: deleting 'void*' is undefined
....any ideas about that badboy?Code:delete *i->second;
Thanks, it was #include<iterator>, i now get a warning saying:
The line in which this warning occurs in is:Code:warning: deleting 'void*' is undefined
....any ideas about that badboy?Code:delete *i->second;
IT WORKS!!!!! Don't ask me how i got rid of the the warning, it jus dissapeared. But then i read the introduction to my game into the program and this happened:
DARN!!!! Can't upload a screenshot, anyways, the writing isn't formatted at all, when it gets to the end of the console line it goes onto a new line, even in the middle of a word! Is there anyway to fix this?
Widen the length of your console?
I've widened it as far as it will go and it still doesn't work, and there is also paragraphs in the text file but they aren't distinguished in the console window. Any ideas?
Oh. I see your problem... words are getting cut off half way through them? It kinda makes sense. You're probably going to have to format it in your text documents for the width of screen. Unless you want to do some run-time checking... Count the number of letters in a line so far and because you can find out the length of the console window you can '\n' where appropriate.
Yeah but on different lines there's a different amound of words, like say the 1st line, it only has 1 word in it, and the second has 2, how am i supposed to format that?
I'm not certain I understand. Give me some examples. You'll probably have to write some small background scripting identifiers to identify when one passage is finished. Like getline until you come across a ~ or something. And print up to that:
file_contents[filename] returns a vector of stringsCode:void read_file( const std::string &filename ) { // No error checking done here! Needs to be added file_streams[filename] = new std::ifstream(filename.c_str()); std::string line; while ( std::getline( *file_streams[filename], line ) ) { if ( line.find( "~" ) != std::string::npos ) file_contents[filename].at(file_contents[filename].size()) += "\n" + line; else file_contents[filename].push_back( line ); } }
using the .at() method for the size of the vector returns the last element of it. You could always have used the [] operator. Both ways return the specific last string.
+= "\n" + line will add the next line to it.
Now I haven't tested this but I hope it should do the following:
Does it work? The ~ has to be at the end of the line. Also you might want to remove it from the line you read.this is
a test which
I haven't tested~
Does it work?