Original Post
Hi there, I am currently programming a text adventure in C++. Needless to say there will be a lot of text. I have a function which fills a character array with one sentence depending on the Sentence ID I pass in: The problem is that my text adventure will end up with a few MB of strings and all the strings are landing on the stack when I enter this function. The stack size if I remember correctly is at its maximum about 1MB; so I don't think the current approach works. How should I resolve this? Hash-defines won't really work for me since I plan to implement different languages and the TextIDs should be the same for every language for every particular sentence. Any ideas? Cheers.
void GetText(wchar_t* pTextArray, int TextID)
{
switch(TextID)
{
case TEXT_01:
wcscpy_s(pTextArray, 256, L"Hello, how are you?");
break;
case TEXT_02:
wcscpy_s(pTextArray, 256, L"Good, thanks, how are you?");
break;
default:
break;
}
}