Oh, BTW, it just occured to me that you misunderstood what the problem is about.
It can't be const because
it is possible to change the string via a reference. That's not the problem.
(01-29-2013, 11:18 AM)Thomas Wrote: I think the problem is simply that the return value could be
const string&, otherwise it is possible to change the value and you get all kinds of strange stuff.
Exactly - 'all kinds of stuff' happening is exactly how things are
now, in the shipped game - it works a few times (value gets changed through a ref), but then the memory gets corrupt or something. That's what I'm trying to warn you about.
I know that this is not how the function was meant to be used, but as long as it is possible, there's a chance someone will do it - and by providing custom story/mod support, you are releasing an API of sorts to the public, so considering this sort of things becomes important.