Thoughts on refactoring and futher improving the engine

Started by Crimson Wizard, Wed 20/06/2012 09:46:17

Previous topic - Next topic

Crimson Wizard

Quote from: Snarky on Wed 23/01/2013 17:38:17
Quote from: Crimson Wizard on Wed 23/01/2013 09:39:28
But I was thinking that it is possible to use wide strings internally in the engine, and read/write them as portable multibyte strings in game data / saved games.

Seems unnecessarily complicated. I don't really know enough to say which option is best, but just on gut feeling I would lean towards multibyte strings.
That's not really too complicated, but I was probably overthinking this. In case of wide-strings they could always be saved as 16 bit-char arrays. That would cut off some really exotic symbols, but oh well.



Interesting thing is, that Allegro library, which AGS is using, has all the basic string routines made for handling any sort of encoding, while always work with char* arrays. The interpretation of the string depends on initial setting. AGS does it this way:
Code: cpp

set_uformat(U_ASCII);

We may change this to
Code: cpp

set_uformat(U_UTF8);

An investigation should be conducted to see what problems may arise in existing code after such change.

The String class I wrote some time ago may be changed to work with Allegro's string routines instead of stdlib ones.
The biggest problem of UTF8 (varied-size chars), probably, is getting an Nth character. Looking through all chars sequentially may be done with the use of string iterator - this will save time. Getting random character will be much slower, compared to ASCII strings, but I think this operation is rarely used on strings.

SMF spam blocked by CleanTalk