StringTable cleanup and improvements

cleaned up function interface to avoid referencing the file system in the worker functions.
replaced StringTable's operators with functions.. The main reason is that these are far easier to look up when browsing the source.
This also fixes a premature translation in SBARINFO that was done in the parsing stage, not the printing stage.
This commit is contained in:
Christoph Oelckers 2024-04-21 10:07:14 +02:00
commit ebd4ebf298
50 changed files with 245 additions and 246 deletions

View file

@ -376,7 +376,7 @@ void player_t::SetLogNumber (int num)
// First look up TXT_LOGTEXT%d in the string table
mysnprintf(lumpname, countof(lumpname), "$TXT_LOGTEXT%d", num);
auto text = GStrings[lumpname+1];
auto text = GStrings.CheckString(lumpname+1);
if (text)
{
SetLogText(lumpname); // set the label, not the content, so that a language change can be picked up.
@ -394,7 +394,7 @@ void player_t::SetLogNumber (int num)
// If this is an original IWAD text, try looking up its lower priority string version first.
mysnprintf(lumpname, countof(lumpname), "$TXT_ILOG%d", num);
auto text = GStrings[lumpname + 1];
auto text = GStrings.CheckString(lumpname + 1);
if (text)
{
SetLogText(lumpname); // set the label, not the content, so that a language change can be picked up.
@ -422,7 +422,7 @@ void player_t::SetLogText (const char *text)
if (mo && mo->CheckLocalView())
{
// Print log text to console
Printf(PRINT_HIGH | PRINT_NONOTIFY, TEXTCOLOR_GOLD "%s\n", LogText[0] == '$' ? GStrings(text + 1) : text);
Printf(PRINT_HIGH | PRINT_NONOTIFY, TEXTCOLOR_GOLD "%s\n", LogText[0] == '$' ? GStrings.GetString(text + 1) : text);
}
}